Sign up ×
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 want a similar layout as in SO, I use it currently as my editor but I would like to find such tool under my fingers. I am more vi-prone so having hard time to get preview-latex working with emacs. I don't know whether it is the right tool but I want to see things shortly after typing some long latex equations without compiling cycle. How can I preview LaTeX?

Ps. I am using obsd and ubuntu.

share|improve this question
The most used package for emacs to preview latex is AucTeX ( – M. Alaggan May 18 '11 at 3:54

4 Answers 4

up vote 18 down vote accepted

The most common package to preview text in Emacs is Preview TeX, a package now build into AUCTeX

It works with both latex and pdflatex. Within a LaTeX buffer, just type C-c C-p C-b, or within the menu do Preview->for buffer.

A simpler, but less effective alternative is to use the X-Symbol package:

This one only shows special symbols (such as math operators or greek letters), but not much more than that. This package also does not seem to be developed anymore.

share|improve this answer
For the preview to work in my case, I had to disable the pdf-mode. This can be done by: C-c C-t C-p – Dror Jun 1 '11 at 9:13
preview-latex is supposed to work in PDF mode as well. – user9588 May 12 '12 at 12:25
could some #Emacs guru help me to press "C-c C-p C-b" in the right spot? CTRL+c (hands up) CTRL+P (hands up) CTRL+b? I am using Emacs23 from aptitude, now in Debian. I wish videos, researching... – hhh Oct 13 '12 at 23:19
none of this works for me. I get error No file _region_.aux. – Nasser Feb 22 '14 at 13:06

Sorry, I don't know what SO is, but have you ever heard of latexmk? It re-runs pdftex or whatever every time you save your *.tex-file. Instead of preview I do:

  1. Open Emacs, C-x C-f => new file, type some skeleton of the LaTeX-file including \end{document}, save it (C-x C-s), compile it the first time (C-c C-c RET) and open it in the viewer (again C-c C-c RET).
  2. I open a command window (if you use Linux, you know what I mean, if you use windows, its cmd.exe), navigate into the folder containing my LaTeX-file and type latexmk -pvc -pdf filename.tex Then latexmk compiles my document and repeats that each time I save a new version inside Emacs.

If you employ a pdf-viewer which is able to reload the pdf from harddisk every time it changes (okular, evince, sumatra for windows . . .), you are very close to an instant preview.


share|improve this answer
This is great. However, in OSX, Preview (the program) does not update / refresh the PDF unless you have it active. I wonder if anyone came with a solution to it! – Amelio Vazquez-Reina Mar 15 '14 at 0:11
@user815423426 Nobody will see your question here. Please proceed as follows: a) Get a real nickname, user450328402398 is disturbing, sorry | b) search for OSX and latexmk, if no solution => c) ask a new question in this forum. – Keks Dose Mar 15 '14 at 11:54

Another option is LaTeX Preview Pane. It supports side by side editing and previews of your LaTeX document. It also supports error highlighting in your buffer, similar to flymake.

Emacs Wiki Page:

share|improve this answer
Is it possible to edit a single environment with LPP (e.g. a single equation)? – sebhofer Jan 29 at 18:01

I wrote some elisp to simplify compiling and viewing a latex file using pdflatex:

(defun reload-pdf ()
  (let* ((fname buffer-file-name)
        (fname-no-ext (substring fname 0 -4))
        (pdf-file (concat fname-no-ext ".pdf"))
        (cmd (format "pdflatex %s" fname)))
    (shell-command cmd)
    (other-window 2)
    (find-file pdf-file)

(global-set-key "\C-x\p" 'reload-pdf)

Now, instead of (C-c C-c RET) twice, you just need to type (C-x p RET), after you save the file.

Hope this helps!

share|improve this answer
Welcome to TeX.SX! – Adam Liter Feb 2 at 5:10

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.