diff options
author | Norbert Preining <norbert@preining.info> | 2021-08-21 03:03:19 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-08-21 03:03:19 +0000 |
commit | dd302372d8cdbe867c55bbea51f1f2a4842c3353 (patch) | |
tree | 1d2e75f175f970964291421b3d503e85893da5dd /support/tikztosvg | |
parent | da0e202bdd0dc2f52f28ae0d96dc96969826890b (diff) |
CTAN sync 202108210303
Diffstat (limited to 'support/tikztosvg')
-rw-r--r-- | support/tikztosvg/CHANGELOG.md | 10 | ||||
-rw-r--r-- | support/tikztosvg/Makefile | 9 | ||||
-rw-r--r-- | support/tikztosvg/README.md | 65 | ||||
-rw-r--r-- | support/tikztosvg/example/example.svg | 72 | ||||
-rw-r--r-- | support/tikztosvg/example/example.tikz | 4 | ||||
-rwxr-xr-x | support/tikztosvg/install.sh | 66 | ||||
-rw-r--r-- | support/tikztosvg/man/man.adoc | 18 | ||||
-rw-r--r-- | support/tikztosvg/man/tikztosvg.1 | 40 | ||||
-rwxr-xr-x | support/tikztosvg/tikztosvg | 59 | ||||
-rw-r--r-- | support/tikztosvg/tikztosvg.pdf | bin | 170837 -> 173448 bytes |
10 files changed, 184 insertions, 159 deletions
diff --git a/support/tikztosvg/CHANGELOG.md b/support/tikztosvg/CHANGELOG.md index 65dc1bae6e..58d445434d 100644 --- a/support/tikztosvg/CHANGELOG.md +++ b/support/tikztosvg/CHANGELOG.md @@ -1,10 +1,18 @@ # CHANGELOG +## Release 0.3.0 + +* Made the TeX engine configurable via command-line flags (see the updated + manpage) +* Made LuaTeX the default TeX engine (the previous one was XeTeX) +* Removed runtime checks for dependencies +* Removed the install shell script from the repo + ## Release 0.2.1 * Fixed #1 * Improved the installation scripts -* Added aditional links in the documentation +* Added additional links in the documentation ## Release 0.2.0 diff --git a/support/tikztosvg/Makefile b/support/tikztosvg/Makefile index 1d5779d30a..4c33b05869 100644 --- a/support/tikztosvg/Makefile +++ b/support/tikztosvg/Makefile @@ -1,14 +1,17 @@ .PHONY: package install +BIN_TARGET ?= /usr/bin/ +MAN_TARGET ?= /usr/share/man/man1/ + # Packages the application for CTAN package: tikztosvg.tar.gz install: man/tikztosvg.1 tikztosvg # Install the executable - install -g 0 -o 0 -m 755 tikztosvg /usr/bin/ + install -g 0 -o 0 -m 755 tikztosvg "$(BIN_TARGET)" # Install the manpage - install -g 0 -o 0 -m 644 man/tikztosvg.1 /usr/share/man/man1/ + install -g 0 -o 0 -m 644 man/tikztosvg.1 "$(MAN_TARGET)" man/tikztosvg.1: man/man.adoc asciidoctor -b manpage -o $@ $^ @@ -20,7 +23,7 @@ example/%.svg: example/%.tikz sh ./tikztosvg -p xfrac -p relsize -o $@ $^ # Try to compress the image with svgo - svgo --pretty --enable=sortAttrs $@ || exit 0 + svgo --pretty $@ || exit 0 # Packages the application for CTAN tikztosvg.tar.gz: tikztosvg man/tikztosvg.1 tikztosvg.pdf README.md example/example.tikz example/example.svg CHANGELOG.md LICENSE diff --git a/support/tikztosvg/README.md b/support/tikztosvg/README.md index b8710da39f..97678fddfa 100644 --- a/support/tikztosvg/README.md +++ b/support/tikztosvg/README.md @@ -1,7 +1,7 @@ # tikztosvg(1) The `tikztosvg(1)` command renders TikZ diagrams to SVG, using -[XeTeX](http://xetex.sourceforge.net/) and +[TeXLive](https://tug.org/texlive/) and [pdf2svg](https://github.com/dawbarton/pdf2svg). ## Usage @@ -14,66 +14,77 @@ If *INPUT\_PATH* is set to *-* the input will be read from stdin. ### Options -**-o, --output**=*OUTPUT\_PATH* +**-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* +**-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* +**-l, \-\-library**=+*LIBRARY* Include `\usetikzlibrary{LIBRARY}` when rendering the diagram. -**-q, --quiet** +**-q, \-\-quiet** Silence application log messages and script warnings. -**-h, --help** +**\-\-lualatex** +Use [LuaTeX](http://luatex.org/) as the TeX engine. LuaTeX is already the +default, so this option doesn't really do much. + +**\-\-xelatex** +Use [XeTeX](http://xetex.sourceforge.net/) as the TeX engine. + +**\-\-pdflatex** +Use [pdfTeX](https://www.tug.org/applications/pdftex/) as the TeX engine. + +**-h, \-\-help** Print a help message. -**-v, --version** +**-v, \-\-version** Print version information. ## Example -Let’s say you want to convert the file `example.tikz` to SVG: +Let’s say you want to convert the file `example.tikz` to SVG ``` latex \begin{tikzcd} - G \arrow[r, "\varphi"] \arrow[d, "\psi"', two heads] & H \\ - \mathlarger{\sfrac{G}{\ker \varphi}} \arrow[ru, dotted] & + G \arrow{r}{\varphi} \arrow[two heads]{d} & H \\ + \mathlarger{\sfrac{G}{\ker \varphi}} \arrow[dotted]{ru} & \end{tikzcd} ``` -You could achieve this by running: +You could achieve this by running ``` sh -# xfrac and relsize are only there so that we can -# call \sfrac and \mathlarger +$ # 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`. -## Installation +## Dependencies -The `tikztosvg(1)` command and it’s man page can be installed in Unix systems -by running - -``` sh -$ curl -s https://git.sr.ht/~pablo-pie/tikztosvg/blob/master/install.sh | sudo sh -``` +* A regular TeXLive installation: you'll need LuaTeX and optionally XeTeX and + pdfTeX +* pdf2svg -or it can be installed via Git with +## Installation +The `tikztosvg(1)` command and it’s man page can be installed in Unix systems +via Git by running ``` sh $ git clone https://git.sr.ht/~pablo-pie/tikztosvg $ cd tikztosvg $ sudo make install ``` -The executable is installed in `/usr/bin/` and the man-page is -installed in `/usr/share/man/man1/`. +The `BIN_TARGET` Make variable (defaults to `/usr/bin/`) controls the +directory the binary is installed in, while the `MAN_TARGET` Make variable +(defaults to `/usr/share/man/man1/`) controls the directory the man page +is installed in. ## Resources @@ -83,6 +94,14 @@ installed in `/usr/share/man/man1/`. **CTAN package:** <https://www.ctan.org/pkg/tikztosvg> +**TeXLive** <https://tug.org/texlive/> + +**LuaTeX** <http://luatex.org/> + +**XeTeX** <http://xetex.sourceforge.net/> + +**pdfTeX** <https://www.tug.org/applications/pdftex/> + ## Authors **tikztosvg** was written by [Pablo](mailto:pablo-escobar@riseup.net). diff --git a/support/tikztosvg/example/example.svg b/support/tikztosvg/example/example.svg index 4c258f4f36..92387322ce 100644 --- a/support/tikztosvg/example/example.svg +++ b/support/tikztosvg/example/example.svg @@ -1,48 +1,46 @@ -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="78.29pt" height="66.92" viewBox="0 0 78.29 50.19"> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="104.385" height="66.916" viewBox="0 0 78.289 50.187"> <defs> - <symbol id="a" overflow="visible"> - <path d="M7.578-6.922c0-.031-.016-.11-.11-.11-.03 0-.046.016-.155.126l-.688.765c-.094-.14-.547-.89-1.656-.89C2.734-7.031.5-4.828.5-2.516.5-.922 1.61.22 3.219.22c.437 0 .89-.094 1.25-.235.5-.203.687-.406.86-.609.093.25.359.61.452.61.047 0 .078-.032.078-.032.016-.015.11-.406.157-.61l.187-.765.14-.516c.11-.437.11-.468.688-.468.047 0 .157-.016.157-.203 0-.079-.047-.11-.125-.11-.235 0-.829.031-1.047.031-.313 0-1.094-.03-1.407-.03-.078 0-.203 0-.203.202 0 .11.078.11.297.11.016 0 .297 0 .531.015.266.032.313.063.313.188 0 .094-.11.531-.219.906C5.047-.203 3.766-.094 3.406-.094c-.953 0-2-.562-2-2.094 0-.312.094-1.953 1.14-3.25.548-.671 1.517-1.28 2.5-1.28 1.016 0 1.61.765 1.61 1.921 0 .406-.031.406-.031.516 0 .093.11.093.14.093.126 0 .126-.015.188-.203zm0 0"/> + <symbol overflow="visible" id="a"> + <path style="stroke:none" d="M7.578-6.922c0-.031-.016-.11-.11-.11-.03 0-.046.016-.155.126l-.688.765c-.094-.14-.547-.89-1.656-.89C2.734-7.031.5-4.828.5-2.516.5-.922 1.61.22 3.219.22c.437 0 .89-.094 1.25-.235.5-.203.687-.406.86-.609.093.25.359.61.452.61.047 0 .078-.032.078-.032.016-.015.11-.406.157-.61l.187-.765.14-.516c.11-.437.11-.468.688-.468.047 0 .157-.016.157-.203 0-.079-.047-.11-.125-.11-.235 0-.829.031-1.047.031-.313 0-1.094-.03-1.407-.03-.078 0-.203 0-.203.202 0 .11.078.11.297.11.016 0 .297 0 .531.015.266.032.313.063.313.188 0 .094-.11.531-.219.906C5.047-.203 3.766-.094 3.406-.094c-.953 0-2-.562-2-2.094 0-.312.094-1.953 1.14-3.25.548-.671 1.517-1.28 2.5-1.28 1.016 0 1.61.765 1.61 1.921 0 .406-.031.406-.031.516 0 .093.11.093.14.093.126 0 .126-.015.188-.203zm0 0"/> </symbol> - <symbol id="b" overflow="visible"> - <path d="M7.61-6.047c.093-.36.109-.453.827-.453.266 0 .344 0 .344-.203 0-.11-.11-.11-.14-.11-.282 0-1 .032-1.282.032-.28 0-.984-.032-1.28-.032-.079 0-.188 0-.188.204 0 .109.093.109.28.109.016 0 .204 0 .376.016.187.03.266.03.266.171 0 .032 0 .047-.032.188l-.593 2.422H3.14l.593-2.344c.079-.36.11-.453.829-.453.265 0 .343 0 .343-.203 0-.11-.11-.11-.14-.11-.282 0-1 .032-1.282.032-.28 0-.984-.032-1.28-.032-.079 0-.188 0-.188.204 0 .109.093.109.28.109.017 0 .204 0 .376.016.172.03.265.03.265.171 0 .032 0 .063-.03.188L1.561-.781c-.093.39-.109.469-.906.469-.172 0-.265 0-.265.203C.39 0 .516 0 .53 0c.281 0 .985-.031 1.266-.031.203 0 .422.015.64.015.22 0 .438.016.641.016.078 0 .203 0 .203-.203 0-.11-.094-.11-.281-.11-.375 0-.64 0-.64-.171 0-.063.015-.11.015-.172l.688-2.735h3.03c-.405 1.657-.64 2.61-.687 2.75-.093.329-.281.329-.906.329-.14 0-.234 0-.234.203 0 .109.125.109.14.109.282 0 .985-.031 1.266-.031.203 0 .422.015.64.015.22 0 .438.016.641.016.078 0 .203 0 .203-.203 0-.11-.093-.11-.281-.11-.36 0-.64 0-.64-.171 0-.063.015-.11.03-.172zm0 0"/> + <symbol overflow="visible" id="b"> + <path style="stroke:none" d="M7.61-6.047c.093-.36.109-.453.827-.453.266 0 .344 0 .344-.203 0-.11-.11-.11-.14-.11-.282 0-1 .032-1.282.032-.28 0-.984-.032-1.28-.032-.079 0-.188 0-.188.204 0 .109.093.109.28.109.016 0 .204 0 .376.016.187.03.266.03.266.171 0 .032 0 .047-.032.188l-.593 2.422H3.14l.593-2.344c.079-.36.11-.453.829-.453.265 0 .343 0 .343-.203 0-.11-.11-.11-.14-.11-.282 0-1 .032-1.282.032-.28 0-.984-.032-1.28-.032-.079 0-.188 0-.188.204 0 .109.093.109.28.109.017 0 .204 0 .376.016.172.03.265.03.265.171 0 .032 0 .063-.03.188L1.561-.781c-.093.39-.109.469-.906.469-.172 0-.265 0-.265.203C.39 0 .516 0 .53 0c.281 0 .985-.031 1.266-.031.203 0 .422.015.64.015.22 0 .438.016.641.016.078 0 .203 0 .203-.203 0-.11-.094-.11-.281-.11-.375 0-.64 0-.64-.171 0-.063.015-.11.015-.172l.688-2.735h3.03c-.405 1.657-.64 2.61-.687 2.75-.093.329-.281.329-.906.329-.14 0-.234 0-.234.203 0 .109.125.109.14.109.282 0 .985-.031 1.266-.031.203 0 .422.015.64.015.22 0 .438.016.641.016.078 0 .203 0 .203-.203 0-.11-.093-.11-.281-.11-.36 0-.64 0-.64-.171 0-.063.015-.11.03-.172zm0 0"/> </symbol> - <symbol id="d" overflow="visible"> - <path d="M4.375-7.094c.047-.14.047-.172.047-.187 0-.11-.078-.203-.188-.203-.078 0-.14.03-.171.093l-3.47 9.5c-.046.141-.046.172-.046.188 0 .11.094.203.203.203.125 0 .156-.078.219-.25zm0 0"/> + <symbol overflow="visible" id="d"> + <path style="stroke:none" d="M4.375-7.094c.047-.14.047-.172.047-.187 0-.11-.078-.203-.188-.203-.078 0-.14.03-.171.093l-3.47 9.5c-.046.141-.046.172-.046.188 0 .11.094.203.203.203.125 0 .156-.078.219-.25zm0 0"/> </symbol> - <symbol id="c" overflow="visible"> - <path d="M5.875-4.813c0-.03-.016-.093-.094-.093-.047 0-.062.015-.125.093l-.5.532c-.062-.078-.453-.625-1.312-.625-1.703 0-3.36 1.5-3.36 3.078C.484-.75 1.313.14 2.641.14c.625 0 1.265-.157 1.625-.547.078.14.265.406.343.406.063 0 .079-.031.11-.188l.14-.53c.032-.126.125-.548.157-.626.078-.312.078-.328.5-.328.046 0 .156 0 .156-.14 0-.079-.063-.11-.11-.11-.234 0-.53.031-.765.031-.172 0-.406 0-.578-.015-.172 0-.375-.016-.547-.016-.063 0-.156 0-.156.156 0 .094.078.094.25.094.125 0 .265 0 .406.016.219.015.219.047.219.125 0 .031 0 .047-.047.234-.047.188-.125.5-.157.578-.187.422-.843.61-1.39.61-.688 0-1.61-.344-1.61-1.516 0-.75.36-1.672.875-2.203.72-.703 1.454-.813 1.844-.813.813 0 1.281.579 1.281 1.36 0 .187-.015.25-.015.281 0 .094.094.094.125.094.11 0 .11-.016.14-.156zm0 0"/> + <symbol overflow="visible" id="c"> + <path style="stroke:none" d="M5.875-4.813c0-.03-.016-.093-.094-.093-.047 0-.062.015-.125.093l-.5.532c-.062-.078-.453-.625-1.312-.625-1.703 0-3.36 1.5-3.36 3.078C.484-.75 1.313.14 2.641.14c.625 0 1.265-.157 1.625-.547.078.14.265.406.343.406.063 0 .079-.031.11-.188l.14-.53c.032-.126.125-.548.157-.626.078-.312.078-.328.5-.328.046 0 .156 0 .156-.14 0-.079-.063-.11-.11-.11-.234 0-.53.031-.765.031-.172 0-.406 0-.578-.015-.172 0-.375-.016-.547-.016-.063 0-.156 0-.156.156 0 .094.078.094.25.094.125 0 .265 0 .406.016.219.015.219.047.219.125 0 .031 0 .047-.047.234-.047.188-.125.5-.157.578-.187.422-.843.61-1.39.61-.688 0-1.61-.344-1.61-1.516 0-.75.36-1.672.875-2.203.72-.703 1.454-.813 1.844-.813.813 0 1.281.579 1.281 1.36 0 .187-.015.25-.015.281 0 .094.094.094.125.094.11 0 .11-.016.14-.156zm0 0"/> </symbol> - <symbol id="h" overflow="visible"> - <path d="M2.203.063h.235c1.25 0 2.406-1.016 2.406-2.126 0-.609-.375-1.015-.907-1.015-.968 0-1.484 1.234-1.671 1.75-.094.266-.25.75-.282.875C1.22-.547.72-.906.72-1.422c0 0 .047-.781.61-1.406.046-.047.062-.063.062-.094C1.39-3 1.297-3 1.28-3c-.062 0-.093 0-.234.156-.39.469-.563 1.203-.563 1.5C.484-.719.938-.187 1.828 0c-.344 1.094-.39 1.219-.39 1.281 0 .188.171.219.234.219.078 0 .219-.047.281-.14.047-.11.11-.47.25-1.298zm.094-.47c.14-.812.187-1.124.531-1.577.313-.422.672-.61 1.031-.61.47 0 .735.313.735.672 0 .703-.875 1.516-2.078 1.516h-.22zm0 0"/> + <symbol overflow="visible" id="h"> + <path style="stroke:none" d="M2.203.063h.235c1.25 0 2.406-1.016 2.406-2.126 0-.609-.375-1.015-.907-1.015-.968 0-1.484 1.234-1.671 1.75-.094.266-.25.75-.282.875C1.22-.547.72-.906.72-1.422c0 0 .047-.781.61-1.406.046-.047.062-.063.062-.094C1.39-3 1.297-3 1.28-3c-.062 0-.093 0-.234.156-.39.469-.563 1.203-.563 1.5C.484-.719.938-.187 1.828 0c-.344 1.094-.39 1.219-.39 1.281 0 .188.171.219.234.219.078 0 .219-.047.281-.14.047-.11.11-.47.25-1.298zm.094-.47c.14-.812.187-1.124.531-1.577.313-.422.672-.61 1.031-.61.47 0 .735.313.735.672 0 .703-.875 1.516-2.078 1.516h-.22zm0 0"/> </symbol> - <symbol id="i" overflow="visible"> - <path d="M3.797-4.64c.015-.079.015-.11.015-.11 0-.094-.093-.094-.109-.094-.11 0-.11.032-.14.157L2.421-.141c-.563-.062-.875-.312-.875-.78 0-.11 0-.298.344-1.157.062-.156.109-.281.109-.39 0-.376-.313-.61-.656-.61C.64-3.078.328-2.125.328-2c0 .078.094.078.125.078.094 0 .094-.031.125-.11.156-.562.469-.843.735-.843.125 0 .171.078.171.234 0 .172-.046.297-.125.516-.343.875-.343 1.031-.343 1.156 0 .797.843 1 1.359 1.031a47.669 47.669 0 00-.313 1.266c0 .094.079.094.11.094.094 0 .11-.031.14-.14L2.61.061c.282 0 .922 0 1.657-.718a2.42 2.42 0 00.5-.75C4.859-1.641 5-2.203 5-2.531c0-.547-.328-.547-.344-.547a.403.403 0 00-.375.375c0 .11.063.172.094.187.11.094.281.266.281.579 0 .578-.797 1.812-2 1.812zm0 0"/> + <symbol overflow="visible" id="e"> + <path style="stroke:none" d="M2.25-1.89c.86-.657 1.094-.844 1.563-.86V-3c-.141.016-.329.031-.47.031-.28 0-.562-.015-.827-.031v.25c.078.016.125.063.125.125 0 .11-.141.234-.22.297l-1.03.797v-3.313l-1.047.078v.25c.469 0 .515.063.515.391v3.578C.86-.25.797-.25.344-.25V0c.25-.016.515-.031.765-.031.266 0 .516.015.782.031v-.25c-.454 0-.532 0-.532-.297v-.672l.516-.39.75.953c.078.078.156.187.156.281 0 .11-.125.125-.187.125V0c.094 0 .578-.031.781-.031.203 0 .406.015.61.031v-.25c-.25 0-.407-.016-.61-.266zm0 0"/> </symbol> - <symbol id="e" overflow="visible"> - <path d="M2.25-1.89c.86-.657 1.094-.844 1.563-.86V-3c-.141.016-.329.031-.47.031-.28 0-.562-.015-.827-.031v.25c.078.016.125.063.125.125 0 .11-.141.234-.22.297l-1.03.797v-3.313l-1.047.078v.25c.469 0 .515.063.515.391v3.578C.86-.25.797-.25.344-.25V0c.25-.016.515-.031.765-.031.266 0 .516.015.782.031v-.25c-.454 0-.532 0-.532-.297v-.672l.516-.39.75.953c.078.078.156.187.156.281 0 .11-.125.125-.187.125V0c.094 0 .578-.031.781-.031.203 0 .406.015.61.031v-.25c-.25 0-.407-.016-.61-.266zm0 0"/> + <symbol overflow="visible" id="f"> + <path style="stroke:none" d="M3.063-1.594c.156 0 .203 0 .203-.14 0-.625-.344-1.375-1.391-1.375a1.59 1.59 0 0 0-1.61 1.578c0 .89.782 1.593 1.704 1.593.937 0 1.297-.75 1.297-.906 0-.015-.016-.094-.125-.094-.094 0-.11.047-.125.11-.22.562-.75.672-1 .672-.329 0-.641-.14-.844-.406-.266-.329-.266-.75-.266-1.032zM.905-1.766c.078-.984.703-1.14.969-1.14.86 0 .89.969.906 1.14zm0 0"/> </symbol> - <symbol id="f" overflow="visible"> - <path d="M3.063-1.594c.156 0 .203 0 .203-.14 0-.625-.344-1.375-1.391-1.375a1.59 1.59 0 00-1.61 1.578c0 .89.782 1.593 1.704 1.593.937 0 1.297-.75 1.297-.906 0-.015-.016-.094-.125-.094-.094 0-.11.047-.125.11-.22.562-.75.672-1 .672-.329 0-.641-.14-.844-.406-.266-.329-.266-.75-.266-1.032zM.905-1.766c.078-.984.703-1.14.969-1.14.86 0 .89.969.906 1.14zm0 0"/> - </symbol> - <symbol id="g" overflow="visible"> - <path d="M1.39-1.594c0-.578.266-1.281.938-1.281a.325.325 0 00-.125.25c0 .234.188.313.313.313.171 0 .328-.11.328-.313 0-.234-.235-.453-.563-.453-.344 0-.734.219-.937.75v-.75L.344-3v.25c.469 0 .515.047.515.39v1.813C.86-.25.797-.25.344-.25V0c.031 0 .5-.031.797-.031.296 0 .593.015.906.031v-.25h-.14c-.516 0-.516-.078-.516-.313zm0 0"/> + <symbol overflow="visible" id="g"> + <path style="stroke:none" d="M1.39-1.594c0-.578.266-1.281.938-1.281a.325.325 0 0 0-.125.25c0 .234.188.313.313.313.171 0 .328-.11.328-.313 0-.234-.235-.453-.563-.453-.344 0-.734.219-.937.75v-.75L.344-3v.25c.469 0 .515.047.515.39v1.813C.86-.25.797-.25.344-.25V0c.031 0 .5-.031.797-.031.296 0 .593.015.906.031v-.25h-.14c-.516 0-.516-.078-.516-.313zm0 0"/> </symbol> </defs> - <use x="14.432" y="11.346" xlink:href="#a"/> - <use x="64.904" y="11.346" xlink:href="#b"/> - <use x="4.293" y="41.808" xlink:href="#c"/> - <use x="9.942" y="44.05" xlink:href="#d"/> - <use x="15.177" y="44.05" xlink:href="#e"/> - <use x="19.153" y="44.05" xlink:href="#f"/> - <use x="22.695" y="44.05" xlink:href="#g"/> - <use x="27.165" y="44.05" xlink:href="#h"/> - <path fill="none" stroke="#000" stroke-miterlimit="10" stroke-width=".398" d="M26.758 8.855h33.254"/> - <path fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width=".398" d="M58.14 6.465c.38 1.433 1.223 2.11 2.07 2.39-.847.278-1.69.957-2.07 2.391"/> - <use x="40.965" y="5.152" xlink:href="#h"/> - <path fill="none" stroke="#000" stroke-miterlimit="10" stroke-width=".398" d="M18.348 15.195v17.137"/> - <path fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width=".398" d="M20.738 29.023c-1.433.38-2.11 1.223-2.39 2.07-.278-.847-.953-1.69-2.391-2.07"/> - <path fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width=".398" d="M20.738 30.457c-1.433.379-2.11 1.223-2.39 2.074-.278-.851-.953-1.695-2.391-2.074"/> - <use x="10.481" y="25.705" xlink:href="#i"/> - <path fill="none" stroke="#000" stroke-dasharray=".39848,1.99255" stroke-miterlimit="10" stroke-width=".398" d="M32.145 32.73l27.93-17.878"/> - <path fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width=".39801990000000004" d="M57.207 13.848c1.094 1.004 2.168 1.117 3.035.894-.566.695-.91 1.719-.457 3.133"/> + <use xlink:href="#a" x="14.433" y="11.342" style="fill:#000;fill-opacity:1"/> + <use xlink:href="#b" x="64.904" y="11.342" style="fill:#000;fill-opacity:1"/> + <use xlink:href="#c" x="4.294" y="41.805" style="fill:#000;fill-opacity:1"/> + <use xlink:href="#d" x="9.943" y="44.046" style="fill:#000;fill-opacity:1"/> + <use xlink:href="#e" x="15.178" y="44.046" style="fill:#000;fill-opacity:1"/> + <g style="fill:#000;fill-opacity:1"> + <use xlink:href="#f" x="19.154" y="44.046"/> + <use xlink:href="#g" x="22.697" y="44.046"/> + </g> + <use xlink:href="#h" x="27.166" y="44.046" style="fill:#000;fill-opacity:1"/> + <path style="fill:none;stroke-width:.39848;stroke-linecap:butt;stroke-linejoin:miter;stroke:#000;stroke-opacity:1;stroke-miterlimit:10" d="M-12.386 16.684h33.254" transform="matrix(1 0 0 -1 39.144 25.536)"/> + <path style="fill:none;stroke-width:.39848;stroke-linecap:round;stroke-linejoin:round;stroke:#000;stroke-opacity:1;stroke-miterlimit:10" d="M-2.07 2.39C-1.693.958-.849.278 0 0c-.848-.277-1.692-.957-2.07-2.39" transform="matrix(1 0 0 -1 60.211 8.851)"/> + <use xlink:href="#h" x="40.965" y="5.149" style="fill:#000;fill-opacity:1"/> + <path style="fill:none;stroke-width:.39848;stroke-linecap:butt;stroke-linejoin:miter;stroke:#000;stroke-opacity:1;stroke-miterlimit:10" d="M-20.796 10.345V-6.792" transform="matrix(1 0 0 -1 39.144 25.536)"/> + <path style="fill:none;stroke-width:.39848;stroke-linecap:round;stroke-linejoin:round;stroke:#000;stroke-opacity:1;stroke-miterlimit:10" d="M-2.072 2.389C-1.694.955-.85.279.002-.001-.85-.28-1.694-.956-2.072-2.393" transform="matrix(0 1 1 0 18.35 31.092)"/> + <path style="fill:none;stroke-width:.39848;stroke-linecap:round;stroke-linejoin:round;stroke:#000;stroke-opacity:1;stroke-miterlimit:10" d="M-2.073 2.389C-1.695.955-.851.279 0-.001-.851-.28-1.695-.956-2.073-2.393" transform="matrix(0 1 1 0 18.35 32.527)"/> + <path style="fill:none;stroke-width:.39848;stroke-linecap:butt;stroke-linejoin:miter;stroke:#000;stroke-opacity:1;stroke-dasharray:.39848,1.99255;stroke-miterlimit:10" d="m-7-7.19 27.93 17.878" transform="matrix(1 0 0 -1 39.144 25.536)"/> + <path style="fill:none;stroke-width:.39848;stroke-linecap:round;stroke-linejoin:round;stroke:#000;stroke-opacity:1;stroke-miterlimit:10" d="M-2.074 2.392C-1.694.957-.852.279 0-.001c-.85-.277-1.692-.954-2.072-2.39" transform="scale(.99994 -.99994) rotate(32.622 55.311 95.57)"/> </svg> diff --git a/support/tikztosvg/example/example.tikz b/support/tikztosvg/example/example.tikz index 416d667e54..563ae63d89 100644 --- a/support/tikztosvg/example/example.tikz +++ b/support/tikztosvg/example/example.tikz @@ -1,4 +1,4 @@ \begin{tikzcd} - G \arrow[r, "\varphi"] \arrow[d, "\psi"', two heads] & H \\ - \mathlarger{\sfrac{G}{\ker \varphi}} \arrow[ru, dotted] & + G \arrow{r}{\varphi} \arrow[two heads]{d} & H \\ + \mathlarger{\sfrac{G}{\ker \varphi}} \arrow[dotted]{ru} & \end{tikzcd} diff --git a/support/tikztosvg/install.sh b/support/tikztosvg/install.sh deleted file mode 100755 index 1d6a22957b..0000000000 --- a/support/tikztosvg/install.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# -# 2021 (C) Pablo -# Free use of this software is granted under the terms of the GPL-3.0 License - -puts () -{ - printf "\033[1m\033[38;5;%sm[%s]\033[m %s\n\n" "$3" "$1" "$2" -} - -error () -{ - puts ERROR "$1" 9 - exit 1 -} - -dependencyWarning () -{ - puts WARNING "$(printf "The command '%s' could not be found.\nPlease make sure it is included in the \$PATH enviroment variable or follow the installation instructions on %s." "$1" "$2")" 3 -} - -message () -{ - puts INSTALLER "$1" 2 -} - -if [ "$(id -u)" -ne "0" ] -then - error "This script requires administrator-privileges" -fi - -if ! [ -x "$(command -v xelatex)" ] -then - dependencyWarning "xelatex" "https://tug.org/texlive/" -fi - -if ! [ -x "$(command -v pdf2svg)" ] -then - dependencyWarning "pdf2svg" "https://github.com/dawbarton/pdf2svg" -fi - -message "Installing tikztosvg(1)" - -if [ -f "$HOME/.local/bin/tikztosvg" ] -then - rm "$HOME/.local/bin/tikztosvg" -fi - -tmp="$(mktemp -d)" -wget https://git.sr.ht/~pablo-pie/tikztosvg/blob/master/tikztosvg -P "$tmp" \ - && install -g 0 -o 0 -m 755 "$tmp/tikztosvg" /usr/bin/ \ - || exit 1 - -message "Installing manual entry for tikztosvg(1)" -wget https://git.sr.ht/~pablo-pie/tikztosvg/blob/master/man/tikztosvg.1 -P "$tmp" \ - && install -g 0 -o 0 -m 644 "$tmp/tikztosvg.1" /usr/share/man/man1/ \ - || exit 1 - -if [ -f "/usr/share/man/man1/tikztosvg.1.gz" ] -then - rm "/usr/share/man/man1/tikztosvg.1.gz" -fi - -gzip "/usr/share/man/man1/tikztosvg.1" -rm "$tmp" -r - diff --git a/support/tikztosvg/man/man.adoc b/support/tikztosvg/man/man.adoc index ad5d8cca2a..fa4f829267 100644 --- a/support/tikztosvg/man/man.adoc +++ b/support/tikztosvg/man/man.adoc @@ -1,7 +1,7 @@ = tikztosvg(1) :doctype: manpage :man-manual: tikztosvg Manual -:man-source: tikztosvg 0.2.1 +:man-source: tikztosvg 0.3.0 :page-layout: base == NAME @@ -36,6 +36,16 @@ If _INPUT_PATH_ is set to _-_ the input will be read from stdin. *-q, --quiet*:: Silence application log messages and script warnings. +*--lualatex*:: + Use LuaTeX as the TeX engine. LuaTeX is already the + default, so this option doesn't really do much. + +*--xelatex*:: + Use XeTeX as the TeX engine. + +*--pdflatex*:: + Use pdfTeX as the TeX engine. + *-h, --help*:: Print a help message. @@ -70,6 +80,12 @@ Matthew Flaschen <matthew.flaschen@gatech.edu>. Git source repository on sourcehut:: https://git.sr.ht/~pablo-pie/tikztosvg Bug tracker:: https://todo.sr.ht/~pablo-pie/tikztosvg CTAN package:: https://www.ctan.org/pkg/tikztosvg +TeXLive:: https://tug.org/texlive/ +LuaTeX:: http://luatex.org/ +XeTeX:: http://xetex.sourceforge.net/ + +**pdfTeX** <https://www.tug.org/applications/pdftex/> + == COPYING diff --git a/support/tikztosvg/man/tikztosvg.1 b/support/tikztosvg/man/tikztosvg.1 index 37b1840770..d4d08a8585 100644 --- a/support/tikztosvg/man/tikztosvg.1 +++ b/support/tikztosvg/man/tikztosvg.1 @@ -1,13 +1,13 @@ '\" t .\" Title: tikztosvg .\" Author: [see the "AUTHOR(S)" section] -.\" Generator: Asciidoctor 2.0.15 -.\" Date: 2021-07-29 +.\" Generator: Asciidoctor 2.0.16 +.\" Date: 2021-08-19 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "TIKZTOSVG" "1" "2021-07-29" "\ \&" "\ \&" +.TH "TIKZTOSVG" "1" "2021-08-19" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -63,6 +63,22 @@ Include \fI\(rsusetikzlibrary{LIBRARY}\fP when rendering the diagram. Silence application log messages and script warnings. .RE .sp +\fB\-\-lualatex\fP +.RS 4 +Use LuaTeX as the TeX engine. LuaTeX is already the +default, so this option doesn\(cqt really do much. +.RE +.sp +\fB\-\-xelatex\fP +.RS 4 +Use XeTeX as the TeX engine. +.RE +.sp +\fB\-\-pdflatex\fP +.RS 4 +Use pdfTeX as the TeX engine. +.RE +.sp \fB\-h, \-\-help\fP .RS 4 Print a help message. @@ -118,6 +134,24 @@ CTAN package .RS 4 .URL "https://www.ctan.org/pkg/tikztosvg" "" "" .RE +.sp +TeXLive +.RS 4 +.URL "https://tug.org/texlive/" "" "" +.RE +.sp +LuaTeX +.RS 4 +.URL "http://luatex.org/" "" "" +.RE +.sp +XeTeX +.RS 4 +.URL "http://xetex.sourceforge.net/" "" "" +.RE +.sp +\fBpdfTeX\fP \c +.URL "https://www.tug.org/applications/pdftex/" "" "" .SH "COPYING" .sp Copyright (C) 2021 Pablo. diff --git a/support/tikztosvg/tikztosvg b/support/tikztosvg/tikztosvg index d1b1f8bb29..96d1af6ca9 100755 --- a/support/tikztosvg/tikztosvg +++ b/support/tikztosvg/tikztosvg @@ -38,7 +38,7 @@ showHelp() showVersion() { - echo 0.2.1 + echo 0.3.0 exit 0 } @@ -46,15 +46,8 @@ showVersion() packages="tikz tikz-cd pgfplots amsmath amssymb" libraries="" -if ! [ -x "$(command -v xelatex)" ] -then - error "xelatex could not be found" -fi - -if ! [ -x "$(command -v pdf2svg)" ] -then - error "pdf2svg could not be found" -fi +# The default TeX engine +texengine='lualatex' # Parsing the arguments while [ $# -gt 1 ] @@ -113,6 +106,27 @@ do quiet=1 shift ;; + --lualatex) + shift + ;; + --xelatex) + if command -v xelatex > /dev/null + then + texengine='xelatex' + else + error "Couldn't find xelatex: required by the --xelatex option" + fi + shift + ;; + --pdflatex) + if command -v pdflatex > /dev/null + then + texengine='pdflatex' + else + error "Couldn't find pdflatex: required by the --pdflatex option" + fi + shift + ;; *) error "Unexpected token: \"$1\"" ;; @@ -126,10 +140,10 @@ case "$1" in -v|--version) showVersion ;; - "") + '') error "No input path provided" ;; - "-") + -) input=/dev/stdin ;; *) @@ -145,11 +159,8 @@ case "$output" in ;; # If no output path is provided, use the basename of the input - "") - if [ -x "$(command -v dirname)" ] - then - output="$(dirname "$input")/$(basename "$input" | cut -d "." -f1).svg" - fi + '') + output="$(dirname "$input")/$(basename "$input" | cut -d "." -f1).svg" ;; # If the output path is provided, but it resolves to directory, output a @@ -163,14 +174,14 @@ tmp_dir="$(mktemp -d)" tex_file="$tmp_dir/tmp.tex" # Generate the LaTeX document -printf "\documentclass[crop,tikz,multi=false]{standalone}\n" > "$tex_file" +printf '\\documentclass[crop,tikz,multi=false]{standalone}\n' > "$tex_file" -for package in $(echo "$packages" | tr " " "\n" | sort | uniq) +for package in $packages do printf '\\usepackage{%s}\n' "$package" >> "$tex_file" done -for library in $(echo "$libraries" | tr " " "\n" | sort | uniq) +for library in $libraries do printf '\\usetikzlibrary{%s}\n' "$library" >> "$tex_file" done @@ -189,18 +200,19 @@ printf "\\\end{document}\n" >> "$tex_file" if [ -z "$quiet" ] then message "Rendering the LaTeX document. . ." - xelatex -halt-on-error -output-directory="$tmp_dir" "$tex_file" + $texengine -halt-on-error -output-directory="$tmp_dir" "$tex_file" else - xelatex -halt-on-error -output-directory="$tmp_dir" "$tex_file" 1> /dev/null 2>&1 + $texengine -halt-on-error -output-directory="$tmp_dir" "$tex_file" 1> /dev/null 2>&1 fi +# TODO: Make this less horrible? S=$? if [ $S -ne 0 ] then rm "$tmp_dir" -r if [ -z "$quiet" ] then - error "xelatex exited with code $S" $S + error "$texengine exited with code $S" $S else exit $S fi @@ -213,6 +225,7 @@ fi pdf2svg "$tmp_dir/tmp.pdf" "$output" 1 +# TODO: Make this less horrible? S=$? if [ $S -ne 0 ] then diff --git a/support/tikztosvg/tikztosvg.pdf b/support/tikztosvg/tikztosvg.pdf Binary files differindex 3fb78c6fb4..18b291edee 100644 --- a/support/tikztosvg/tikztosvg.pdf +++ b/support/tikztosvg/tikztosvg.pdf |