After some research we determined this is a problem inherent to lualatex. If you have a solution for this problem in LuaLaTeX please post it below and I will accept you answer.

When compiling a file with LaTeX (and others), if there is an error one has the option to edit the file at the line of the error (or near) by pressing e + Enter.

For example, if one has this file


I get this

Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./main.aux)
! Undefined control sequence.
l.3 \badcommand

However, in my current configuration TeXLive 2015 (Fedora), nothing happens. I only get this message:

You want to edit file ./main.tex at line 81
 297 words of node memory still in use:
   3 hlist, 1 rule, 48 glue_spec, 1 write, 1 dir, 1 pdf_colorstack nodes
   avail lists: 2:12,3:1,6:2,9:1
No pages of output.
Transcript written on document.log.
prompt $_

How can I configure the editor? in particular Gedit.

(I am suspecting it tries to open emacs which is not installed, but still I would like to use Gedit instead).

  • On a unix-like system, including macosx, just set the TEXEDIT environment variable in your shell (e.g. in the appropriate one of .bashrc, .bash_profile, .cshrc, .zshrc etc). For example, I have export TEXEDIT="/usr/bin/gvim +%d %s" in .bash_profile. – Andrew Apr 19 '16 at 2:46
  • It doesn't work. Maybe there is some security option that disables execution from LaTeX. – alfC Apr 19 '16 at 3:04
  • You need to source the file or restart your shell before it takes effect. – Andrew Apr 19 '16 at 12:03
  • 1
    Note that it seems to think the error is in color.cfg. If so, it will fail because you can't edit that file as you don't have permission. In reality, that is not where the error is, but the compiler is not always able to work this out. Try with a simple example with a simple syntax error such that TeX clearly knows that the error is in your .tex file. – cfr Apr 19 '16 at 21:10
  • 2
    Have you looked through web2c/texmfcnf.lua? Near the end, it says, -- In an edit cycle it can be handy to launch an editor. The -- preferred one can be set here. but then it gives no indication how to set it. The next line concerns the PDF viewer and the previous one the OTF font loader. – cfr Apr 24 '16 at 1:34

If you are happy setting this system wide, you can edit the customisation into texmf.cnf but it is important to pick the correct texmf.cnf. Probably kpsewhich texmf.cnf should return the correct file. On my system, for TeX Live 2015, this is /usr/local/texlive/2015/texmf.cnf. Wherever it is, the file should be almost empty with just some explanatory comments at the top. Here's mine after adding the configuration line for the editor:

% (Public domain.)
% This texmf.cnf file should contain only your personal changes from the
% original texmf.cnf (for example, as chosen in the installer).
% That is, if you need to make changes to texmf.cnf, put your custom
% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than
% the distributed file (which is .../texlive/YYYY/texmf-dist/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
TEXEDIT = /usr/bin/vim +%d '%s'

You will need to add an appropriately modified

TEXEDIT = /usr/bin/vim +%d '%s'

to your file, as I just added this line to mine. After doing so, I can edit the file using e.

I am not sure why the default is not to use the system or user value of EDITOR. TeX simply ignores this on my system and tries to use an editor which doesn't exist, with inevitably unsatisfactory results. What it should do is use EDITOR if that's configured, but I can't even get the file to use the value of a shell variable, so probably this is a hopeless enterprise. Hence, I hard-coded it as shown above, which does work even though the solution is not really a satisfying one.

  • Thanks, but I put kpsewhich texmf.cnfwhich gives /usr/share/texlive/texmf-dist/web2c/texmf.cnf, edit the file and put line TEXEDIT = gedit +%d '%s' around line 656. Still it does nothing after I press e + Enter. Same thing happens with setting the environment variable. (also I have no /usr/local/texlive) – alfC Apr 19 '16 at 3:02
  • Editing that file isn't good. As I said, the file should be almost empty. I assume you're using your distro's packages for TeX Live and that complicates things. Apparently, they do not include the empty-but-for-comments copy of texmf.cnf which upstream provide. Probably you'd have to create it. (Maybe in /etc.) But likely the environment variable is a better option in this case. Try it first with a command-line editor to rule out issues opening an X11 window. – cfr Apr 19 '16 at 12:03
  • /usr/share/texlive/texmf-dist/web2c/texmf.cnf should be fine. It worked in the past for other options: tex.stackexchange.com/a/198631/1871 – alfC Apr 19 '16 at 18:19
  • The way TeX Live is currently configured, local changes are supposed to go into a different texmf.cnf file. Unless Fedora have changed this, you shouldn't put your changes into that file. – cfr Apr 19 '16 at 21:01
  • 1
    @alfC You're right. Same here. I don't think it is security: I think it is probably a bug. As you probably know, LuaTeX is much buggier, in general, than pdfTeX because it is changing a lot more. (Well, that's one reason. There are others....) The bug might be the text message - i.e. it isn't meant to offer the option - or it might be the behaviour - i.e. it is supposed to honour the option. – cfr Apr 20 '16 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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