Latex functions

As a big goal of DMT is pretty printing of reports and publications LaTeX can be directly used from DMT.core.plot and also for reports written using PyLaTeX.

The functions to directly interact with LaTeX are:

DMT supplied build latex command

DMT.external.latex.build_png(full_path_to_file, wait=True)[source]

Builds a tex file to png graphic.

full_path_to_filestr or os.Pathlike
DMT.external.latex.build_svg(full_path_to_file, wait=True)[source]

Builds a tex file to scalable vector graphic.

full_path_to_filestr or os.Pathlike
DMT.external.latex.build_tex(full_path_to_file, additional_compiler=None, wait=False, extension=None)[source]

Builds a tex file

full_path_to_filestr or os.Pathlike
additional_compiler: (str , [str])

If a additional tex compiler should be used, supply it here. It will be tried as first compiler. The additional compiler must be given in this argument with (<call_of_compiler>, List of compiler arguments). For example ‘latexmk’ looks like: (‘latexmk’, [’–interaction=nonstopmode’, ‘–shell-escape’, ‘–pdf’])

waitBoolean, False

Wait for the build to complete.

extensionNone, optional

If None, assumed extension of Tex file to build is “tex”, else the given string is used. Example: extension=”tikz”

DMT.external.latex.clean_tex_files(directory, file_name, keep=('.tex', '.pdf'), regex=False)[source]

Deletes all intermediate files in the directory with name file_name except the tex and pdf.


Direcory to clean


File name without file ending (!) to clean

keepiterable, optional

File endings to keep


This function tries to remove siunitx expressions from given Tex expression.


Return a text representation of a tex label.