[Tex/LaTex] Always need to manually enter filename when file not found (e.g. “epigraph.sty” not found)

auxiliary-filesepigraphspackages

I'm using the "epigraph" package for epigraphs at the beginning of my chapters. Every time I try to compile it always says

LaTeX Error: File "epigraph.sty" not found.

Then it prompts me to put a file name. I put "epigraph.sty" and it worked!

I tried to use the

$ texhash

command in the directory where my tex files are located.
It says my directory is not writable.
So seems like it will always raise this error and I have to manually enter the file name every time…which is certainly less desirable.

Best Answer

I can reproduce the effect described as follows

\documentclass{article}

\usepackage{epigraph​}

\begin{document}

\end{document}

produces the terminal output:

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: 

If you enter epigraph.sty it completes as

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.

The reason here is a control character in the file:

the line

\usepackage{epigraph​}

is

  U+005c REVERSE SOLIDUS     &bsol; \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     &lcub; &lbrace; \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     &ZeroWidthSpace; &NegativeVeryThinSpace; &NegativeThinSpace; &NegativeMediumSpace; &NegativeThickSpace;
  U+007d RIGHT CURLY BRACKET     &rcub; &rbrace; \rbrace

with a spurious U+200B zero width character, such a character can not be seen but makes the file name not match, so requiring you to enter a "clean" version. Just deleting the line and retyping it with just the visible ascii characters produces

\documentclass{article}

\usepackage{epigraph}

\begin{document}

\end{document}

which runs without error

$ 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.
Related Question