summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2021-04-04 02:30:37 +0000
committerNorbert Preining <preining@logic.at>2021-04-04 02:30:37 +0000
commit6aa284727262f1c7ac0ec6c67becc28d5a678a8c (patch)
tree9c53f7a539f1630757154ecc23c613c201f4457c /Build
parent335676229f823eeb4a01f85c45c66ef6988d82ac (diff)
tikztosvg (4apr21)
git-svn-id: svn://tug.org/texlive/trunk@58737 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/tikztosvg/tikztosvg37
1 files changed, 34 insertions, 3 deletions
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 ]