I first used LaTeX
while an intern at a very old-school software company that ran only unix workstations.
When I needed to write a letter (that had to be printed on paper and signed, for some bureaucratic task), I was told "try this
At first, the idea of writing in markup
, then compiling it
to get final document seemed strange, but I quickly came to love using it. Pretty soon, anything that I used to do in Word
I would do in LaTeX instead.
I got away from it entirely these last few years, as most things that used to require a printed letter or memo have succumbed to email, web forms, and the like.
But recently I had the need again, for a new project, and thought: why not?
The only difference now is that instead of printing to paper, I would be sending pdf files by email.
Fortunately, the Ghostscript ps2pdf
utility makes that simple, and it was already installed on my computer.
Likewise, LaTeX itself was already installed and available, thanks to the TeX Live package
The only remaining annoyance was all the commands I needed to run for each document:
$ latex test.tex
$ dvips test.dvi
$ ps2pdf test.ps
and, to clean-up all the intermediate files those commands generated:
$ rm test.aux test.dvi test.log test.ps
So I wrote this latex2pdf
if [ $# -ne 1 ]
echo "usage: latex2pdf.sh [file(.tex)]"
# split $1 on / to get the path and filename
if [ $path = $file ]
# check if the file already has the .tex ext
suffix=`echo $file | grep ".tex$" | wc -l`
if [ $suffix -eq 0 ]
# define the filename base string w/o the .tex ext
# (what the .aux, .dvi., .ps, .log files will be named)
s=`echo "$f" | sed -e 's/\.tex$//'`
# compile the .tex file and convert to pdf
rm -f "$s.aux"
rm -f "$s.dvi"
rm -f "$s.log"
rm -f "$s.ps"
Now, with a single command, I can build and view the result immediately:
$ ./latex2pdf.sh test.tex; xpdf test.pdf &
Who needs WYSIWYG