jemnotesversion 2 / featuring this entry or see all/search

Aug 5
I made some aliases for use when writing LaTeX documents. Add these (perhaps unwieldly) lines to your .bashrc:
# Next command on a single line.
alias lr='latex -file-line-error-style -interaction=nonstopmode $LR.tex > 
  /tmp/latexoutput || cat /tmp/latexoutput ; 
  grep -e "\(LaTeX Warning\)\|\(Overfull\)\|\(Underfull\)" /tmp/latexoutput | 
  grep -v "There were undefined references";
  killall -SIGUSR1 xdvi.bin 2> /dev/null'

alias xdj='xdvi -paper us -expert -keep $LR.dvi 2>/dev/null >/dev/null&'
Note: depending on your system, you made need to replace xdvi.bin with xdvi-xaw3d.bin.
Then, when you are preparing a document, you can do this:
>> LR=myfilename # set filename. The suffix .tex is added automatically.
>> lr            # compiles your latex document.
>> xdj           # displays your latex document.
This sounds pretty ordinary, but these aliases take advantage of these things:
  • lr will only show the output if there was a problem. This avoids polluting your screen.
  • lr will never stop with an error while running latex and leave you punching keys in the hopes of getting back to the command line.
  • latex will tell you the line number of any errors.
  • lr will automatically kick xdvi after compiling the document to show your changes. No need to click on xdvi or wait for it to notice the file changed. I really like the way xdvi permits such updates without flickering.