From 6aa284727262f1c7ac0ec6c67becc28d5a678a8c Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 4 Apr 2021 02:30:37 +0000 Subject: tikztosvg (4apr21) git-svn-id: svn://tug.org/texlive/trunk@58737 c570f23f-e606-0410-a88d-b1316a301751 --- .../texlive/linked_scripts/tikztosvg/tikztosvg | 37 +++++- Master/texmf-dist/doc/man/man1/tikztosvg.1 | 33 +++--- Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf | Bin 23423 -> 24272 bytes .../doc/support/tikztosvg/CHANGELOG.adoc | 7 -- .../texmf-dist/doc/support/tikztosvg/CHANGELOG.md | 18 +++ Master/texmf-dist/doc/support/tikztosvg/Makefile | 55 ++++----- Master/texmf-dist/doc/support/tikztosvg/README.md | 60 ++++++---- .../texmf-dist/doc/support/tikztosvg/example.svg | 126 ++++++++------------- .../texmf-dist/doc/support/tikztosvg/example.tikz | 4 +- Master/texmf-dist/doc/support/tikztosvg/install.sh | 7 +- Master/texmf-dist/doc/support/tikztosvg/man.adoc | 25 ++-- .../texmf-dist/doc/support/tikztosvg/tikztosvg.pdf | Bin 93967 -> 168699 bytes Master/texmf-dist/scripts/tikztosvg/tikztosvg | 37 +++++- 13 files changed, 239 insertions(+), 170 deletions(-) delete mode 100644 Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.adoc create mode 100644 Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.md diff --git a/Build/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg b/Build/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg index 664aea37020..398d06499fc 100755 --- a/Build/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg +++ b/Build/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg @@ -1,4 +1,12 @@ #!/bin/sh +# _ _ _ _ +# | |_(_) | __ ___| |_ ___ _____ ____ _ +# | __| | |/ /|_ / __/ _ \/ __\ \ / / _` | +# | |_| | < / /| || (_) \__ \\ V / (_| | +# \__|_|_|\_\/___|\__\___/|___/ \_/ \__, | +# |___/ +# 2021 (C) Pablo +# Free use of this software is granted under the terms of the GPL-3.0 License puts() { @@ -34,6 +42,10 @@ showVersion() exit 0 } +# The default list of packages and libraries that should be imported +PACKAGES="tikz tikz-cd pgfplots amsmath amssymb" +LIBRARIES="" + if ! [ -x "$(command -v xelatex)" ] then error "xelatex could not be found" @@ -45,7 +57,6 @@ then fi # Parsing the arguments -PACKAGES="" while [ $# -gt 1 ] do case "$1" in @@ -70,6 +81,21 @@ do shift esac ;; + -l|--library) + case "$2" in + "") + error "Unnexpected EOF" + ;; + # Check if the name of the package is valid + *" "*) + error "Invalid library name. TikZ library names cannot contain scapes!" + ;; + *) + LIBRARIES="$LIBRARIES $2" + shift + shift + esac + ;; -o|--output) if [ -n "$OUTPUT" ] then @@ -139,12 +165,17 @@ TEX_FILE="$TEMP_DIR/tmp.tex" # Generate the LaTeX document printf "\documentclass[crop,tikz,multi=false]{standalone}\n" > "$TEX_FILE" -for PACKAGE in $PACKAGES +for PACKAGE in $(echo "$PACKAGES" | tr " " "\n" | sort | uniq) do printf "\usepackage{%s}\n" "$PACKAGE" >> "$TEX_FILE" done -printf "\\\begin{document} \huge\n" >> "$TEX_FILE" +for LIBRARY in $(echo "$LIBRARIES" | tr " " "\n" | sort | uniq) +do + printf "\usetikzlibrary{%s}\n" "$LIBRARY" >> "$TEX_FILE" +done + +printf "\\\begin{document}\n" >> "$TEX_FILE" cat "$INPUT" >> "$TEX_FILE" if [ $? -ne 0 ] diff --git a/Master/texmf-dist/doc/man/man1/tikztosvg.1 b/Master/texmf-dist/doc/man/man1/tikztosvg.1 index da35ddbdcc3..224c93d9ad1 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: tikzsvg +.\" Title: tikztosvg .\" Author: [see the "AUTHOR(S)" section] -.\" Generator: Asciidoctor 2.0.10 -.\" Date: 2020-08-16 +.\" Generator: Asciidoctor 2.0.12 +.\" Date: 2021-03-30 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "TIKZSVG" "1" "2020-08-16" "\ \&" "\ \&" +.TH "TIKZTOSVG" "1" "2021-03-30" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -28,13 +28,13 @@ . LINKSTYLE blue R < > .\} .SH "NAME" -tikzsvg \- Render TikZ diagrams to SVG. +tikztosvg \- Render TikZ diagrams to SVG. .SH "SYNOPSIS" .sp -\fBtikzsvg\fP [\fIOPTION\fP]... \fIINPUT_PATH\fP +\fBtikztosvg\fP [\fIOPTION\fP]... \fIINPUT_PATH\fP .SH "DESCRIPTION" .sp -The tikzsvg(1) command renders TikZ diagrams to SVG. +The tikztosvg(1) command renders TikZ diagrams to SVG. .sp If \fIINPUT_PATH\fP is set to \fI\-\fP the input will be read from stdin. .SH "OPTIONS" @@ -49,7 +49,13 @@ extension. The file is resolved relative to the working directory. .sp \fB\-p, \-\-package\fP=+\fIPACKAGE\fP .RS 4 -Include \fI\(rsusepackage{PACKAGE}\fP when rendering the diagram. + Include \fI\(rsusepackage{PACKAGE}\fP when rendering the diagram. The tikz, tikz\-cd, +pgfplots, amsmath and amssymb packages are always included by default. +.RE +.sp +\fB\-l, \-\-library\fP=+_LIBRARY +.RS 4 +Include \fI\(rsusetikzlibrary{LIBRARY}\fP when rendering the diagram. .RE .sp \fB\-q, \-\-quiet\fP @@ -68,7 +74,7 @@ Prints version information. .RE .SH "ENVIRONMENT" .sp -\fBtikztosvg\fP requires \fIxetex\fP and \fIpdf2svg\fP to be installed. Make sure +\fBtikztosvg\fP requires XeTeX and pdf2svg to be installed. Make sure any additional LaTeX packages are installed before using them in a diagram. .SH "EXIT STATUS" .sp @@ -88,8 +94,7 @@ Failure (document processing failure). .RE .SH "AUTHORS" .sp -\fBtikztosvg\fP was written by Pablo Emilio Escobar Gaviria -<\c +\fBtikztosvg\fP was written by Pablo <\c .MTO "pablo\-escobar\(atriseup.net" "" ">." .sp \fBpdf2svg\fP was written by David Barton <\c @@ -99,9 +104,9 @@ Matthew Flaschen <\c .MTO "matthew.flaschen\(atgatech.edu" "" ">." .SH "RESOURCES" .sp -\fBGit source repository on GitLab:\fP \c -.URL "https://gitlab.com/pablo\-escobar/tikztosvg" "" "" +\fBGit source repository on sourcehut:\fP \c +.URL "https://git.sr.ht/~pablo\-pie/tikztosvg" "" "" .SH "COPYING" .sp -Copyright (C) 2020 Pablo Emilio Escobar Gaviria. +Copyright (C) 2021 Pablo. Free use of this software is granted under the terms of the GPL\-3.0 License. \ No newline at end of file diff --git a/Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf b/Master/texmf-dist/doc/man/man1/tikztosvg.man1.pdf index 4ec65aaa2d5..760171d241f 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.adoc b/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.adoc deleted file mode 100644 index e742d0cb5c6..00000000000 --- a/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.adoc +++ /dev/null @@ -1,7 +0,0 @@ -== Release 0.1.2 - -* The script is now posix-complient (it doesn't use bash anymore) -* Messages in the log output are now color-coded -* The script now support `stdin` input and `stdout` output -* The documentation is now rendered to PDF -* The documentation was updated diff --git a/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.md b/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.md new file mode 100644 index 00000000000..6355541f945 --- /dev/null +++ b/Master/texmf-dist/doc/support/tikztosvg/CHANGELOG.md @@ -0,0 +1,18 @@ +# CHANGELOG + +## Release 0.2.0 + +* Removed code that added the `\huge` command to the beginning of the document +* Added an option for importing TikZ libraries (the `-l` option) +* Made it so that items from the `-p` and `-l` options aren't imported twice +* Made it so that tikz, tikz-cd, pgfplots, amsmath and amssymb are imported by + default +* Added instructions for installing the application with Git + +## Release 0.1.2 + +* The script is now posix-complient (it doesn't use bash anymore) +* Messages in the log output are now color-coded +* The script now support `stdin` input and `stdout` output +* The documentation is now rendered to PDF +* The documentation was updated diff --git a/Master/texmf-dist/doc/support/tikztosvg/Makefile b/Master/texmf-dist/doc/support/tikztosvg/Makefile index bae45ce4e39..ce66f807b6f 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/Makefile +++ b/Master/texmf-dist/doc/support/tikztosvg/Makefile @@ -1,35 +1,30 @@ +.PHONY: package install + # Packages the application for CTAN -package: - # Render the manpage - asciidoctor -b manpage -o man/tikztosvg.1 man/man.adoc +package: tikztosvg.tar.gz + +install: man/tikztosvg.1 tikztosvg + # Install the executable + cp tikztosvg ~/.local/bin/ + chmod +x ~/.local/bin/tikztosvg - # Render the README as PDF - asciidoctor -r asciidoctor-pdf -b pdf -o tikztosvg.pdf README.adoc - - # Render the README as Markdown - asciidoctor -b docbook -a leveloffset=+1 -o - README.adoc \ - | pandoc --atx-headers \ - --wrap=preserve \ - -t markdown_github \ - -f docbook - \ - | comby '![:[name]](:[link])' \ - '![:[name]](examples/:[link])' \ - -stdin \ - -stdout \ - -m .md \ - | comby ':imagesdir: :[[value]]' '' -stdin -stdout -m .md \ - | comby ':source-highlighter: :[[value]]' '' -stdin -stdout -m .md \ - > README.md + # Install the manpage + install -g 0 -o 0 -m 0644 man/tikztosvg.1 ~/.local/share/man/man1/ + +man/tikztosvg.1: man/man.adoc + asciidoctor -b manpage -o $@ $^ + +tikztosvg.pdf: README.md + pandoc -s -o $@ $^ + +example/example.svg: example/example.tikz + sh ./tikztosvg -p xfrac -p relsize -o $@ $^ - # Package the repository as a tar file - tar -cvO \ - --directory=.. \ - --exclude='.*' \ - --exclude='*.tar.gz' \ - --exclude='README.adoc' \ - tikztosvg \ - | gzip -c /dev/stdin > tikztosvg.tar.gz + # Try to compress the image with svgo + svgo --pretty --enable=sortAttrs $@ || exit 0 -install: - sh install.sh +# Packages the application for CTAN +tikztosvg.tar.gz: man/tikztosvg.1 tikztosvg.pdf README.md example/example.svg CHANGELOG.md + tar -cvO --directory=.. --exclude='.*' --exclude='*.tar.gz' tikztosvg \ + | gzip -c /dev/stdin > tikztosvg.tar.gz diff --git a/Master/texmf-dist/doc/support/tikztosvg/README.md b/Master/texmf-dist/doc/support/tikztosvg/README.md index ac986ae7472..866e73b690d 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/README.md +++ b/Master/texmf-dist/doc/support/tikztosvg/README.md @@ -1,22 +1,30 @@ # tikztosvg(1) -Pablo Emilio Escobar Gaviria <> - -The `tikztosvg(1)` command renders TikZ diagrams to SVG, using [`xetex`](http://xetex.sourceforge.net/) and [`pdf2svg`](https://github.com/dawbarton/pdf2svg). +The `tikztosvg(1)` command renders TikZ diagrams to SVG, using +[XeTeX](http://xetex.sourceforge.net/) and +[pdf2svg](https://github.com/dawbarton/pdf2svg). ## Usage - tikztosvg [OPTION]... INPUT_PATH +``` sh +$ tikztosvg [OPTION]... INPUT_PATH +``` If *INPUT\_PATH* is set to *-* the input will be read from stdin. ### Options **-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. +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. +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. @@ -33,35 +41,49 @@ 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 \\ - \sfrac{G}{\ker \varphi} \arrow[ru, dotted] & + G \arrow[r, "\varphi"] \arrow[d, "\psi"', two heads] & H \\ + \mathlarger{\sfrac{G}{\ker \varphi}} \arrow[ru, dotted] & \end{tikzcd} ``` -You could achieve that by running the following command: +You could achieve this by running: +``` sh +# xfrac and relsize are only there so that we can +# call \sfrac and \mathlarger +$ tikztosvg -p xfrac -p relsize example.tikz +``` - tikztosvg -p tikz-cd -p xfrac example.tikz +The results will be stored in the file `example.svg`. -The results will be stored in the file `example.svg`: +## Installation -![example](examples/example.svg) +The `tikztosvg(1)` command and it’s man page can be installed in Unix systems +by running -## Installation +``` sh +$ curl -s https://git.sr.ht/~pablo-pie/tikztosvg/blob/master/install.sh | sudo sh +``` -The `tikztosvg(1)` command and it’s man page can be installed in Unix systems by running: +or it can be installed via Git with - $ curl -s https://gitlab.com/pablo-escobar/tikztosvg/-/raw/master/install.sh | sudo sh +``` sh +$ 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/`. +The executable is installed in `$HOME/.local/bin/` and the man-page is +installed in `$HOME/.local/share/man/man1/`. ## Authors -**tikztosvg** was written by [Pablo Emilio Escobar Gaviria](mailto:pablo-escobar@riseup.net). +**tikztosvg** was written by [Pablo](mailto:pablo-escobar@riseup.net). -**pdf2svg** was written by [David Barton](mailto:davebarton@cityinthesky.co.uk) and [Matthew Flaschen](mailto:matthew.flaschen@gatech.edu). +**pdf2svg** was written by [David Barton](mailto:davebarton@cityinthesky.co.uk) +and [Matthew Flaschen](mailto:matthew.flaschen@gatech.edu). ## License -© 2020 Pablo Emilio Escobar Gaviria. +© 2021 Pablo. Free use of this software is granted under the terms of the GPL-3.0 License. diff --git a/Master/texmf-dist/doc/support/tikztosvg/example.svg b/Master/texmf-dist/doc/support/tikztosvg/example.svg index 4de0d5e53ed..4c258f4f367 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/example.svg +++ b/Master/texmf-dist/doc/support/tikztosvg/example.svg @@ -1,80 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Master/texmf-dist/doc/support/tikztosvg/example.tikz b/Master/texmf-dist/doc/support/tikztosvg/example.tikz index 31106442122..416d667e54c 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 \\ -\sfrac{G}{\ker \varphi} \arrow[ru, dotted] & + G \arrow[r, "\varphi"] \arrow[d, "\psi"', two heads] & H \\ + \mathlarger{\sfrac{G}{\ker \varphi}} \arrow[ru, dotted] & \end{tikzcd} diff --git a/Master/texmf-dist/doc/support/tikztosvg/install.sh b/Master/texmf-dist/doc/support/tikztosvg/install.sh index bc5a26741b9..659199b883b 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/install.sh +++ b/Master/texmf-dist/doc/support/tikztosvg/install.sh @@ -1,4 +1,7 @@ #!/bin/sh +# +# 2021 (C) Pablo +# Free use of this software is granted under the terms of the GPL-3.0 License puts () { @@ -43,13 +46,13 @@ then rm "$HOME/.local/bin/tikztosvg" fi -wget https://gitlab.com/pablo-escobar/tikztosvg/-/raw/master/tikztosvg -P "$HOME/.local/bin/"\ +wget https://git.sr.ht/~pablo-pie/tikztosvg/blob/master/tikztosvg -P "$HOME/.local/bin/"\ && chmod +x "$HOME/.local/bin/tikztosvg"\ || exit 1 tmp="$(mktemp -d)" message "Installing manual entry for tikztosvg(1)" -wget https://gitlab.com/pablo-escobar/tikztosvg/-/raw/master/man/tikztosvg.1 -P "$tmp"\ +wget https://git.sr.ht/~pablo-pie/tikztosvg/blob/master/man/tikztosvg.1 -P "$tmp"\ && install -g 0 -o 0 -m 0644 "$tmp/tikztosvg.1" "$HOME/.local/share/man/man1/"\ || exit 1 diff --git a/Master/texmf-dist/doc/support/tikztosvg/man.adoc b/Master/texmf-dist/doc/support/tikztosvg/man.adoc index 5a8a4bf7f6f..5f2e5554cf0 100644 --- a/Master/texmf-dist/doc/support/tikztosvg/man.adoc +++ b/Master/texmf-dist/doc/support/tikztosvg/man.adoc @@ -1,20 +1,20 @@ -= tikzsvg(1) += tikztosvg(1) :doctype: manpage :man-manual: tikztosvg Manual -:man-source: tikztosvg 0.1.2 +:man-source: tikztosvg 0.2.0 :page-layout: base == NAME -tikzsvg - Render TikZ diagrams to SVG. +tikztosvg - Render TikZ diagrams to SVG. == SYNOPSIS -*tikzsvg* [_OPTION_]... _INPUT_PATH_ +*tikztosvg* [_OPTION_]... _INPUT_PATH_ == DESCRIPTION -The tikzsvg(1) command renders TikZ diagrams to SVG. +The tikztosvg(1) command renders TikZ diagrams to SVG. If _INPUT_PATH_ is set to _-_ the input will be read from stdin. @@ -27,7 +27,11 @@ If _INPUT_PATH_ is set to _-_ the input will be read from stdin. extension. The file is resolved relative to the working directory. *-p, --package*=+_PACKAGE_:: - Include _\usepackage{PACKAGE}_ when rendering the diagram. + 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. @@ -40,7 +44,7 @@ If _INPUT_PATH_ is set to _-_ the input will be read from stdin. == ENVIRONMENT -*tikztosvg* requires _xetex_ and _pdf2svg_ to be installed. Make sure +*tikztosvg* requires XeTeX and pdf2svg to be installed. Make sure any additional LaTeX packages are installed before using them in a diagram. == EXIT STATUS @@ -56,18 +60,17 @@ any additional LaTeX packages are installed before using them in a diagram. == AUTHORS -*tikztosvg* was written by Pablo Emilio Escobar Gaviria -. +*tikztosvg* was written by Pablo . *pdf2svg* was written by David Barton and Matthew Flaschen . == RESOURCES -*Git source repository on GitLab:* https://gitlab.com/pablo-escobar/tikztosvg +*Git source repository on sourcehut:* https://git.sr.ht/~pablo-pie/tikztosvg == COPYING -Copyright \(C) 2020 Pablo Emilio Escobar Gaviria. +Copyright \(C) 2021 Pablo. Free use of this software is granted under the terms of the GPL-3.0 License. diff --git a/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf b/Master/texmf-dist/doc/support/tikztosvg/tikztosvg.pdf index 5627b2bd5e3..c7d54a4005b 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 664aea37020..398d06499fc 100755 --- a/Master/texmf-dist/scripts/tikztosvg/tikztosvg +++ b/Master/texmf-dist/scripts/tikztosvg/tikztosvg @@ -1,4 +1,12 @@ #!/bin/sh +# _ _ _ _ +# | |_(_) | __ ___| |_ ___ _____ ____ _ +# | __| | |/ /|_ / __/ _ \/ __\ \ / / _` | +# | |_| | < / /| || (_) \__ \\ V / (_| | +# \__|_|_|\_\/___|\__\___/|___/ \_/ \__, | +# |___/ +# 2021 (C) Pablo +# Free use of this software is granted under the terms of the GPL-3.0 License puts() { @@ -34,6 +42,10 @@ showVersion() exit 0 } +# The default list of packages and libraries that should be imported +PACKAGES="tikz tikz-cd pgfplots amsmath amssymb" +LIBRARIES="" + if ! [ -x "$(command -v xelatex)" ] then error "xelatex could not be found" @@ -45,7 +57,6 @@ then fi # Parsing the arguments -PACKAGES="" while [ $# -gt 1 ] do case "$1" in @@ -70,6 +81,21 @@ do shift esac ;; + -l|--library) + case "$2" in + "") + error "Unnexpected EOF" + ;; + # Check if the name of the package is valid + *" "*) + error "Invalid library name. TikZ library names cannot contain scapes!" + ;; + *) + LIBRARIES="$LIBRARIES $2" + shift + shift + esac + ;; -o|--output) if [ -n "$OUTPUT" ] then @@ -139,12 +165,17 @@ TEX_FILE="$TEMP_DIR/tmp.tex" # Generate the LaTeX document printf "\documentclass[crop,tikz,multi=false]{standalone}\n" > "$TEX_FILE" -for PACKAGE in $PACKAGES +for PACKAGE in $(echo "$PACKAGES" | tr " " "\n" | sort | uniq) do printf "\usepackage{%s}\n" "$PACKAGE" >> "$TEX_FILE" done -printf "\\\begin{document} \huge\n" >> "$TEX_FILE" +for LIBRARY in $(echo "$LIBRARIES" | tr " " "\n" | sort | uniq) +do + printf "\usetikzlibrary{%s}\n" "$LIBRARY" >> "$TEX_FILE" +done + +printf "\\\begin{document}\n" >> "$TEX_FILE" cat "$INPUT" >> "$TEX_FILE" if [ $? -ne 0 ] -- cgit v1.2.3