pdftex can't handle tilde (~) in a file name
MiKTeX source code moved to GitHub
Brought to you by:
csc
Using windows 10 (64 bit) and miktex 2.9.6069 (32 bit)
Trying to compile a tex file while in this directory: "c:\temp\~foo":
$ texify --pdf file.tex This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9) entering extended mode ! I can't find file `C:/Temp/'. <to be read again> \protect <*> C:/Temp/~ foo/file.tex Please type another input file name:
However, using pdflatex, it works fine:
$ pdflatex file.tex This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9) entering extended mode (file.tex LaTeX2e <2016/03/31> patch level 3 <rest of successful compile omitted>
If I change the directory name to "c:/temp/foo", then both texify and pdflatex work fine.
Clearly, texify is parsing the "~" incorrectly in the path.
pdftex does not like
~
in file name. If you try this:then you will see that it is a pdftex related bug.
OK- cool. Thanks.
There was a discussion about tildes in files names on the texlive list in 2014. At that time I made some tests and it worked with miktex http://tug.org/pipermail/tex-live/2014-June/035503.html.
Beside this I wonder why texify uses the complete path of the file instead of calling only "pdflatex file".
Edit: It is possible that the test in 2014 was made with tildes from "short file names (8.3)". This names still work in miktex:
(but texify fails)
Last edit: U_Fischer 2016-10-19
There was also a discussion concerning this in the Texinfo texi2dvi tool.
See texi2dvi revision 7199.
It is possible to work-around this problem and have pdftex/pdflatex eat a ~ or a number of other funny characters in the filename. The only special character that is impossible to handle is the whitespace.
The trick in texi2dvi was to recatcode the funny characters in the filename (including ~) within a group, and then expand the \input filename after the group.
So OK, even if there is some pdftex limitation, texify could work-around it using the same method as texi2dvi does.