From fc22ce7f91d4d012f14d0eefe422e8dbd54c5eb0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 20 Aug 2021 22:52:20 +0000 Subject: tikztosvg (21aug21) git-svn-id: svn://tug.org/texlive/trunk@60289 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/man/man1/tikztosvg.1 | 40 +++++++++++- Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf | Bin 26192 -> 27159 bytes .../texmf-dist/doc/support/tikztosvg/CHANGELOG.md | 10 ++- Master/texmf-dist/doc/support/tikztosvg/Makefile | 9 ++- Master/texmf-dist/doc/support/tikztosvg/README.md | 65 ++++++++++++------- .../texmf-dist/doc/support/tikztosvg/example.svg | 72 ++++++++++----------- .../texmf-dist/doc/support/tikztosvg/example.tikz | 4 +- Master/texmf-dist/doc/support/tikztosvg/install.sh | 66 ------------------- Master/texmf-dist/doc/support/tikztosvg/man.adoc | 18 +++++- .../texmf-dist/doc/support/tikztosvg/tikztosvg.pdf | Bin 170837 -> 173448 bytes Master/texmf-dist/scripts/tikztosvg/tikztosvg | 59 ++++++++++------- 11 files changed, 184 insertions(+), 159 deletions(-) delete mode 100644 Master/texmf-dist/doc/support/tikztosvg/install.sh (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/man/man1/tikztosvg.1 b/Master/texmf-dist/doc/man/man1/tikztosvg.1 index 37b1840770c..d4d08a8585f 100644 --- a/Master/texmf-dist/doc/man/man1/tikztosvg.1 +++ b/Master/texmf-dist/doc/man/man1/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/Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf b/Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf index ceb75959127..890e26d9362 100644 Binary files a/Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf and b/Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf differ diff --git a/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.md b/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.md index 65dc1bae6e9..58d445434d0 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.md +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/tikztosvg/Makefile b/Master/texmf-dist/doc/support/tikztosvg/Makefile index 1d5779d30ae..4c33b05869c 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/Makefile +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/tikztosvg/README.md b/Master/texmf-dist/doc/support/tikztosvg/README.md index b8710da39f5..97678fddfa5 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/README.md +++ b/Master/texmf-dist/doc/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:** +**TeXLive** + +**LuaTeX** + +**XeTeX** + +**pdfTeX** + ## Authors **tikztosvg** was written by [Pablo](mailto:pablo-escobar@riseup.net). diff --git a/Master/texmf-dist/doc/support/tikztosvg/example.svg b/Master/texmf-dist/doc/support/tikztosvg/example.svg index 4c258f4f367..92387322ceb 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/example.svg +++ b/Master/texmf-dist/doc/support/tikztosvg/example.svg @@ -1,48 +1,46 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/Master/texmf-dist/doc/support/tikztosvg/example.tikz b/Master/texmf-dist/doc/support/tikztosvg/example.tikz index 416d667e54c..563ae63d89d 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/example.tikz +++ b/Master/texmf-dist/doc/support/tikztosvg/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/Master/texmf-dist/doc/support/tikztosvg/install.sh b/Master/texmf-dist/doc/support/tikztosvg/install.sh deleted file mode 100644 index 1d6a22957b6..00000000000 --- a/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/tikztosvg/man.adoc b/Master/texmf-dist/doc/support/tikztosvg/man.adoc index ad5d8cca2af..fa4f8292675 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/man.adoc +++ b/Master/texmf-dist/doc/support/tikztosvg/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 . 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** + == COPYING diff --git a/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf b/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf index 3fb78c6fb4b..18b291edeec 100644 Binary files a/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf and b/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf differ diff --git a/Master/texmf-dist/scripts/tikztosvg/tikztosvg b/Master/texmf-dist/scripts/tikztosvg/tikztosvg index d1b1f8bb290..96d1af6ca9b 100755 --- a/Master/texmf-dist/scripts/tikztosvg/tikztosvg +++ b/Master/texmf-dist/scripts/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 -- cgit v1.2.3