latex

Faster and more comfortable LaTeX editing and previewing with latexmk

When writing LaTeX documents I usually just edit the plain text in vim, and in another xterm I type make && xpdf foo.pdf to regenerate the PDF output and view it in xpdf. This is tedious and slow if you do it often. A much better way I found out about now, is to use latexmk.

apt-get install latexmk

This tool autogenerates a PDF or PostScript file out of your *.tex file(s), so it would make my Makefile obsolete. But the much better thing is that it has a preview mode:

latexmk -pvc -pdfps foo.tex

This generates a PDF out of foo.tex (and its dependencies, if any), and refreshes the PDF every time the foo.tex file gets updated (i.e., every time I type :w in vim). So I can now leave the xpdf instance open all the time, and it'll be refreshed automatically to show the latest version of my document.

Caveat: in xpdf you have to press (for example) "next page" and then "previous page" (SPACE, BACKSPACE) to refresh the screen. Leaving out the "-pdfps" makes the regeneration process a bit faster and uses xdvi for previewing as dvi (instead of PDF) which does not require the above SPACE+BACKSPACE hack. But I like xpdf better than xdvi, so I'll stick with it.

Syndicate content