Hi Tassilo:

On 2/24/2014 12:48 AM, Tassilo Horn wrote:
Nikolaus Vonessen <[email protected]> writes:

Hi Nikolaus,

I used to use latex to generate dvi files, but am now switching to
pdflatex.  Often, I create new files based on older ones.  Some older
latex files, in particular ones involving graphics, do not compile
correctly using pdflatex.  Therefore, it would be very useful to be
able to switch, on a per-buffer-basis, between compiling between
ordinary latex and pdflatex, and in both cases using the appropriate
TeX-source-correlate-method (source-specials for dvi, synctex for
pdf).  The problem is that, according to the documentation of
TeX-source-correlate-method:

      Setting this variable does not take effect if TeX Source
      Correlate mode has already been active.  Restart Emacs in this
      case.

Restarting emacs is rather drastic if one wants to work with two files
at the same time.

Is there a way to get around this?
I did some experimentation, and it seems you can work around this
limitation when you set the active correlate method using a file local
variable in the documents that need it.

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-PDF-mode: nil
%%% TeX-source-correlate-method-active: source-specials
%%% End:

This works great!  Thanks, Tassilo!

Since I prefer not to change old files by appending file local variables, I incorporated your suggestion into a function which I define in my .emacs, and which I can run in a
buffer as needed:

   (defun my-switch-to-dvi ()
      "Makes LaTeX create dvi documents with source-specials"
      (interactive)
      (setq TeX-PDF-mode nil)
      (set (make-local-variable 'TeX-source-correlate-method-active)
           'source-specials))

Thanks again!

Nikolaus






_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to