我在章节开头使用“epigraph”包来添加题词。每次我尝试编译时,它总是说
LaTeX 错误:未找到文件“epigraph.sty”。
然后它提示我输入文件名。我输入了“epigraph.sty”,成功了!
我尝试使用
$ texhash
命令位于我的 tex 文件所在的目录中。它说我的目录不可写。所以似乎它总是会引发这个错误,我每次都必须手动输入文件名……这当然不太理想。
答案1
我可以重现如下所述的效果
\documentclass{article}
\usepackage{epigraph}
\begin{document}
\end{document}
产生终端输出:
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./ww775.tex
LaTeX2e <2017-05-01>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/home/davidc/texmf/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/home/davidc/texmf/tex/latex/base/size10.clo))
! LaTeX Error: File `epigraph.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
如果你输入epigraph.sty
它完成为
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./ww775.tex
LaTeX2e <2017-05-01>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/home/davidc/texmf/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/home/davidc/texmf/tex/latex/base/size10.clo))
! LaTeX Error: File `epigraph.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name: epigraph.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/epigraph/epigraph.sty
LaTeX Warning: You have requested package `epigraph',
but the package provides `epigraph'.
) (./ww775.aux) (./ww775.aux) )
No pages of output.
这里的原因是文件中的控制字符:
线
\usepackage{epigraph}
是
U+005c REVERSE SOLIDUS \ \backslash \textbackslash
U+0075 LATIN SMALL LETTER U u
U+0073 LATIN SMALL LETTER S s
U+0065 LATIN SMALL LETTER E e
U+0070 LATIN SMALL LETTER P p
U+0061 LATIN SMALL LETTER A a
U+0063 LATIN SMALL LETTER C c
U+006b LATIN SMALL LETTER K k
U+0061 LATIN SMALL LETTER A a
U+0067 LATIN SMALL LETTER G g
U+0065 LATIN SMALL LETTER E e
U+007b LEFT CURLY BRACKET { { \lbrace
U+0065 LATIN SMALL LETTER E e
U+0070 LATIN SMALL LETTER P p
U+0069 LATIN SMALL LETTER I i
U+0067 LATIN SMALL LETTER G g
U+0072 LATIN SMALL LETTER R r
U+0061 LATIN SMALL LETTER A a
U+0070 LATIN SMALL LETTER P p
U+0068 LATIN SMALL LETTER H h
U+200b ZERO WIDTH SPACE ​ ​ ​ ​ ​
U+007d RIGHT CURLY BRACKET } } \rbrace
带有虚假的 U+200B 零宽度字符,这样的字符无法看到,但会导致文件名不匹配,因此需要您输入“干净”的版本。只需删除该行并仅使用可见的 ascii 字符重新输入即可产生
\documentclass{article}
\usepackage{epigraph}
\begin{document}
\end{document}
运行没有错误
$ pdflatex ww775
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./ww775.tex
LaTeX2e <2017-05-01>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/home/davidc/texmf/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/home/davidc/texmf/tex/latex/base/size10.clo))
(/usr/local/texlive/2016/texmf-dist/tex/latex/epigraph/epigraph.sty)
(./ww775.aux) (./ww775.aux) )
No pages of output.
Transcript written on ww775.log.