Menu

#2535 pdftex can't handle tilde (~) in a file name

None
open
None
2017-07-18
2016-10-13
Doc Arigato
No

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.

Discussion

  • Christian Schenk

    • summary: texify can't handle tilde (~) in path --> pdftex can't handle tilde (~) in a file name
    • assigned_to: Christian Schenk
     
  • Christian Schenk

    pdftex does not like ~ in file name. If you try this:

    pdflatex C:\temp\~foo\file.tex
    

    then you will see that it is a pdftex related bug.

     
  • Doc Arigato

    Doc Arigato - 2016-10-18

    OK- cool. Thanks.

     
  • U_Fischer

    U_Fischer - 2016-10-19

    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:

    G:\Z-Temp\~foo>pdftex TEST-S~1
    This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9)
    entering extended mode
    (test-sort.tex
    

    (but texify fails)

     

    Last edit: U_Fischer 2016-10-19
  • Vincent Belaïche

    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.