Picture a Venn diagram with 3 circles: LaTeX, Emacs, Mac. I'd like to live in the intersection.
October 4, 2008 11:08 AM   Subscribe

Mac users who write LaTeX documents in Emacs (with or without AucTeX), please tell me about your workflow.

My wife and I both recently switched (back) to Macs from Windows machines. We're mathematicians, and we both live -- or used to live -- pretty much completely inside an Emacs buffer, writing LaTeX. We've had a terrible time approximating our Windows setups on the new Macs. What Emacs version do you people use? (I've tried Aquamacs and Carbon Emacs.) What PDF previewer? (Skim, Preview, something else?) Most importantly: how is everything tied together, in your .emacs or elsewhere?

Finally, please help me understand what the point of AucTeX is. Both the emacs versions I've tried come with it pre-installed. So far, all I can see is that it adds unnecesary keystrokes when I want to typeset something, and destroys all my useful muscle-memory. Do you use it? Does it make your life better/easier?
posted by gleuschk to Computers & Internet (10 answers total) 5 users marked this as a favorite
How about a Makefile to tie things together?

(I use Linux, not Mac, but 'make' is an integral part of my LaTeX+emacs setup)
posted by qxntpqbbbqxl at 11:51 AM on October 4, 2008

Best answer: I use carbon emacs, though for a while I was using xemacs (which I think I may have compiled myself, since there isn't a package that I know of). I use TeXShop as the previewer. The reason is that it will update its preview window if the file changes (there may be others that do this now, but there weren't when I started using this workflow). I also have a small applescript that is bound to the AucTeX "View" command, that ensures that TeXShop has a preview window open and in the front with the right file; I could post this if you wanted it.

AucTeX does require a few more keystrokes for compiling than some other setups because it doesn't automatically decide how many times it needs to run latex/bibtex all at once (when I used vim I had some one-key compile thing setup), but I got used to it pretty quick, and now it is second nature. This also has the advantage of taking less time for quick previewing of diagrams when you don't need to e.g. ensure that all references and citations are correct, and just want to see if you need to move some line down 10pt or whatever. I also use pdflatex, not latex > pstopdf or something, which cuts down on the compilation steps. But if you're using pstricks you can't do this.

On preview: I used to use makefiles, and I do still use them for complex documents (e.g. I used one for my dissertation, to automatically construct the whole thing from independently buildable chapters), but AucTeX does figure out most of the dependencies for you automatically without having to manually put them in a makefile, so for the simpler cases I find AucTeX more convenient than that.
posted by advil at 11:55 AM on October 4, 2008

Best answer: gleuschk, I probably approximate your situation pretty closely -- I switched to a Mac about a year and a half ago, after spending years LaTexing from inside an emacs buffer (on a Linux machine, not Windows, but same idea.) I switched to TeXShop immediately, and after a month or so it became second nature, to the point that I don't really like writing math on a Linux machine anymore.
posted by escabeche at 12:08 PM on October 4, 2008

Skim is pretty much what everyone uses. Seconding trying TeXShop or, my weapon of choice, TextMate. Instead of a makefile, use what those editors do or latexmk.
posted by stereo at 12:58 PM on October 4, 2008

Seconding the use of TexShop -- don't know what I ever did without it.
posted by peacheater at 2:45 PM on October 4, 2008

When I use a normal editor (I tend to use vi, but same story) with latex, what I typically do is keep a viewer window open (set to autorefresh), and just rerun latex whenever I have some changes. I don't care too much about the dependencies, since most of the time, having references resolve isn't a big deal.

Very often though, I write my document in LyX, and then either use the output directly or convert it to latex and pretty it up as needed. LyX is awesome.
posted by bsdfish at 5:36 PM on October 4, 2008

I just run pdflatex at the command line. It's great. It produces flawless PDFs.
posted by zpousman at 6:23 PM on October 4, 2008

Best answer: I also vote for Carbon Emacs and TexShop, esp. with BibDesk added into the mix. Works fine, at least working with article and memoir class. XeTeX with pretty fonts is quite sweet (and simple). I find myself pasting into TexShop from Emacs for preview or printing, which works great and actually keeps me away from compulsive previewing. Just think of it as a macro--M-x <>, Ctrl-W, Alt-Tab, Command-v. You can do iterative LaTeX-experimentation with with LaTeXit, too, which might be helpful when composing equations. (LyX is also worth a spin, but I keep messing with it instead of actually writing with it, so I've put it aside.)
posted by ftrain at 8:24 PM on October 4, 2008

Response by poster: Thanks, folks. I'd pretty much come to the TeXShop conclusion myself (and it's not bad), but my wife has been using emacs much longer than I, and really would like some way to carry that over to OSX. How frustrating that it's Unixy underneath, but doesn't provide an easy way to put together two of the classic Unix applications!
posted by gleuschk at 6:51 PM on October 6, 2008

Best answer: my wife has been using emacs much longer than I, and really would like some way to carry that over to OSX. How frustrating that it's Unixy underneath, but doesn't provide an easy way to put together two of the classic Unix applications!

Maybe you could say more about what isn't carrying over? I don't know if my previous answer was clear in light of what people later said, but I use texshop only for viewing the pdfs, and emacs+auctex for editing and compiling; aside from the previewing this is exactly the same workflow I would use on linux.

If the problem is previewing, maybe I'll just post the script I alluded to earlier in case that helps:

osascript -e "
set thePDF to \"$1\"
set pdfFile to alias POSIX file thePDF
tell application \"TeXShop\"
    open pdfFile
    tell document pdfFile
    end tell
end tell"

This is saved as a shell script, which in the settings for AucTeX, I have the View command call. (AucTeX settings -> Tex Command -> Tex Output View Style -> extension ^pdf$ calls the script). (There is some way to call applescripts directly in emacs but I never got it to work right.) So now if the file is compiled and I hit apple-c-c enter, it will open in the TeXshop preview window. Because TeXShop updates the file if it changes, any later compilation will also update the TeXShop preview window, and apple-c-c View(enter) or just apple-c-c enter if it needs no more compilation will bring the preview window the front. (I haven't verified this script with the most version of texshop, and I have occasionally had to update it.)
posted by advil at 12:51 PM on October 7, 2008

« Older How long before she can't get the dog back?   |   What do I use to make my first website? Newer »
This thread is closed to new comments.