0

It's not graphs. It's a .tex file that I want to include. I used \input and it worked fine. But as I keep writing more and more, the file got bigger and bigger and I decided to use chapterbib to make the reference clearer. I used natbib and I found for chapterbib to work, I must use \include and not \input.

When I changed to \include, it wouldn't compile any more.

I can't write on file `"Literature review/M.aux"'.
\@include ...\immediate \openout \@partaux #1.aux 

\immediate \write \@partau...
l.67 \include{"Literature\space review/M"}

(Press Enter to retry, or Control-D to exit; default file extension is `.tex')
Please type another output file name
! Emergency stop.
\@include ...\immediate \openout \@partaux #1.aux 
\immediate \write \@partau...
l.67 \include{"Literature\space review/M"}

I found this but it doesn't work. How to make \include work with a quoted string path containing spaces?

I tried some combinations.

This works: \include{review\M} (supposing I have a file call "M.tex" in folder of "review" and the folder "review" is in the same folder of my base tex file)

This works: \include{"M\space 1"} (supposing I have a file call "M 1.tex" in the same folder of my base tex file)

But this doesn't work: \include{"Literature\space review/M"} (supposing I have a file call "M.tex" in folder of "Literature review" and the folder "Literature review" is in the same folder of my base tex file)

Someone asked if this works: \include{"Literature review/M"}. No. It gives no error, but the output will simply be review/M.

I found someone said to change TEXINPUTS in bash. I did not understand it at all. I'm using windows. I don't know how to change the path.

I found this did not work either. How to include graphics with spaces in their path?

How could I make it work? Thanks!

Update:

I replaced all the spaces with underlines and still it didn't work. Is it because my file is too deep? It is \include{{"Folder_A/B/C/D/M"}}. LaTeX still reported that it could not write the 'Folder_A/B/C/D/M.aux' file. So perhaps it was not the spaces that caused the issue in the first place.
Any idea?

  • 2
    Why do you need spaces in your path names? My suggestion would be to use underscore _ for spaces, which should solve your problem. – Werner Nov 5 '15 at 1:40
  • That's just a simplified example. I have so many folders, and some of them contain a lot of words separated by spaces. I don't want to change them one by one. I would rather just replace all the \input with \include. – fyang Nov 5 '15 at 1:45
  • Change them one-by-one? Windows doesn't allow "multiple" (or "mass") renaming? – jon Nov 5 '15 at 2:05
  • 3
    I'm rather certain that you already spent more time on getting spaces to work that it would have cost you to remove the spaces from the folder and files names ... Even if you find some way to handle the spaces: it can always break if you move to some other os. It is not worth the time. – Ulrike Fischer Nov 5 '15 at 9:13
  • 1
    \include{Folder_A/B/C/D/M}, I guess. Why do you need anything that deep in terms of directory structure? Seems very strange.... – cfr Nov 6 '15 at 0:23

Your Answer

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

Browse other questions tagged or ask your own question.