updated on Wed Jan 11 04:01:16 UTC 2012
[aur-mirror.git] / dvi2gr / tex2gr
blob21574a470ab4b4df573d278ed8b739ecf88f6cfd
1 #!/bin/bash
2 TMPDIR=/tmp
3 DVI2GR=dvi2gr
4 # Not sure where this is supposed to be relative to
5 FPATH="fonts/type1"
6 LATEX=latex
8 input=$1
10 if [ $input == "--help" ]; then
11 echo "Usage: tex2gr <latex_snippet>"
12 echo "Snippet should begin and end with '$' if it contains math"
13 exit 0
16 bname=$TMPDIR/dvi2gr$$
17 itex=$bname.tex
18 idvi=$bname.dvi
19 iaux=$bname.aux
20 ilog=$bname.log
22 istr=`sed 's/\\\\/\\\\\\\\/g' $input`
24 cat << EOPRE > $itex
25 \documentclass[10pt]{article}
26 \pagestyle{empty}
27 \begin{document}
28 EOPRE
30 cat $input >> $itex
32 cat << EOPOST >> $itex
33 \end{document}
34 EOPOST
36 $LATEX --output-directory=$TMPDIR/ $itex > /dev/null
37 ostr=`$DVI2GR $FPATH $idvi`
39 echo "$ostr"
41 rm -f $itex $idvi $iaux $ilog