[tex-k] About spaces in file names

Olaf Weber olaf at infovore.xs4all.nl
Fri Apr 22 17:26:55 CEST 2005

Jean-Marc Lasgouttes writes:

> Hello,

> We are in the process of porting LyX (www.lyx.org, a frontend to
> LaTeX) to windows, and of course we would like to be able to typeset
> files with spaces in their names. I understand that this is possible
> since web2c 7.5.3, but we still have problems with LaTeX and
> \includegraphics.

> In this case, it appears that files are referenced in the dvi file as
>     ...PSfile=""foo bar".eps" llx=...
> rather than
>     ..PSfile="foo bar.eps" llx=...

> The extra quotes break things like xdvi, yap, dvips and need to be
> removed by a post-processing script if the dvi file is to be useful.

> Is this a known limitation of this spaces handling? Are there known
> workarounds? 

Not a known limitation, but not unexpected either.

In this case, the problem really is that |\includegraphics| doesn't
know how to handle filenames with spaces (or quotes) in them: it will
allways wite PSfile="<filename>" in the special.  If <filename>
contains quotes, the PSfile special will be broken.  But if you want a
space in that filename, then it will have to be quoted before handing
it to TeX to read.  As far as I can tell, this is something that would
have to be fixed in the implementation of |\includegraphics|.

> We have a page on our wiki where we tried to investigate which
> characters are allowed and which are not here:
>   http://wiki.lyx.org/LaTeX/FilesWithSpecialChars

TeX does very little checking on filenames.  From the engine itself
you can expect problems with trying to put things like spaces, tabs,
newlines, double quotes, percent marks etc in filenames.  The
underlying OS may add more restrictions, and you can get into
additional trouble if (when) a filename is given to helper scripts.

> On a related note, is there documentation on the status of 8bit
> characters in file names?

None that I'm aware of.  It looks like it should work.

Olaf Weber

               (This space left blank for technical reasons.)

More information about the tex-k mailing list