A Python package for including SVG graphics in LaTeX via Inkscape. The package includes a script that converts:
-
SVG to PDF and LaTeX text, with the text overlaid in LaTeX over the graphics as PDF. The package first separates text from graphics, and then uses Inkscape to convert the SVG graphics to a PDF. The text is stored in a LaTeX file with extension
.pdf_tex
. -
SVG to PDF, with the text included in the PDF. The package uses Inkscape to convert the entire SVG to a PDF.
SVGLaTeX converts the SVG only if the PDF file is older than the SVG source.
-
Inkscape: needs to be installed and the executable
inkscape
in the environment variable$PATH
.On Linux you can install
inkscape
using the operating system's package manager, for exampleapt install inkscape
on Debian.On macOS you can create a symbolic link to
inkscape
andinkscape-bin
as follows:ln -s $HOME/Applications/Inkscape.app/Contents/Resources/bin/inkscape $HOME/bin/inkscape ln -s $HOME/Applications/Inkscape.app/Contents/Resources/bin/inkscape-bin $HOME/bin/inkscape-bin
This assumes that the file
Inkscape.app
is installed in the directory/$HOME/Applications/
. The environment variable$HOME
is described here.
From the Python Package Index (PyPI) using the
package installer pip
:
pip install svglatex
The Python package installs a script named svglatex
as entry point.
This script can be invoked from the command line, for example:
svglatex -h
For including SVG files in a LaTeX document, install the Python package svglatex
and the LaTeX style svglatex.sty
,
which includes the LaTeX commands \includesvg
and \includesvgpdf
.
The style file svglatex.sty
can be:
-
placed in the directory
$HOME/texmf/tex/latex/local/
, and then invokingtexhash $HOME/texmf
registers the style with LaTeX. You can find the appropriate location withkpsewhich -var-value=TEXMFHOME
, as discussed here. To confirm the LaTeX package installation invokekpsewhich svglatex.sty
Alternatively, -
placed in the LaTeX document directory, or
-
the contents of
svglatex.sty
can be copied to the LaTeX document's preamble.
For convenience, the file svglatex.sty
is in the directory tests/
.
Examples of usage are in the test files tests/*.tex
.
See svglatex.sty
for documentation, in particular it needs calling LaTeX
with --shell-escape
.
See the file tests/README.md
.
BSD-3, see file LICENSE
.