2020-08-25 23:52:58 +02:00
|
|
|
#!/usr/bin/env bash
|
2020-10-02 17:18:05 +02:00
|
|
|
# shellception since nix-shell and shebang does not work with combining texlive
|
|
|
|
if ! command -v xelatex >> /dev/null; then
|
|
|
|
nix-shell -p 'texlive.combine { inherit (pkgs.texlive) scheme-small chemfig simplekv siunitx standalone varwidth; }' --run "$0 $@"
|
|
|
|
exit $?
|
|
|
|
fi
|
|
|
|
|
2020-01-16 19:25:19 +01:00
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
cd $tmpdir
|
|
|
|
|
|
|
|
cat > doc.tex << EOF
|
|
|
|
\documentclass[varwidth]{standalone}
|
|
|
|
\usepackage{amsmath}
|
|
|
|
\usepackage{amssymb}
|
|
|
|
\usepackage{siunitx}
|
|
|
|
\sisetup{
|
|
|
|
per-mode=fraction,
|
|
|
|
quotient-mode=fraction
|
|
|
|
}
|
2020-05-22 18:17:18 +02:00
|
|
|
\usepackage{chemfig}
|
2020-01-16 19:25:19 +01:00
|
|
|
\renewcommand*\familydefault{\sfdefault}
|
|
|
|
|
|
|
|
\begin{document}
|
|
|
|
$(cat $OLDPWD/$1)
|
|
|
|
\end{document}
|
|
|
|
EOF
|
|
|
|
|
2020-10-02 17:18:05 +02:00
|
|
|
xelatex doc.tex
|
2020-03-19 13:59:53 +01:00
|
|
|
mutool draw -o doc.svg doc.pdf
|
|
|
|
inkscape -D -A doc.pdf doc.svg
|
2020-03-02 20:13:48 +01:00
|
|
|
mutool draw -r 600 -o $OLDPWD/${1}.png doc.pdf
|
|
|
|
mutool draw -o $OLDPWD/${1}.svg doc.pdf
|
2020-01-16 19:25:19 +01:00
|
|
|
cd -
|
|
|
|
rm -rf $tmpdir
|