| 1 |
# tikztosvg(1) |
| 2 |
|
| 3 |
The `tikztosvg(1)` command renders TikZ diagrams to SVG, using |
| 4 |
[TeXLive](https://tug.org/texlive/) and |
| 5 |
[pdf2svg](https://github.com/dawbarton/pdf2svg). |
| 6 |
|
| 7 |
## Usage |
| 8 |
|
| 9 |
``` sh |
| 10 |
$ tikztosvg [OPTION]... INPUT_PATH |
| 11 |
``` |
| 12 |
|
| 13 |
If *INPUT\_PATH* is set to *-* the input will be read from stdin. |
| 14 |
|
| 15 |
### Options |
| 16 |
|
| 17 |
**-o, \-\-output**=*OUTPUT\_PATH* |
| 18 |
Write output to file *OUTPUT\_PATH*. If set to *-* the output will be written |
| 19 |
to stdout. Defaults to the base name of the input file suffixed with the *.svg* |
| 20 |
extension. The file is resolved relative to the working directory. |
| 21 |
|
| 22 |
**-p, \-\-package**=+*PACKAGE* |
| 23 |
Include `\usepackage{PACKAGE}` when rendering the diagram. The tikz, tikz-cd, |
| 24 |
pgfplots, amsmath and amssymb packages are always included by default. |
| 25 |
|
| 26 |
**-l, \-\-library**=+*LIBRARY* |
| 27 |
Include `\usetikzlibrary{LIBRARY}` when rendering the diagram. |
| 28 |
|
| 29 |
**-q, \-\-quiet** |
| 30 |
Silence application log messages and script warnings. |
| 31 |
|
| 32 |
**\-\-lualatex** |
| 33 |
Use [LuaTeX](http://luatex.org/) as the TeX engine. LuaTeX is already the |
| 34 |
default, so this option doesn't really do much. |
| 35 |
|
| 36 |
**\-\-xelatex** |
| 37 |
Use [XeTeX](http://xetex.sourceforge.net/) as the TeX engine. |
| 38 |
|
| 39 |
**\-\-pdflatex** |
| 40 |
Use [pdfTeX](https://www.tug.org/applications/pdftex/) as the TeX engine. |
| 41 |
|
| 42 |
**-h, \-\-help** |
| 43 |
Print a help message. |
| 44 |
|
| 45 |
**-v, \-\-version** |
| 46 |
Print version information. |
| 47 |
|
| 48 |
## Example |
| 49 |
|
| 50 |
Let’s say you want to convert the file `example.tikz` to SVG |
| 51 |
|
| 52 |
``` latex |
| 53 |
\begin{tikzcd} |
| 54 |
G \arrow{r}{\varphi} \arrow[two heads]{d} & H \\ |
| 55 |
\mathlarger{\sfrac{G}{\ker \varphi}} \arrow[dotted]{ru} & |
| 56 |
\end{tikzcd} |
| 57 |
``` |
| 58 |
|
| 59 |
You could achieve this by running |
| 60 |
``` sh |
| 61 |
$ # xfrac and relsize are only there so that we can |
| 62 |
$ # call \sfrac and \mathlarger |
| 63 |
$ tikztosvg -p xfrac -p relsize example.tikz |
| 64 |
``` |
| 65 |
|
| 66 |
The results will be stored in the file `example.svg`. |
| 67 |
|
| 68 |
## Dependencies |
| 69 |
|
| 70 |
* A regular TeXLive installation: you'll need LuaTeX and optionally XeTeX and |
| 71 |
pdfTeX |
| 72 |
* pdf2svg |
| 73 |
|
| 74 |
## Installation |
| 75 |
|
| 76 |
The `tikztosvg(1)` command and it’s man page can be installed in Unix systems |
| 77 |
via Git by running |
| 78 |
``` sh |
| 79 |
$ git clone https://git.sr.ht/~pablo-pie/tikztosvg |
| 80 |
$ cd tikztosvg |
| 81 |
$ sudo make install |
| 82 |
``` |
| 83 |
|
| 84 |
The `BIN_TARGET` Make variable (defaults to `/usr/bin/`) controls the |
| 85 |
directory the binary is installed in, while the `MAN_TARGET` Make variable |
| 86 |
(defaults to `/usr/share/man/man1/`) controls the directory the man page |
| 87 |
is installed in. |
| 88 |
|
| 89 |
## Resources |
| 90 |
|
| 91 |
**Git source repository on sourcehut:** <https://git.sr.ht/~pablo-pie/tikztosvg> |
| 92 |
|
| 93 |
**Bug tracker:** <https://todo.sr.ht/~pablo-pie/tikztosvg> |
| 94 |
|
| 95 |
**CTAN package:** <https://www.ctan.org/pkg/tikztosvg> |
| 96 |
|
| 97 |
**TeXLive** <https://tug.org/texlive/> |
| 98 |
|
| 99 |
**LuaTeX** <http://luatex.org/> |
| 100 |
|
| 101 |
**XeTeX** <http://xetex.sourceforge.net/> |
| 102 |
|
| 103 |
**pdfTeX** <https://www.tug.org/applications/pdftex/> |
| 104 |
|
| 105 |
## Authors |
| 106 |
|
| 107 |
**tikztosvg** was written by [Pablo](mailto:[email protected]). |
| 108 |
|
| 109 |
**pdf2svg** was written by [David Barton](mailto:[email protected]) |
| 110 |
and [Matthew Flaschen](mailto:[email protected]). |
| 111 |
|
| 112 |
## License |
| 113 |
|
| 114 |
© 2021 Pablo. |
| 115 |
|
| 116 |
Free use of this software is granted under the terms of the GPL-3.0 License. |