使用 pdflatex 时避免拆分/包装错误消息

使用 pdflatex 时避免拆分/包装错误消息

pdflatex使用file-line-error选项进行编译时,如果我有一个长路径名并且出现错误,则该错误将在日志文件中拆分为 80 个字符(见下图)

以下一项(或两项)有可能吗?

notas_tdm.texi)强制 pdflatex 仅使用基本名称(在我的示例中)而不是完整路径打印错误?

ii)强制 pdflatex 在与(长)文件名和行号相同的行中显示错误消息(“未定义的控制序列”)

在此处输入图片描述

编辑:重现此行为的一种方法是在 Windows 上使用 MiKTex,然后在中写入以下 MWE C:\Users\Pedro\Desktop\foo\bar\baz\a_very_long_directory_name\blah.tex

\documentclass{article}
\begin{document}

\error
\end{document}

运行pdflatex -file-line-error blah.tex会出现错误

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

完整日志如下:

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)

答案1

如果使用 MiKTeX,那么在编译时可以使用以下内容pdflatex

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

请注意,这不适用于 TeX Live。

感谢@egreg 在评论中给了我这个答案。

相关内容