I'm new to Emacs and AUCTeX. On my home computer (with Windows XP) I can successfully compile .tex files and then, using C-c C-c again, launch a pdf viewer (Adobe Reader or Sumatra) to view the file.
However, on my work computer (Windows 7), I can successfully compile a .tex file to pdf using C-c C-c, but when I do C-c C-c again to view, the default view command that appears is start "" "a.pdf"
. Pressing Enter brings up the Windows error message Windows cannot find 'a.pdf'. Make sure you typed the name correctly, and then try again.
If I change the command so that it includes the full location of the file, e.g. start "" "//servername/mark/a.pdf"
, then the pdf viewer opens. At home, there is no need to change the default command start "" "a.pdf"
.
I'd appreciate if anyone can tell me how to get the pdf viewer to open without having to edit the command each time. At work I have AUCTeX version 11.86.
Best Answer
Your default PDF-viewer is controlled by two variables called
TeX-view-program-list
andTeX-view-program-selection
. There are several ways of modifying these:Through the Emacs's interface
Select the group called:
Tex Command
then findTeX View
. UnderTeX View Program List
is all the list of known commands for viewing your generated pdf. In my case I use SumatraPDF.exe which I also have in my globalPATH
variable. Insert following:Under
TeX View Program Selection
the default viewer for pdf and dvi can be selected. Select the previously defined SumatraPDF.Inserting setup in .emacs
Just insert following code in your
.emacs
configuration file:If you don't use SumatraPDF (I really recommend you do), then change the name and command. Remember to have your pdf-viewer in your PATH or refer directly to it through the full path.