[OS X Emacs] synctex in Aquamacs

M A markoilcan at gmail.com
Tue Jul 29 11:29:14 EDT 2008

On Mon, Jul 28, 2008 at 2:54 PM, Joseph C. Slater PE, PhD
<joseph.slater at wright.edu> wrote:
> On Jul 28, 2008, at 3:41 PM, Peter Dyballa wrote:
>> You don't need to know much of ELisp and you never should change ELisp
>> files in the Emacs distribution. There are two alternatives: set something
>> to the correct value in your init file (usually ~/.emacs) or use the
>> customisation interface. Available from Options -> Customize Emacs.
>> TeX-command-list is a Specific Option. And miraculously you can paste the
>> variable's name for example into the *scratch* buffer, leave the cursor in
>> the name, and then choose from the menu Options -> Customize Emacs ->
>> Specific Option. Now a simple RET is sufficient.
>> BTW, once you've saved your changes (they should go into ~/.emacs) you
>> have a slight chance to edit this customisation in the init file ...
> I've created some disasters in my .emacs files before and mostly stopped
> putzing with it by hand, due to my propensity to reinvent the wheel, make is
> square, etc. I'll dig through later.
> I haven't gotten synctex to do what is should with skim anyhow (when using
> it from the command line). Apparently it's executed with
> pdflatex -synctex=# filename.tex
> synctex works if # is not zero. However, the generated pdflatex file does
> not end up synchronizable from Skim as pdfsync was. I haven't seen
> documentation explaining if there is a different setting, etc. It is stated
> as supported in 1.1.9, though. I think I should wait until things settle a
> little bit and are working better.

As Peter says going the customization route is better than editing
elisp files. Unfortunately, this is itself not always easy for a
non-expert. I would suggest doing the following:
1. Open a latex file in aquamacs.
2. Under the Latex menu item go to Customize Auctex.
3. Select Expand this menu.
4. Go back to Latex>Customize Auctex and select Tex Command>Tex Command List....
5. You should now have a buffer open which a bunch of entries under
Tex Command List. Look for the one that starts with "Name: LaTeX". The
line under this should say something like "Command: %`%l%(mode)%' %t".
This, believe it or not, is the command that auctex executes when you
have it latex your file. All those %... get substituted with something
before the command is executed. If you want to figure out what go to
the bottom of the buffer where there is documentation about each
element, find the second element documentation and click on
"TeX-expand-list". After thoroughly satisfying yourself that this is
just as confusing go back to "Command: %`%l%(mode)%' %t".
6. Replace the command so it now reads "Command: pdflatex --synctex
%t" or whatever it should look like based on what is successful on the
command line (maybe -interaction=nonstopmode also?). This will
eliminate some of the nifty automatic things auctex can do like change
the command based on whether you want dvi or pdf output, etc. Elisp
gurus will create a new substitution to include in Tex-expand-list
include that in the Command and create a synctex mode to determine
whether to run it with synctex. Knock yourself out with that if you
7. Near the top of the buffer click on the "Set for Current Session"
button. If you want to save it for future sessions click on "Save for
Future Sessions".
8. Go back to the buffer with you tex file and latex it.
9. If it fails go back to the Tex Command List buffer, edit the
command until it works or click the "Erase Customiztion" button to go
back to original defaults (this may erase any other customizations in
Tex Command List done previously.

A final warning. I have not tried this specifically and cannot be sure
that it will work as expected. On the other hand, it's easy enough to
revert any changes (especially if you do not push the Save for Future
Sessions button).

Mark A

More information about the MacOSX-Emacs mailing list