MVA SVG library
The SVG library streamlines the creation of SVG files from LaTeX input. This library simplifies the process of converting LaTeX equations into SVGs, enabling users to visualize mathematical concepts effortlessly.
LaTeX to SVG process
Using SVGCreator::svgFromLaTeX(const QString& latex) starts the process to create a SVG image from a LaTeX file. First a latex process is started using the following command line arguments:
latex -output-format=dvi -interaction=batchmode path/to/latex.tex
-output-format=dvispecifies that the latex process outputs a dvi file.-interaction=batchmodethis ensures that the LaTeX compilation process proceeds in batch mode, without requiring any user interaction.path/to/latex.texAbsolute file path to latex filelatex.tex(or a different file name) on the file system.
Then the latex process was successful dvisvgm is used to create a svg file from the previously created dvi file, which has the same base name and is in the same place as the previously used LaTeX file: path/to/latex.dvi:
dvisvgm path/to/latex.dvi -n -o path/to/latex.svg
path/to/latex.dviAbsolute file path to dvi filelatex.dvi(or a different file name) on the file system.-nGlyphs are drawn by using path elements, adjacent text elements are not merged and no CSS styles are used to reference fonts-o path/to/latex.svgSpecifies the output filelatex.svg
Then the dvisvgm process was successful the SVGCreator::svgCreated(const QFileInfo& svg_file) signal is emitted where svg_file contains the information about the created SVG file.