# AUCTeX: how to jump to PDF (with synctex) without recompile when inline preview has been created?

I'm using Aquamacs 2.4 on MacOS X 10.6.8 with pdflatex (TeXLive 2011).

My problem:

I can create inline previews of formulas, figures etc. in the source code with AUCTeX which is very helpful - e. g. with the command C-C C-P C-D. When I do that, the already compiled PDF output file seems to be removed, so after creating the previews, I can not jump from the source code to the pdf any more (with synctex), but I firstly have to recreate the PDF with pdflatex which takes some time.

So my question is:

• is there anything which I have not configured correctly, or is it normal (or necessary) that during the creation of the AUCTeX previews the original PDF is removed?

MWE:

\documentclass{scrbook}

\begin{document}

this is a dummy text with a dummy formula:

$a+b = c^2$

\end{document}

-
I never could get the preview to work, so I won't help you. But I'm curious, why would you want to use both preview-latex and synctex? Can't you use preview alone until the content is frozen, and then synctex to adjust the typesetting details? –  T. Verron Jan 5 at 0:15
I find it easier to read in the real PDF. I'm trying to get used to work more in the source and compiling less often, but in the PDF I get a better overview and I'm not yet familiar with all the power of AUCTeX's navigation and search features, unfortunately. –  Martin Jan 5 at 7:21
I wouldn't say "compiling less often" should be a goal /per se/. On the contrary, I know several places where it is advised to compile as often as possible, as it makes debugging easier. But then again, I'm not using preview, and I understand it may change that experience. –  T. Verron Jan 5 at 9:05
For me compiling less often is also not the main goal, especially as I also find it easier to find the source of errors, when compiling after small changes, but as 1 pdflatex run for my whole thesis takes >2 minutes, with latexmk it takes even 4..5 minutes .. that interrupts the workflow. –  Martin Jan 5 at 10:32

After digging in the customization options of the preview mode, I can suggest the following solution. Since I can't get preview to work due to other problems, I couldn't test it.

So, M-x customize-group RET preview RET. Select Preview Latex.

Now, you have to find the two following configuration options :

• Preview pdf2dsc command : replace %s.pdf with %s-preview.pdf.
• Preview Latex command : in the first string, insert -job-name='%s-preview' between %'%l and "\nonstopmode....

Screenshots of the relevant options with their default values (in case anything goes wrong):

-
thanks, that looks very promising! I made the 2 changes you proposed, tried to make a preview for "region" and it ended (not successfully) with the error Preview-PDF2DSC exited abnormally with code 1 at Sun Jan 6 12:32:27 PDF2DSC sentinel: Opening input file: no such file or directory, /mypath/_region_.prv/tmp17447LlO/preview.dsc –  Martin Jan 6 at 11:35

The problem (I think, since it used to plaque me as well), is that AUCTeX uses the most recent process because it presumes that's what you are interested in. However, I am very rarely interested in the output of preview. I added

(defadvice TeX-view (around always-view-master-file activate)
(let ((TeX-current-process-region-p nil))

to my .emacs so that whenever I view it thinks that the last command was not on a region. This has fixed the problem for me.