ambevar-dotfiles/.scripts/ltx

29 lines
876 B
Plaintext
Raw Normal View History

#!/bin/sh
2013-10-23 11:24:54 +02:00
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
2013-06-25 22:56:10 +02:00
cat<<EOF
2014-02-12 11:48:48 +01:00
Usage: ${0##*/} [OPTIONS] FILES
2013-10-23 11:24:54 +02:00
LaTeX quick compiler. It adds the preambule and the "\end{document}"
2013-06-25 22:56:10 +02:00
automatically.
2014-02-12 11:48:48 +01:00
Options:
-p PACKAGES: Use the comma separated list of packages.
2013-06-25 22:56:10 +02:00
EOF
exit
fi
## One line is mandatory.
2014-02-12 11:48:48 +01:00
PREAMBLE='\documentclass[10pt,a4paper]{article}\usepackage[utf8]{inputenc}\usepackage[T1]{fontenc}\usepackage{amsmath,amssymb,amsfonts}\usepackage{geometry}\usepackage{lmodern}\usepackage{marvosym}\usepackage{textcomp}\DeclareUnicodeCharacter{20AC}{\EUR{}}\DeclareUnicodeCharacter{2264}{\leqslant}\DeclareUnicodeCharacter{2265}{\geqslant}'
2014-02-12 11:48:48 +01:00
if [ "$1" = "-p" ]; then
PACKAGES="\usepackage{$2}"
shift 2
fi
2013-10-23 11:24:54 +02:00
for i ; do
2014-02-12 11:48:48 +01:00
pdflatex -file-line-error-style -interaction nonstopmode -jobname="${i%.tex}" "$PREAMBLE" "$PACKAGES" "\begin{document}\input" "$i" "\end{document}"
2013-10-23 11:24:54 +02:00
done