1

Yesterday, out of the blue, my emacs+auctex configuration stopped working and I started getting the following error when trying to do pdflatex, "Latex: problems after [0] pages".

Hitting Ctrl+C+L I see

Running `LaTeX' on `final' with ``pdflatex -synctex=1 -file-line-error %(extraopts) --synctex=1 -interaction=nonstopmode "\input" /home/mdn/research/final.tex''
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `pdflatex -synctex=1 -file-line-error %(extraopts) --synctex=1 -interaction=nonstopmode "\input" /home/mdn/research/final.tex'

I have not been able to figure out a solution. Actually, after updating my system (to Fedora 21) my emacs has started to act a bit weirdly, with several minor glitches. If anybody could share a working, minimal, synctex-enabled .emacs file I'd greatly appreciate it.

  • 1
    Welcome to TeX.SX! Does the file compile if you run pdflatex from the command line? i.e. outside emacs? If not, we'll need a minimal working example (MWE). If so, we need to know so. – cfr Mar 10 '15 at 1:09
  • 1
    @cfr Take a look at that command line. %(extraopts) hasn't been 'interpolated' (or however you want to explain the idea). It's like an extended format code (%s, %d, %p, and the like) – emacs uses it for search/replace for this type of stuff. You'll note that sh is the program throwing the error – the shell can't even parse the command it's being given :) – Sean Allred Mar 10 '15 at 1:13
  • What is the value of TeX-expand-list for you? Also, provide the result of evaluating (TeX-command-expand "%(extraopts)" "test.tex"). – Sean Allred Mar 10 '15 at 1:17
  • @SeanAllred I don't know emacs. For all I know, it figures out the command to run from directives given in the .tex file. Of course, if you then used something different to compile at the command line you'd mask the error. But, as I say, I've never used emacs. (OK, once.) – cfr Mar 10 '15 at 1:19
  • 1
    @cfr Lists! Lists everywhere! :) And no worries – it was a reasonable request for clarifying information :) – Sean Allred Mar 10 '15 at 1:21
7

I would search your init files for references to TeX-expand-list. It's possible you're removing the value, though it seems unlikely.

Next, try updating AUCTeX (M-x list-packages) and restarting Emacs. Might be that simple.

If all else fails, try sticking this in your .emacs:

(add-to-list
 'TeX-expand-list
 (list "%(extraopts)"
       (lambda nil TeX-command-extra-options)))

This makes the extraopts key available to TeX-expand-command.

  • Adding the code you suggested to my .emacs worked, thanks! – Muad Nu Mar 10 '15 at 20:09
1

I had the same problem. Turned out that Emacs did not have the PATH to the 'latex' and 'pdflatex'. Just add the following to your .emacs file:

(setenv "PATH" (concat (getenv "PATH") ":/usr/texbin/"))
  • Sorry, instead of ":/usr/texbin/" give your own path. – Racoon May 31 '15 at 20:50
  • That path will be pretty much constant on UNIX-based systems. Do you mind if I make the code a bit more general? – Sean Allred May 31 '15 at 21:49
1

I experimented the same issue after an upgrade to Ubuntu 16.04. In my case deselecting the option "Generate PDF" under the menu Command >> TeXing Options solved the issue.

  • 1
    That will turn off the use of pdflatex which is not what the OP is asking for. – Andrew Swann Aug 31 '16 at 9:12
  • I'm not a expert. Nevertheless in my case pdflatex is the command to invoke with C-c C-c in emacs+auctex. Turning off the pdflatex mode solved the issue. – mescal Sep 2 '16 at 15:08

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.