TeX errors are conventionally marked by the sequence <LF>!<SPACE>… in log files. However, sometimes one can accidentally get this sequence of characters in a log file even if no error occured. For example, consider this LaTeX document test.tex:


    echo This is a sentence that accidentally ends in an exclamation mark!
        This is problematic.

Running with pdflatex -shell-escape test.tex, the following appears in the log file:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) (preloaded format=pdflatex 2016.9.6)  7 SEP 2016 01:07
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
LaTeX2e <2016/03/31> patch level 3
… (removed for brevity)
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
runsystem(echo This is a sentence that accidentally ends in an exclamation mark
! This is problematic. )...executed.


(./test.aux) ) 
Here is how much of TeX's memory you used:
… (removed for brevity)

Notice the line that says ! This is problematic. )...executed.. My LaTeX editor (TeXStudio) received a bug report with just this problem a while ago, but apparently decided against trying to distinguish these cases in its log file parsing, so I’m getting false-positive errors during my LaTeX runs. But this is not just about TeXStudio: I’m certain that many log-parsing tools would show this case as a false positive.

Now, my idea for the specific case of \write18 was to insert linebreaks in the argument, but I don’t know how/if this is possible. Another possibility would be to change my configuration (texmf.cnf) to avoid the forced linebreaks inserted by TeX into the log file, but the file /usr/share/texlive/texmf-dist/web2c/texmf.cnf that came with my installation of TeX Live 2016 warns about error_line, half_error_line and max_print_line: “It's probably inadvisable to change these.”. Moreover, since I’m collaborating with others, I’d like to avoid having to tell all of them that this is not an actual error and how to change their configuration.

So, how can I avoid these fake errors considering my situation?

  • Easier than adding linebreaks: add spaces at the beginning of the argument of \write18 to shift where the automatic linebreak is put. Provided you don't have too many ! that should be doable. Where do these arguments of \write18 come from? – Bruno Le Floch Sep 7 '16 at 0:32
  • 1
    also you could use the --file-line-error command line option so errors do not use ! – David Carlisle Sep 7 '16 at 6:53
  • @BrunoLeFloch Unfortunately, that is not an option because the text surrounding the exclamation marks does not have a fixed length (a file path is involved) – there is no fixed amount of spaces that would guarantee to put the linebreaks in the correct places. The \write18 comes from the pullquote package (which needs ImageMagick): bazaar.launchpad.net/~tex-sx/tex-sx/development/view/head:/… – Socob Sep 7 '16 at 14:08
  • @DavidCarlisle Well, then I only get the false positives and none of the real errors! (I don’t think TeXStudio can be made to parse errors in that format.) – Socob Sep 7 '16 at 14:14
  • @Socob I know nothing about texstudio, but it's ironic in that file-line-error option was introduced to make it easier for editors to parse the log (as it's more like the error messages from language compilers:-) – David Carlisle Sep 7 '16 at 14:16

Your Answer

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

Browse other questions tagged or ask your own question.