Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to call latexmk in emacs, and jump to next-error
    primarykey
    data
    text
    <p>I would like to use <a href="http://www.phys.psu.edu/~collins/software/latexmk-jcc/" rel="noreferrer">latexmk</a> to compile my LaTeX documents in Emacs. Especially I need the Emacs functionality <code>next-error</code>, which is typically called with C-x `, and jumps to the next LaTeX error in the document.</p> <p>I would like to call <code>latexmk</code> either using <code>C-x compile</code> or the AUCTeX <code>C-c C-c</code>. </p> <p>First, I set <code>latexmk</code> to use</p> <pre><code>$pdflatex = 'pdflatex -interaction=nonstopmode'; </code></pre> <p><strong>Option 1: C-x compile</strong></p> <p>I press <code>C-x compile</code> and type <code>latexmk -pdf foo</code>, which runs <code>pdflatex</code>. But <code>next-error</code> will not jump to the errors, even if the *compilation* buffer contains errors:</p> <pre><code>! Paragraph ended before \author was complete. &lt;to be read again&gt; \par l.48 [...] Compilation exited abnormally with code 12 </code></pre> <p>How can I automatically jump to this error in line 48?</p> <p>Note that this question of parsing the latex output has nothing to do with <code>latexmk</code> directly. The same problem occurs when I just do <code>C-x compile pdflatex -interaction=nonstopmode foo</code>.</p> <p><strong>Option 2: AUCTeX</strong></p> <p>How can I set AUCTeX to call <code>latexmk -pdf</code> instead of <code>pdflatex</code> on my .tex file? Of course, I want <code>next-error</code> to work here too.</p> <p><strong>UPDATE:</strong> I started a <strong>bounty</strong> because if this worked it would be a great tool for many people. I consider the question answered if a solution is given that lets me easily compile my LaTeX document using <code>latexmk</code> in Emacs and jump to the errors using <code>next-error</code> (of course, the errors might be in <em>included</em> .tex files, not necessarily in the master file or the current buffer).</p> <p><strong>UPDATE:</strong> Thanks to Ivan (and Chris) for making AUCTeX+Latexmk work. In the meantime, I found that using <a href="http://www.pps.jussieu.fr/~beffara/soft/rubber/" rel="noreferrer">Rubber</a> to compile LaTeX is also an excellent choice. It will display error messages in the format used by <code>gcc</code> and other compilers, so it naturally works with Emacs <code>C-x compile</code>, e.g. <code>C-x compile rubber --pdf foo</code>, and the error messages are parsed correctly.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload