In Windows, \input can work with a quoted string path containing spaces, but \include cannot. How to fix it?


%\input works!
\input{"Contents/Installing and Configuring IIS 7/Configuring Security"}

%but \include does not work!
%\include{"Contents/Installing and Configuring IIS 7/Configuring Security"}
  • I deleted my answer because I'm not sure if that's really a solution. It was just a guess. So I will comment, instead. Do you get a "No file" error message? Could you try to enter "\includeonly{"Contents/Installing and Configuring IIS 7/Configuring Security"}" in the preamble first. Maybe "\include" would work after this. – Jimi Oke Dec 13 '10 at 4:32
  • @jimi, it did not and does not make sense. If it works like so, the other \include will be ignored, right? – xport Dec 13 '10 at 6:59
  • @xport: sorry, that really did not make any sense. You may find the answer to your question here: stackoverflow.com/questions/2444385/…>. Someone else also had this problem a while back. It probably has something to do with the version of your distribution. – Jimi Oke Dec 13 '10 at 7:07
  • My knowledge of the include command is not that in-depth but as far as I understand, \includeonly reprocesses the specified file already called in the document through \include. I guess its only useful when you have multiple files and only want to work with a few. \include is never ignored, though, since that's what really makes the document. Check out the solutions from the link. If nothing works, fastest thing to do would be just to rename your file without spaces and you should be fine. – Jimi Oke Dec 13 '10 at 7:16
  • Does escaping the spaces work: \include{file\ name} – Seamus Dec 16 '10 at 9:50

You could use \space within the file name, which works for me with \include on Windows:

\include{"Configuring\space Security"}

It works with paths and with file names. An .aux files with blanks in the file name would be produced, \includeonly works as well if \space is used too.

| improve this answer | |
  • where do I insert \string in the path? – xport Dec 18 '10 at 16:59
  • @xport: also for \includeonly use \space, \string is not required, I corrected that. – Stefan Kottwitz Dec 18 '10 at 17:19

You can try to protect the filename with an additional brace. On miktex/winxp this works:

\includeonly{{"test space"}}
\include{{"test space"}}

But don't expect it to work on other systems too! If you need something reliable remove better the spaces.

| improve this answer | |
  • can we substitute \input for \include with additional commands? – xport Dec 13 '10 at 11:02
  • Well internally \include is \input with additional commands. So naturally you can replace it. But what do you want to achieve? – Ulrike Fischer Dec 13 '10 at 11:11
  • @Ulrike, thanks first. I need a new \include-like inclusion command that can accept string path with spaces, of course. – xport Dec 14 '10 at 0:47
  • I guessed that. But which features of \include do you actually need? And did you actually tried my solution? If yes why doesn't it help you. – Ulrike Fischer Dec 14 '10 at 11:18
  • @Ulrike, your solution did not work. I got nothing. – xport Dec 16 '10 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.