I asked the question on setting up auctex with emacs on tex list but I still could not find the end solution, unfortunately. Here is the link to my original question:


I guess I have a misunderstanding on the auctex+emacs settings and variable assignments.

I try to set the Tex-PDF-from-DVI option as explained in the manual(or as proposed by Arash in the above link) but I still can not seem to get the correct output pdf in the working directory. Is my understanding correct for this expectation? At the end, I am using psfrag a lot, and I would like to find a way to end up with a pdf output without using pdflatex through latex+dvips+ps2pdf path but there seems to be a missing link somewhere.

Update1: I did not get why people are downvoting without giving any reason. What is wrong with this question?

I tried one more time with no init-file since I thought that there might be sth I am missing there. I renamed my init file so there is no init file which I customized. Emacs starts in default status and I did the following:

1.) I did M-X customize-variable -> TeX-PDF-from-DVI 2.) Then, on the page that comes up, there is a Value Menu button, I selected dvips - ps2pdf sequence under that button. 3.) Then clicked Apply and Save.

If I perform these steps, I was expecting that I will end up with a pdf output but still I do have the dvi but not pdf. I guess the dvips-ps2pdf side is still not working? One question is: do I need to set those two commands also in the init file to make it work? But then what is the point of setting the option as mentioned above in the Value Menu?

One more follow up question is also to set the pdfviewer to view the pdf file from inside emacs but that is the next step since I can not produce the pdf output, TeX-PDF-from-DVI option should be doing this but it is not so I am totally confused...

Update2: A copy of the update on the above link for completeness:

Here is the updated part from my side. I guess I made quite some progress with the input of Arash in the below answer but there is a very small thing that is not clear. The below code is a minimal example which also uses psfrag and does what I would like to perform if I set C-c C-t C-p explicitly after saving this code in a file, say, simple.tex, namely, the steps followed are as follows,

  1. Save the below code in a file called simple.tex:
\usepackage[sc,osf]{mathpazo}   % With old-style figures and real smallcaps.
\linespread{1.025}              % Palatino leads a little more leading
% get the image from imagebin: 
% test.eps location, https://imagebin.ca/v/3x1gUN0CmKbo
% save it as test.eps

Extra info: I have this line

(setq-default TeX-master nil)

in my init file as the AUCTeX manual suggests. To ask for the master file for each file that is open

  1. If after step 1, I do C-c C-c then emacs asks for the master file, default is to set the above file as master, just typed return

  2. After typing return, these 4 new lines are added to the file to show that it is the master file:

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

and asks to save the file, ok, pressed y and saved it.

Then it jumped to Command (default LaTeX): which is followed by enter. Latex succesfully compiled the document to dvi format.

Now if I perform one more C-c C-c, I am getting

Cannot find "dvips and gv" viewer. Select another one in 'TeX-view-program-selection'

This was the part that was not working for viewing the output file as a pdf output although I had the following in my init file which were added after performing M-x customize variable for

TeX-PDF-mode -> setting it to on
Tex-PDF-from-DVI -> setting it to dvips - ps2pdf under Value Menu

And the exact settings added to the init file after these are turned on from inside emacs are as follows:

 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(TeX-PDF-mode t)
 '(TeX-PDF-from-DVI "Dvips"))

At this point, I can not view the pdf output because it is compiled in the latex mode(just for dvi output, I believe), although the TeX-PDF-mode is set to true(t) above in the init file(which is strange).

After the above error message, as mentioned above, if I explicitly switch to pdf mode with C-c C-t C-p, then C-c C-a gives me the correct output with all the psfrag substitutions. But I still did not understand why it is not set by default as I open the document since TeX-PDF-mode is set to true.

In the end, I get what I want but I did not totally understand why the file does not open in pdf-mode while "TeX-PDF-mode t" is in the init file.

  • Very vague: please state precisely what you've done (e.g. not "I did like Joe said") and which part of the result is not what you expected. – Stefan Apr 1 '18 at 22:28
  • @Stefan I changed the downvote. I agree with your comment; the OP is still too vague. However, the OP has already shown very real effort and simply needs to make more effort. I think the downvote was harsh. – zugzwang Apr 3 '18 at 15:50
  • @zugzwang: indeed, it's much better now, thanks. – Stefan Apr 3 '18 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.