Interface for writing, compiling, and converting .tex
files.
See also
Functions
compile_tex
(tex_file, tex_compiler, output_format)[source]¶Compiles a tex_file into a .dvi or a .xdv or a .pdf
tex_file (str
) – File name of TeX file to be typeset.
tex_compiler (str
) – String containing the compiler to be used, e.g. pdflatex
or lualatex
output_format (str
) – String containing the output format generated by the compiler, e.g. .dvi
or .pdf
Path to generated output file in desired format (DVI, XDV or PDF).
str
convert_to_svg
(dvi_file, extension, page=1)[source]¶Converts a .dvi, .xdv, or .pdf file into an svg using dvisvgm.
dvi_file (str
) – File name of the input file to be converted.
extension (str
) – String containing the file extension and thus indicating the file type, e.g. .dvi
or .pdf
page (Optional[int
], optional) – Page to be converted if input file is multi-page.
Path to generated SVG file.
str
generate_tex_file
(expression, environment=None, tex_template=None)[source]¶Takes a tex expression (and an optional tex environment), and returns a fully formed tex file ready for compilation.
expression (str
) – String containing the TeX expression to be rendered, e.g. \sqrt{2}
or foo
environment (Optional[str
], optional) – The string containing the environment in which the expression should be typeset, e.g. align*
tex_template (Optional[TexTemplate
], optional) – Template class used to typesetting. If not set, use default template set via config[“tex_template”]
Path to generated TeX file
str
tex_compilation_command
(tex_compiler, output_format, tex_file, tex_dir)[source]¶Prepares the tex compilation command with all necessary cli flags
tex_compiler (str
) – String containing the compiler to be used, e.g. pdflatex
or lualatex
output_format (str
) – String containing the output format generated by the compiler, e.g. .dvi
or .pdf
tex_file (str
) – File name of TeX file to be typeset.
tex_dir (str
) – Path to the directory where compiler output will be stored.
Compilation command according to given parameters
str
tex_to_svg_file
(expression, environment=None, tex_template=None)[source]¶Takes a tex expression and returns the svg version of the compiled tex
expression (str
) – String containing the TeX expression to be rendered, e.g. \sqrt{2}
or foo
environment (Optional[str
], optional) – The string containing the environment in which the expression should be typeset, e.g. align*
tex_template (Optional[TexTemplate
], optional) – Template class used to typesetting. If not set, use default template set via config[“tex_template”]
Path to generated SVG file.
str