5

When compiling with pdflatex and using the file-line-error option if I have a long pathname and there is an error, that error is split at 80 characters in the log file (see image below)

Is one (or both) of the following items possible?

i) force pdflatex to just print the error using the base name (in my example notas_tdm.tex) and not the full path?

ii) force pdflatex to show the error message ("Undefined control sequence") in the same line as the (long) file name and line number

enter image description here

Edit: One way to reproduce this behaviour is to use MiKTex on Windows and then write the following MWE in C:\Users\Pedro\Desktop\foo\bar\baz\a_very_long_directory_name\blah.tex:

\documentclass{article}
\begin{document}

\error
\end{document}

Running pdflatex -file-line-error blah.tex gives the error

C:\Users\Pedro\Desktop\foo\bar\baz\a_very_long_directory_name\blah.tex:4: Undef
ined control sequence

and the full log is:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) (preloaded format=pdflatex 2014.2.27)  8 AUG 2014 14:43
entering extended mode
**blah.tex
(C:\Users\Pedro\Desktop\foo\bar\baz\a_very_long_directory_name\blah.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic, 
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2013-05-26, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2013-05-26, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
ishmax, welsh, loaded.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
No file blah.aux.
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
C:\Users\Pedro\Desktop\foo\bar\baz\a_very_long_directory_name\blah.tex:4: Undef
ined control sequence
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

(C:\Users\Pedro\Desktop\foo\bar\baz\a_very_long_directory_name\blah.aux) ) 
Here is how much of TeX's memory you used:
199 strings out of 493921
2366 string characters out of 3144876
49031 words of memory out of 3000000
3582 multiletter control sequences out of 15000+200000
3640 words of font info for 14 fonts, out of 3000000 for 9000
841 hyphenation exceptions out of 8191
23i,1n,17p,128b,36s stack positions out of 5000i,500n,10000p,200000b,50000s

No pages of output.
PDF statistics:
0 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
petobens
  • 3,306
  • the error messages are generated within the tex engine, which is where the 80-character split occurs, so this may not be possible. however, if you have the entire path specified in the \input or \include statement, you might try moving the path to a separate \pathname statement. – barbara beeton Aug 08 '14 at 16:35
  • That message looks short of some detail: is it exactly what TeX produces (e.g. the same as you get from less <filename>.log)? Could you copy-paste the appropriate part of the .log ile into the question? – Joseph Wright Aug 08 '14 at 17:36
  • @JosephWright See updated question please. Thank you – petobens Aug 08 '14 at 17:48
  • Oh yes, I should've said that I'm using Miktex (I've edited the question to reflect this now). Is it possible to show the relative path with MiKTeX? – petobens Aug 08 '14 at 18:34
  • This seems to be MiKTeX-specific: more generally, it adds full paths to the log whereas TeX Live gives relative paths. There's no obvious option to control this: perhaps a feature request might be required? – Joseph Wright Aug 08 '14 at 18:52
  • @JosephWright If it is really MiKTeX-specific and there is no option to control it then I''ll send a request. However I would like to be completely sure that it is indeed MiKTex-related and there is no possible workaround. – petobens Aug 08 '14 at 19:16
  • Related/duplicate: http://tex.stackexchange.com/questions/4047/write-to-log-without-wrapping. See also http://tex.stackexchange.com/questions/83600/how-can-i-use-max-print-line-in-pdftex-texlive – egreg Aug 08 '14 at 21:14
  • @egreg Thanks! Setting !pdflatex -file-line-error -max-print-line=120 effectively works!! How I can pass those options if I use arara? I tried % arara: pdflatex: {action: batchmode, draft: yes, options: "-file-line-error-style -max-print-lines=120"} but I doesn't work. Can you please post an answer? Thanks again. – petobens Aug 08 '14 at 21:31
  • @petobens Sorry, but I know nothing of MiKTeX (and I can't try). – egreg Aug 08 '14 at 21:43
  • @egreg That's okay. Do you know (or can directly ask Paulo Cereda) how to pass those two options to arara? I know how to pass a single option by doing: % arara: pdflatex: {action: batchmode, draft: yes, options: "-file-line-error-style"} but the problem arises when I try to add the second option (-max-print-lines). Thanks agains Thanks for the help again? – petobens Aug 08 '14 at 21:51
  • As an alternative workaround for this problem in Linux you can pipe the output of pdflatex to awk '{ printf("%s",$0); if ( length()!=79 ) printf("\n"); }' to "unsplit" these lines. I'm using this with AUCTeX and emacs compile mode to interpret file:line:error syntax. – Jaap Eldering Aug 08 '14 at 22:10
  • @egreg I had a typo, I was writing max-print-lines instead of max-print-line. If you want to answer that both pdflatex -file-line-error -max-print-line=120 and (if arara is used) % arara: pdflatex: {options: "-file-line-error -max-print-line=120"} solve my problem then I''ll accept the answer. – petobens Aug 08 '14 at 23:33
  • @egreg If you want me to answer the question (I understand you might not want to answer something that you cannot test) then I'll do it. Just let me know. Thanks again for the help. – petobens Aug 09 '14 at 17:11
  • @petobens Make an answer yourself; note that the option cannot be used with TeX Live, but only with MiKTeX. – egreg Aug 09 '14 at 17:14

1 Answers1

3

If one is using MiKTeX then the following can be used when compiling with pdflatex:

pdflatex -file-line-error -max-print-line=120

Note that this will not work with TeX Live.

Thanks to @egreg who gave me this answer in a comment.

petobens
  • 3,306