summaryrefslogtreecommitdiff
path: root/default.svg.do
blob: 76a3b0bd7307d2e1c371de9e9b190cc10bd389df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
redo-ifchange $2.expr build/preview/preview.sty build/preview/prtightpage.def build/preamble.tex
INPUT=$(realpath $2.expr)
TDIR=$(mktemp -d --tmpdir=/tmp)
PREAMBLE=$(realpath build/preamble.tex)

pushd $(dirname $2) >/dev/null
TEXDIR=$(pwd)
popd >/dev/null

cp build/preview/preview.sty build/preview/prtightpage.def $TDIR

pushd $TDIR >/dev/null
latex -jobname=image >/dev/null <<EOF
\input{$PREAMBLE}
\begin{document}
\begin{preview}
\(
\input{$INPUT}
\)
\end{preview}
\end{document}
EOF

dvisvgm --exact --no-fonts $TDIR/image.dvi 2>&1 | sed -e '/depth=/!d;s/^.*depth=\(.*\)$/\1/' > $TEXDIR/vertical-align
cat $TDIR/image.svg
popd >/dev/null

rm -rf $TDIR