[OS X TeX] Emacs Customizations: View, pdf, dvi, etc.
Roussanka Loukanova
rloukano at stp.lingfil.uu.se
Sun Jan 14 09:04:46 EST 2007
Hi,
I have gotten a possible customization of AUCTeX/Emacs for viewing pdf
and dvi files with Preview and TeXShop, respectively. Some of it,
if not almost all, I did with prompting suggestions from Peter Dyballa.
I'll describe the customization steps below and, since I do not know how
good they are, I would appreciate piers' review, possibly with better
solutions. (Similar customizations perhaps would work for any other
viewers.) But at first, a slight divergence (which, some of you may opt
to skip over to the mark ****):
In previous versions of Emacs, the default viewer was Preview, for
both latex and pdflatex, According to me, the default View command
following latex, with disabled PDFLaTeX mode, converted the dvi file
into pdf via dvips+ps2pdf, since dvips is important for some special
tex files. I found that very good, very convenient and quick. In the
later versions of Carbon Emacs, incl. Jan 07, the default View command
invokes xpdf and xdvi, for pdf and dvi files, respectively. Under
Linux, xdvi and xpdf are fine, but on a Mac, the life is far nicer
with Preview and TeXShop (or some of the other alternatives in the
line). It would be good if these two were defaults, respectively, for
pdf and dvi, esp. since:
(1) Preview is the default viewer on Mac OSX;
(2) the new TeXLive distribution can be installed so easily with
MacTeX_Additions, and thus, almost, comes bundled with TeXShop. TeXShop
seems the better option for dvi files since it converts them into pdf
files (without removing the dvi files, if one would prefer
this), etc, nice features.
AUCTeX/Emacs offer to users customizations, but some of us prefer
getting everything as a default, as convenient as possible in our work,
without messing up with customizations (which by themselves require
skills). I have been struggling to get rid of the default View with xpdf
and xdvi and replace them with Preview and TeXShop, respectively. It seems
to me other people do similarly.
**** Here is what I've done:
The buffer "Customize group: Tex Command" can be opened by selecting
from the menu bar of Emacs the following:
Latex -> Customize Auctex -> Browse options -> Tex Command group: [Go to
Group]
Clicking on [Go to Group] opens the customization buffer for
{Tex Command}. In it, there is a customization item
{Tex Output View Style}. Clicking over [Show Value] expands
declarations for various groups of commands, incl. for viewing the
output of (pdf)(la)tex. There is a long list of xdvi and other
commands, which I do not dare to touch (by not knowing their syntax):
apparently they are responsible for the default View command with
xdvi?
I have selected up the first available for expansion INS button at the
beginning of the first occurrence of the xdvi command. (It seems to me
that the order does not influence the priority of the viewing, perhaps
set up somewhere?) I expanded this INS button by clicking over it and
filling up the following declaration:
INS DEL Extension: ^dvi$
Choice: Value Menu List: ;; I'm not sure what is this?
INS
Command: open -a TeXShop %s.dvi
The command for the default View of pdf files with xpdf is at the end
of the list in {Tex Output View Style}. In the original
Carbon Emacs.app download, this is the declaration
INS DEL Extension: ^pdf$
Choice: Value Menu Regexp: .
Command: xpdf -remote "%s" -raise %o %(outpage)
I've replaced the above declaration with the following (I do not know
if it would be good or not to keep both):
INS DEL Extension: ^pdf$
Choice: Value Menu Regexp: . ;; I'm not sure what is this?
Command: open -a Preview %o %(outpage)
(In both declarations above, I tried alternatively with:
Command: open -a Preview %s.pdf
Command: open -a TeXShop %o %(outpage)
I am not sure what would be better choice. Something left me with the
above, hard-set-up, constraint for the specific .dvi extension with
TeXShop.)
These two declarations seem to trigger the default viewing:
- pdf files with Preview, when a tex file (for ex., test.tex) has been
typeset with PDFLaTeX
- dvi files with TeXShop, when a tex file (for ex., test.tex) has been
typeset with TeXShop
For ex., I do the following:
C-c C-t C-p => Tex-Pdf mode enabled
C-c C-c to invoke the pdflatex command: Command: (default LaTeX) RET
Command: (default View) RET
View command: open -a Preview test.pdf RET
However, this does not always work, in particular: I have some tex
files with dvips specialties, which require latexing via the commands
dvips + ps2pdf, or simpdftex. With the help of Gerben Wierda, I
included simpdftex as a command in the AUCTeX/Emacs Command list
(thanks Gerben, if you read or not this). After latexing with
simpdftex command, Preview is not invoked as the default viewer. I.e.,
here is what I get:
C-c C-c
Command: (default LaTeX) simpdftex RET
Command: (default View) RET
View command: xdvi test-dvips.dvi
To avoid the xdvi, I do the following
C-c C-c
Command: (default LaTeX) simpdftex RET
Command: (default View) Pre TAB
Command: (default View) Preview RET
Preview command: open -a Preview test-dvips.pdf
After saving the above declarations in the "Customize..." buffer with
{Save for Future Sessions}, AUCTeX/Emacs saves appropriate statements in
~/.emacs.
Roussanka
------------------------------------------------
Roussanka Loukanova
Computational Linguistics
Dept. of Linguistics and Philology
Uppsala University
P.Box 635, Uppsala 751 26, Sweden
Tel: +46 18 471 1342 (office)
+46 18 750 0340
Email: rloukano at stp.lingfil.uu.se
URL: http://stp.ling.uu.se/~rloukano/
--------------------------------------------------
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the MacOSX-TeX
mailing list