TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a document in LaTeX. The document is divided in .tex documents and compiled using a Makefile.

My question is, could I see the dvi/PDF for the section of the document that I'm already writing in an Emacs buffer? I mean: dividing the Emacs window in two buffers using C-x 3, with one buffer with the document and the other with the preview of the document (and sync with the changes I'm introducing on it if possible). When I try to do that the only thing I get is a floating window with the document, in another program.

share|improve this question
I'd second the exhortation in the answer not to do this: the built in PDF reader in emacs is not very good. Most modern OSs will have a method to have a window "snap to" half the screen: have emacs in one half and a pdf viewer in the other. Then you don't need to even do "view" since the pdf should update automatically... – Seamus Oct 12 '11 at 14:13
up vote 3 down vote accepted

I'm not sure you'll be happy with the results (I'm not), but if you have DocView mode properly installed (it's part of Emacs 23), you can use it by adding

(alist-set 'TeX-command-list "View"
           '("(lambda ()
               (let ((f \"%o\"))
                 (find-file-other-window f)
             TeX-run-function nil t))

to your .emacs. I don't think DocView can do forward or inverse searching which means that you'll have to search for the correct page yourself—unlike using an external viewer. Also zooming and searching are inferior to a capable external viewer.

This will completely overwrite the regular View method, so you will not be able to use an external viewer without removing it from your .emacs and restarting. You could of course change the normal View command to have a different name, thereby preserving the capability. This is left as an exercise to the reader. :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.