68

Is it possible to tell the LaTeX command not to use line breaks in its console / log output?

This would make it easier to automate the processing of the log file, e.g. extracting the names of missing graphics files like in this output

! LaTeX Error: File `figures/triggers/muontriggers/notmu18_medium_mu10_loose/2d
map_abs_eta_phi.pdf' not found.

which are otherwise cut into pieces and unnecessarily difficult to grep etc.

1

2 Answers 2

66

You can modify the texmf.cnf variables error_line and max_print_line, adding to the "local" texmf.cnf file, whose location depends on the distribution you're using; for TeX Live it is

/usr/local/texlive/2021/texmf.cnf

and the lines to be added are

max_print_line=1000
error_line=254
half_error_line=238

The first number is actually arbitrary, but 1000 seems to be sufficient. The error_line variable must be less than 255 and the maximum value of half_error_line is less than error_line-15

For experimenting you can also set the variables in the environment; assuming a Bash shell,

export max_print_line=1000
export error_line=254
export half_error_line=238

You can find the location of the various texmf.cnf files, in the order they're looked at, by running

kpsewhich -a texmf.cnf

from the command line. On my system I get

/usr/local/texlive/2021/texmf.cnf
/usr/local/texlive/2021/texmf-dist/web2c/texmf.cnf

The “year part” in the path can and will vary according to the currently installed version of TeX Live.

5
  • 8
    export max_print_line=1000 works perfect for me. Thanks. Apr 26, 2012 at 14:41
  • 1
    For me too, but I had to include it to Makefile or bashrc. The texmf.cnf file seems to be ignored. Feb 28, 2015 at 17:40
  • 1
    This may be useful: export max_print_line=$(expr $(tput cols) - 1) (terminal-width - 1). Of course, the expr can be removed for full-width.
    – sivizius
    Jun 24, 2018 at 16:29
  • Is there a way of changing this through the setting menu in TeXStudio? Is there a way to locate the texmf.cnf file? It is not where you suggest it should be. (Ubuntu 20.04)
    – Kvothe
    Apr 19, 2021 at 13:06
  • 2
    @Kvothe You can do kpsewhich -a texmf.cnf in order to list all the texmf.cnf files in the order they're read in. Modify the first one to add the settings.
    – egreg
    Apr 19, 2021 at 13:09
19

In MiKTeX you can use the option --max-print-line=140 to get longer log lines. This will also affect the output in the command line window but only if have enlarged it before.

2
  • 1
    I couldn't find the text.mf file on Windows. I made it to work from Texworks. Just modified the max_print_line parameter from "C:\Program Files\MiKTeX 2.9\miktex\config\texmfapp.ini" file. Nov 8, 2016 at 23:40
  • texmfapp.ini could be also located in %LOCALAPPDATA%\Programs\MiKTeX\miktex\config\texmfapp.ini (if MiKTeX is installed in user mode)
    – faramir
    Mar 19, 2021 at 9:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .