Take the 2-minute tour ×
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 use this function to compile my latex documents in gVim with arara:

function! CompileTex()
    silent write!
    call setqflist([])
    echon "compiling with arara ..."
    exec "lcd %:h"
    setlocal makeprg=arara\ -v\ %
    silent make!

    if !empty(getqflist())
        copen
        wincmd J
    else
        cclose
        redraw
        echon "successfully compiled"
    endif
endfunction

And have the following mapping to call it:

nnoremap <buffer> <F6> :call CompileTex()<CR>

I use Latex-Box in order to parse and filter the tex build output nicely. Everything works fine (arara is really awesome) but there is one thing that I would like to know if it can be improved. Suppose I have the following document:

\documentclass{article}

% arara: pdflatex: {synctex: yes, action: nonstopmode, options: "-file-line-error-style"}
% arara: bibtex
% arara: pdflatex: {synctex: yes, action: nonstopmode, options: "-file-line-error-style"}
% arara: pdflatex: {synctex: yes, action: nonstopmode, options: "-file-line-error-style"}

\begin{document}

\section{Foo}
\label{sec:foo}
\ref{sec:foo}

\end{document}

As you can see in the image, when I compile the document the quickfix window (showing errors and warnings) shows the warning of the first call to the compiler (which goes away after compiling again). Is there some way to tell arara to ignore warnings until the last call?enter image description here.

Note: i) I know I can just add one directive and avoid the problem but this is just a MWE of what happens in larger documents. ii) If this question doesn't belong here please delete it (I actually posted it in arara's github issues but received no answer yet).

Edit: I would (also) like to know if the compilation time can be reduced by telling arara to run pdftex only once and only perform successive runs if they are really needed (for instance to correct cross-references).

share|improve this question
    
I am pretty sure arara ignores the warnings because you need to jump through hoops to make arara parse the log file: tex.stackexchange.com/questions/131728/… –  StrongBad Sep 16 '13 at 16:20
    
If gVim uses the console output to get the warnings, then you could try action: batchmode for the first runs. –  Heiko Oberdiek Sep 16 '13 at 19:24
    
@HeikoOberdiek gVim does use the console output to get warnings. I like your idea of using action:batchmode, however I would also like for the compiler to stop in the first run if (and only if) errors were encountered (while ignoring warnings). Is that possible? –  petobens Sep 16 '13 at 19:49
    
@petobens: Also nonstopmode does not necessarily stop at the first error. You would need scrollmode. It includes console output with the warnings again. –  Heiko Oberdiek Sep 16 '13 at 20:06
    
@HeikoOberdiek I know that nonstopmode doesn't stop at the first error but I was wondering whether arara could stop on the first run if there were errors and only continue with the following runs if no errors were found. Can the -halt-on-error be used in the first run? In fact I would like to know if arara can only perform the successive runs if they are really necessary, but I think that this is a feature that Paulo plans to introduce in arara 4. –  petobens Sep 16 '13 at 20:12

1 Answer 1

up vote 5 down vote accepted

gVim does use the console output to get warnings according to petobens' comment. Then the console output can then be suppressed using action: batchmode for the first runs. Also option draft: true would be useful, because it suppresses the not yet needed PDF output file (but the auxiliary files are written).

And indeed option --halt-on-error stops at the first error, it can be specified by options: "--halt-on-error".

If (pdf)TeX runs into an error, then (pdf)TeX sets the exit code different from zero. Arara does not check any .log files or the console output of the command. It only checks the exit code of the program. If it is zero, it assumes the running of the program was successful and continues with the next directive. Otherwise arara aborts the job with "FAILURE" and does not execute the next directives.

Example for the arara directives in this case:

% arara: pdflatex: {synctex: yes, action: batchmode, draft: yes, options: "-halt-on-error -file-line-error-style"}
% arara: bibtex
% arara: pdflatex: {synctex: yes, action: batchmode, draft: yes, options: "-halt-on-error -file-line-error-style"}
% arara: pdflatex: {synctex: yes, action: nonstopmode, options: "-halt-on-error -file-line-error-style"}
share|improve this answer
    
Now that I read your answer I think I understood (once again correct me please): there is no need for me to add the option -halt-on-error if what I really want is arara to stop in the first directive when there are errors and print those (multiple) errors into the console so I can fix them. I only need to add the option if I want to stop on each error. –  petobens Sep 17 '13 at 4:16
    
Are there other ways to speed up the compilation process besides the draft option. Do I need to enable the synctex option in the first two runs? –  petobens Sep 17 '13 at 4:54
    
There is a follow-up question that asks exactly the same thing I asked you in my previous comment so now I can accept your answer. –  petobens Sep 18 '13 at 17:32

Your Answer

 
discard

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.