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.

Parameters:
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.

Parameters:
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

Parameters:
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.

Parameters:
directorystr

Direcory to clean

file_namestr

File name without file ending (!) to clean

keepiterable, optional

File endings to keep

DMT.external.latex.resolve_siunitx(label)[source]

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

DMT.external.latex.tex_to_text(tex)[source]

Return a text representation of a tex label.