ps

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.

Mac OS command line suckage

Situation: program foobar is running on a Mac OS box and on a Linux box. I verified that using "top" (I'm working in an 80x25 xterm btw). Now the funny part:

Linux:

user@linux$ ps aux | grep foobar
root [...] /usr/sbin/foobar --some-options --more --options --even --more --options

Mac OS:

user@macos$ ps aux | grep foobar

Huh? What's going on? I know the program is running on both boxes! Mind-boggling solution after a long time of swearing and wasting time:

user@macos$ ps auxww | grep foobar
root [...] /usr/sbin/foobar --some-options --more --options --even --more --options

WTF? I mean... WTF??? Mac OS sticks the physical output on the terminal — 80 characters per line — into the pipe (instead of the full content). That's why the grep for "foobar" returns nothing - the "foobar" part is beyond the 80 character mark...

So if I resize my terminal to 20x10, only 20 characters per line would go into the pipe?!? How stupid is that?

Do all BSD-type OSes do that?

Syndicate content