[OS X TeX] Spaces in file or folder names

Aditya Dushyant Trivedi atrivedi2 at student.gsu.edu
Thu Feb 10 18:55:07 EST 2005


On Thu, 10 Feb 2005 17:30:20 +0100 Maarten Sneep <maarten.sneep at xs4all.nl> wrote:

>> Eddy wrote:
>> I have used files and folders with spaces in it (for LaTeX) on Windows 
>> with no problem (On windows I use MiKTeX). I have never had a problem.

>I would consider that a hack. Plain TeX uses a different \input, there 
>you type "\input filename " (obviously without the quotes). To in plain 
>tex (and context for that matter), the filename is delimited by white 
>space. That is a fundamental issue. The issue can be resolved in part 
>through patch files (file handling needs to be patched this way in any 
>case for a new platform), but the portability issue is still there. The 
>fact that you never had a problem with it, may depend on your usage of 
>(La)TeX.

[...]

>I'd say it is a TeX issue, in that plain tex may have issues with it. 
>Besides: you want your sources to be portable across platforms, and in 
>that case avoiding spaces makes life a lot easier.

>Combine the above with the fact that you're likely to use a long list 
>of other Unix based utilities, and you'll quickly reach the conclusion 
>that spaces are not your friend. Besides: the people who actually have 
>the skills to come up with something resembling a solution (a hack at 
>best), do not consider the space issue to be important at all (the 
>issue periodically comes up on comp.text.tex, and is usually dismissed 
>with: don't bother, just don't use spaces).

I agree with your advice. Having spaces in file names atleast compromises on portability.

I just installed thet latest version of gwTeX (2004 Stable). I was going through the teTeX Manual located in
/usr/local/teTeX/share/texmf/doc/tetex/tetexdoc.pdf.
On page 13, section 4.2 Changes to web2c, third bullet it states:

The \input primitive in tex (and mf and mpost) now accepts double quotes containing spaces and other special characters. Typical examples: 

\input "filename with spaces" % plain 
\input{"filename with spaces"} % latex 

I got curious. Earlier I had trouble with spaces. I tried it again. I created the following files and saved it in the following path:

/Users/insattx/Desktop/test folder/test it.tex
/Users/insattx/Desktop/test folder/File with spaces.tex

%%Beginning of test it.tex%%%
\documentclass{article}
\input{"File with spaces.tex"}

\begin{document}
It seems that LaTeX works fine with spaces in folder names as well spaces in file names. LaTeX wasrun using TeXShop 1.35e. ``\mymacro{}" is defined in my input file.
\end{document} 

%%%End of file%%%

%%%Beginning of File with spaces.tex%%%
\newcommand{\mymacro}{\emph{It works!}} 
%End of file%%%

I ran it through LaTeX using TeXShop 1.35e. It handled it perfectly. 

So it seems that that LaTeX can handle spaces in file and folder names with teTeX 3.0 (maybe earlier). According to the manual plain tex handles spaces as well. I guess it is no longer a hack. :) 

I would still caution using spaces in filenames. Some packages and scripts may not handle them well.

Eddy

--------------------- 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