Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

\documentclass{book}
\begin{document}

%\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"}
\end{document}
share|improve this question
    
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

2 Answers 2

up vote 11 down vote accepted
+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.

share|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
    
thanks for your help. :) –  xport Dec 18 '10 at 17:27

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

\documentclass{article}
\includeonly{{"test space"}}
\begin{document}
\include{{"test space"}}
\end{document}

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

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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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