Spaces in path when using \input

Skip to first unread message


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:

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,


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.


Peter Flynn

Jul 6, 2009, 5:50:44 PM7/6/09

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 Flynn

Aug 16, 2012, 11:50:59 AM8/16/12
On Wed, Aug 15, 2012 at 10:28 PM, ofey <> 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"


Reply all
Reply to author
0 new messages