Spaces in path when using \input

2,116 views
Skip to first unread message

drorata

unread,
Jul 6, 2009, 4:09:39 AM7/6/09
to LaTeX Users Group
Dear all,

I am trying to add some external .tex file with bunch of commands at
the beginning of my main .tex file. For example:
\input{/location/of_the/foo}

I couldn't use spaces in the path of "foo.tex", that is: \input{/
location/of the/foo} does *not* work.

Does anyone has an idea how to handle this issue?

Thanks in advance,
Dror

jon

unread,
Jul 6, 2009, 4:04:03 PM7/6/09
to LaTeX Users Group
1. avoid using spaces in file or directory names.
2. move the file you want to input into the working directory of the
master file.
3. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=docotherdir

cheers,
jon.

Peter Flynn

unread,
Jul 6, 2009, 5:50:44 PM7/6/09
to latexus...@googlegroups.com

Never use spaces (or other odd characters) in directory or file names.
They make your teeth and hair fall out, start nuclear wars, and stop the trains running on time. Stick to A-Z, a-z, 0-9, ".", "-", and "_" for best results.

///Peter

Peter Flynn

unread,
Aug 16, 2012, 11:50:59 AM8/16/12
to latexus...@googlegroups.com
On Wed, Aug 15, 2012 at 10:28 PM, ofey <shane...@gmail.com> wrote:

I also have this problem. I can't believe that spaces in directory names can't be handled by LaTeX.

Why not? It's standard on all systems, I don't know any command-line program that accepts them in the raw, because spaces are used to delimit arguments.

You do need to understand that there is a big difference between what happens when you click on something in a graphical interface like an editor, and what really happens underneath when the resulting command is passed to a shell for execution.
 
Is there really no way to deal with this other than changing my directory names?

Put the argument in quotes. Then the shell will see it as a single argument and pass it as such to TeX, eg

$ pdflatex "some long directory name with spaces/My Thesis (revised).tex"

///Peter

Reply all
Reply to author
Forward
0 new messages