Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
1  
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
add comment

1 Answer

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)
                 (doc-view-mode)))"
             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
add comment

Your Answer

 
discard

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.