scripts/latexpic.sh
Simon Bruder ecd7808dd1
Make scripts suitable for running on NixOS
Older scripts (that now have no real purpose) or ones that require
packages that are not in nixpkgs are not updated. They should either be
removed or fixed at a later date.
2020-08-25 23:52:58 +02:00

29 lines
533 B
Bash
Executable file

#!/usr/bin/env bash
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
}
\usepackage{chemfig}
\renewcommand*\familydefault{\sfdefault}
\begin{document}
$(cat $OLDPWD/$1)
\end{document}
EOF
lualatex doc.tex
mutool draw -o doc.svg doc.pdf
inkscape -D -A doc.pdf doc.svg
mutool draw -r 600 -o $OLDPWD/${1}.png doc.pdf
mutool draw -o $OLDPWD/${1}.svg doc.pdf
cd -
rm -rf $tmpdir