If PDFLaTeX fails to compile with

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help.

I want to press e to get an instance of Emacs. The cursor should be on the position of the error (if TeX knows it)

I guess I should insert

export TEXEDIT="emacs magic"

to my .bashrc but what should I type instead of magic?

2 Answers 2


Since I have always an emacs open (with an emacs server active), I personally have this

export TEXEDIT="emacsclient --no-wait +%d %s"

which makes sure that you do not open tons of emacs windows around. Otherwise, just use

export TEXEDIT="emacs +%d %s"

Both versions make emacs go to the right line.

It is important to have no space left and right of the = sign.


Useful. You can somewhat "unify" the two solutions as emacsclient has a fallback editor in case the (emacs) server is not running:

export TEXEDIT="emacsclient --alternate-editor=emacs --no-wait +%d %s"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .