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.

I'm using the chapterbib package for multiple bibliographies. I put the following two lines in the preamble.

\usepackage[square,numbers,sectionbib]{natbib}
\usepackage{chapterbib}

Included chapter files with

\include{Chapter01}

and added the bibliography to the end of each chapter with

\bibliographystyle{plainnat}
\bibliography{Bibliography}

This works perfectly. But when I put each chapter in its own sub directory and use \input rather than \include like this

\input{../101Chapter01/101Chapter01}

it produces the global bibliographies for each chapter. Any help will be highly appreciated.

share|improve this question
    
This is true. You have to use \include because it generates its own .aux file whereas \input does not. But what's the problem now? Why do you want to use \input instead of \include? –  Thorsten Jan 22 '12 at 7:22
    
@Thorsten: Thanks for your comment. Actually I want to keep each chapter file in separate directory. –  MYaseen208 Jan 22 '12 at 7:26
    
This is no problem. You can use it like this: \include{path/to/my/file}. –  Thorsten Jan 22 '12 at 7:28
    
@Thorsten: Is this okay \include{D:/Path1 from/Path2 from/101Chapter01}? What about space in the path name? Thanks –  MYaseen208 Jan 22 '12 at 7:43
    
I have never tried \include using spaces in paths. Maybe this works: \include{"my path with spaces"/file}. But I generally recommend you to avoid spaces in paths. –  Thorsten Jan 22 '12 at 7:43

1 Answer 1

up vote 2 down vote accepted

(Converted my comments to an answer as @lockstep requested)

Main question

This behavior is true. You have to use \include because it generates its own .aux file whereas \input does not.

There is no need to use \input when you want to use a path to another directory. This is also possible with \include (e.g. \include{path/to/my/file}).

Referencing to the comments

The OP also asked another question in a comment. Because it's not part of the original question I will split this section from the main answer.

Referencing to your comment which contains another question about spaces in paths I can only make some guesses because I have never tried to do so:

Maybe you could use " to hold the filename that contains spaces (e.g. \include{"my path with spaces"/file} or maybe \include{"my path with spaces/file"}). As I'm not sure about this I searched for related questions on tex.sx and found a promising answer by @Stefan Kottwitz (How to make \include work with a quoted string path containing spaces?). There he suggests to use the \space command in those cases (e.g. \include{"my\space path\space with\space spaces/file"}).

But I generally recommend you to avoid spaces or special characters in paths because it may also cause problems if you're using your files on different operating systems.

share|improve this answer

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.