[OS X TeX] Spaces in file or folder names

Piet van Oostrum piet at cs.uu.nl
Sun Feb 13 14:59:50 EST 2005

>>>>> Peter Dyballa <Peter_Dyballa at Web.DE> (PD) wrote:

>PD> Well, thinking of the computing power of recent CPUs, this law should
>PD> really be easily obeyed. So why is TeX not capable in its I/O routines to
>PD> scan a directory, get its file contents, and grep in this set for a
>PD> character string with spaces or other so-called strange characters? Since
>PD> there are limitations in this simple wish it should work to find a safe
>PD> translation for 'unsafe' characters (that could work in both directions too
>PD> if needed):

What sense does it make to grep a directory listing?


>PD> (as you can find in 'man readdir' too). But it's in TeX: TeX has problems
>PD> to handle the more complicated file names. So why not map a read channel,
>PD> analogous to \write16 etc, to a file descriptor as used in the C source
>PD> code, an abstract item of a very simple name? The log file writing routine
>PD> would then substitute the file descriptor with its associated file name as
>PD> contained in the dirent struct to make its output readable for us humans

I don't think TeX has problems with complicated filenames.
The only problem with filenames with spaces (which is the topic of the
current thread is that in the original plain TeX, the way to input a file

\input filename

Now this syntax must know where the filename ends. Knuth took whitespace as
the delimiter. The original O.S. on which he developed TeX did not have
filenames with spaces, I think. Anyway, this is system dependent stuff and
each implementation is free to substitute it with something which is more
suitable for its platform. Therefore some platforms have possibilities with
filenames between quotes. I think that might cause problems with filenames
that have both spaces and quotes, but these are supposed to be rare. You
will always have this kind of problem if there isn't a clear distinction
between the data and the meta level. Even if Knuth would have chosen for
the LaTeX syntax \input{filename} there would be problems with filenames
with unmatched braces.

In a GUI there is a clear separation between the filenames and the meta
level (the GUI textbox or filename browser) so there you don't have the
problem. Once the filename is inside TeX, TeX shouldn't have any problem
opening it.
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: piet at vanoostrum.net
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

More information about the MacOSX-TeX mailing list