![当使用包含 $&? 的文件名时出现 kpathsea 警告](https://linux22.com/image/417900/%E5%BD%93%E4%BD%BF%E7%94%A8%E5%8C%85%E5%90%AB%20%24%26%3F%20%E7%9A%84%E6%96%87%E4%BB%B6%E2%80%8B%E2%80%8B%E5%90%8D%E6%97%B6%E5%87%BA%E7%8E%B0%20kpathsea%20%E8%AD%A6%E5%91%8A.png)
陛下,test.tex
:
\documentclass{article}
\begin{filecontents*}{A$&1file.tex}
Hello, World!
\end{filecontents*}
\begin{document}
\input{A$&1file.tex}
\end{document}
MWE 不包含对 的调用\write18
。
该文件名A$&1file.tex
适用于许多文件系统。
尽管如此,编译 MWE 会向控制台发送以下警告两次(一次是在处理 -environment 时filecontents*
;一次是在处理\input
-command 时),但不会向 .log 文件发送:
warning: kpathsea: A$&1file.tex: Unrecognized variable construct `$&'.
为什么?
此行为是否记录在案?这是一个错误吗?
(除了这些警告之外,一切似乎都编译正常。
生成的.pdf 文件和辅助文件看起来符合我的预期。)
以下是控制台的输出:
$ pdflatex -shell-escape test.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2018-12-01>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))warning: kpathsea: A$&1file.tex: Unrecognized variable construct `$&'.
LaTeX Warning: Writing file `./A$&1file.tex'.
(./test.aux)warning: kpathsea: A$&1file.tex: Unrecognized variable construct `$&'.
warning: kpathsea: A$&1file.tex: Unrecognized variable construct `$&'.
(./A$&1file.tex) [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.
map}] (./test.aux) )</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/
cm/cmr10.pfb>
Output written on test.pdf (1 page, 12015 bytes).
Transcript written on test.log.
这是.log文件:
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=pdflatex 2020.2.13) 21 JUL 2020 00:35
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2018-12-01>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
LaTeX Warning: Writing file `./A$&1file.tex'.
\openout15 = `A$&1file.tex'.
(./test.aux)
\openout1 = `test.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 7.
LaTeX Font Info: ... okay on input line 7.
(./A$&1file.tex) [1
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux) )
Here is how much of TeX's memory you used:
204 strings out of 494412
2170 string characters out of 6172415
55258 words of memory out of 5000000
3979 multiletter control sequences out of 15000+600000
3640 words of font info for 14 fonts, out of 8000000 for 9000
59 hyphenation exceptions out of 8191
23i,4n,17p,112b,314s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/share/
texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on test.pdf (1 page, 12015 bytes).
PDF statistics:
12 PDF objects out of 1000 (max. 8388607)
7 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
答案1
看来你从\openin
\message{in }
\immediate\openin5="A$&1file.tex"
\message{out }
\immediate\openout5="A$&1file.tex"
\immediate\write5{zzz}
\immediate\closeout5
\bye
生产
in warning: kpathsea: A$&1file.tex: Unrecognized variable construct `$&'.
out )
\ifeof
latex在检查是否覆盖文件时会进行 openin 检查。
我认为值得向 texk 列表报告。