Advertisement
cmhughes

/usr/local/bin/makepdf.sh

Mar 21st, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. #! /bin/bash
  2. # used for latex->dvips->ps2pdf
  3.  
  4. ERROR="Too few arguments : no file name specified"
  5. [[ $# -eq 0 ]] && echo $ERROR && exit                 # no args? ... print error and exit
  6.  
  7. if [ $# -eq 2 ]
  8. then
  9.     # latex this many times
  10.     for (( c=1; c<=$2; c++ ))
  11.     do
  12.         latex $1.tex
  13.     done
  14.     # makeindex, if appropriate
  15.     #grep -F makeindex $1.tex && makeindex $1 && echo "making index..."
  16.     egrep '^\\printindex' $1.tex && makeindex $1 && echo "making index..."
  17.     dvips $1.dvi -o $1.ps
  18.     ps2pdf $1.ps
  19.     #pstopdf $1.ps
  20.     echo
  21.     echo LaTeX ran $2 times
  22.     echo
  23.     exit
  24. fi
  25.  
  26. # check that the file exists
  27. if [ -f $1.tex ]
  28. then
  29.     # if it exists then latex it twice, [makeindex], dvips, then ps2pdf
  30.     latex $1.tex
  31.     latex $1.tex
  32.     # makeindex, if appropriate
  33.     #grep -F makeindex $1.tex && makeindex $1 && echo "making index..."
  34.     egrep '^\\printindex' $1.tex && makeindex $1 && echo "making index..."
  35.     dvips $1.dvi -o $1.ps
  36.     #pstopdf $1.ps
  37.     ps2pdf $1.ps
  38. else
  39.     # otherwise give this output line with a list of available tex files
  40.     echo the file doesnt exist butthead! Choose one of these:
  41.     ls *.tex
  42. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement