Render TikZ diagrams to SVG 🔷️
Replaced uppercase variable names for lowercase variable names
Minor changes to the Makefile
Refactored stuff according to ShellCheck's recommendations


browse  log 



You can also use your local clone with git send-email.


The tikztosvg(1) command renders TikZ diagrams to SVG, using XeTeX and pdf2svg.


$ tikztosvg [OPTION]... INPUT_PATH

If INPUT_PATH is set to - the input will be read from stdin.


-o, --output=OUTPUT_PATH Write output to file OUTPUT_PATH. If set to - the output will be written to stdout. Defaults to the base name of the input file suffixed with the .svg extension. The file is resolved relative to the working directory.

-p, --package=+PACKAGE Include \usepackage{PACKAGE} when rendering the diagram. The tikz, tikz-cd, pgfplots, amsmath and amssymb packages are always included by default.

-l, --library=+LIBRARY Include \usetikzlibrary{LIBRARY} when rendering the diagram.

-q, --quiet Silence application log messages and script warnings.

-h, --help Print a help message.

-v, --version Print version information.


Let’s say you want to convert the file example.tikz to SVG:

     G \arrow[r, "\varphi"] \arrow[d, "\psi"', two heads] & H \\
  \mathlarger{\sfrac{G}{\ker \varphi}} \arrow[ru, dotted] &

You could achieve this by running:

# xfrac and relsize are only there so that we can 
# call \sfrac and \mathlarger
$ tikztosvg -p xfrac -p relsize example.tikz

The results will be stored in the file example.svg.


The tikztosvg(1) command and it’s man page can be installed in Unix systems by running

$ curl -s https://git.sr.ht/~pablo-pie/tikztosvg/blob/master/install.sh | sudo sh

or it can be installed via Git with

$ git clone https://git.sr.ht/~pablo-pie/tikztosvg
$ cd tikztosvg
$ sudo make install

The executable is installed in $HOME/.local/bin/ and the man-page is installed in $HOME/.local/share/man/man1/.


tikztosvg was written by Pablo.

pdf2svg was written by David Barton and Matthew Flaschen.


© 2021 Pablo.

Free use of this software is granted under the terms of the GPL-3.0 License.