@@ -9,7 +9,6 @@ SYNOPSIS="converts markdown-formatted text to PDF, using pdflatex."
10texname=output
10texname=output
11logfile=$THIS_TEMPDIR/log
11logfile=$THIS_TEMPDIR/log
14pandoc -s -r markdown -w latex "$@" -o - >$THIS_TEMPDIR/$texname.tex \
13pandoc -s -r markdown -w latex "$@" -o - >$THIS_TEMPDIR/$texname.tex \
@@ -23,23 +22,27 @@ else
26 cd $THIS_TEMPDIR
26 cd $THIS_TEMPDIR
27+ TEXINPUTS=$origdir:$TEXINPUTS:
27− TEXINPUTS=$TEXINPUTS:$origdir pdflatex -interaction=batchmode \
28+ pdflatex -interaction=batchmode $texname.tex >/dev/null || {
28− $texname.tex >/dev/null 2>&1 || {
29+ errcode=$?
29− errorcode=$?
30+ err "${THIS}: pdfLaTeX failed with error code $errcode"
31+ [ -f $texname.log ] && {
30− err "${THIS}: pdfLaTeX error context:"
32+ err "${THIS}: error context:"
31− sed -ne '/^!/,/^[[:space:]]*$/p' \
33+ sed -ne '/^!/,/^[[:space:]]*$/p' \
32− -ne '/^[Ll]a[Tt]e[Xx] [Ww]arning/,/^[[:space:]]*$/p' \
34+ -ne '/^[Ll]a[Tt]e[Xx] [Ww]arning/,/^[[:space:]]*$/p' \
33− -ne '/^[Ee]rror/,/^[[:space:]]*$/p' $texname.log >&2
35+ -ne '/^[Ee]rror/,/^[[:space:]]*$/p' $texname.log >&2
34− if grep -q "File \`ucs.sty' not found" $texname.log; then
36+ if grep -q "File \`ucs.sty' not found" $texname.log; then
35− err "${THIS}: Please install the 'unicode' package from CTAN:"
37+ err "${THIS}: Please install the 'unicode' package from CTAN:"
36− err " http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"
38+ err " http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"
38− if grep -q "File \`fancyvrb.sty' not found" $texname.log; then
40+ if grep -q "File \`fancyvrb.sty' not found" $texname.log; then
39− err "${THIS}: Please install the 'fancyvrb' package from CTAN:"
41+ err "${THIS}: Please install the 'fancyvrb' package from CTAN:"
40− err " http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/"
42+ err " http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/"
44) || exit $?
47) || exit $?