1

I found when I tried to keep the spaces in my file name by using \include{{""}}, then the file could still be included, but the references would be question marks.

This is my MWE

\documentclass{article}

\usepackage[sort, authoryear, round]{natbib}
\bibliographystyle{unsrtnat}

\begin{document}

\include{{"Sections/The study plan"}}

\bibliography{References.bib}
\end{document}  

The file /Sections/The study plan.tex

\section{The study plan}
\citep{abc}

The file /References.bib

 @Article{abc,
  Title                    = {{adc}},
  Author                   = {Adams, D. W. and Errington, J. },
  Journal                  = {Nat. Rev },
  Year                     = {2003},

  Month                    = {Sep},
  Number                   = {9},
  Pages                    = {64--65},
  Volume                   = {7}
}

If I delete the spaces in my file name, and use \include{}, it works fine. For example, if I rename \Sections\The study plan.tex as \Sections\Thestudyplan.tex and use \include{Sections/Thestudyplan}, the reference will show up fine.

I know you might say "just delete the spaces", or "use input instead" etc etc, but I wonder if there is way to keep the spaces in the file names and still use include. Thanks!

  • 4
    I'd say you can try \include{"Sections/The study plan"} (no double braces), but my advice is, as you predicted, don't use space in file names. – egreg Jan 10 '16 at 23:04
  • Of course I tried \include{"Sections/The study plan"}. This way the include wouldn't work at all, not just the natbib. – fyang Jan 11 '16 at 0:07
  • 1
    What might be the reason for preferring \include over \input? Incidentally, it should be \bibliography{References}, not \bibliography{References.bib}, i.e, you should omit the .bib extension. – Mico Jan 11 '16 at 1:03
  • I've taken the liberty of editing the title of your posting, as the issue you're encountering isn't linked directly to the natbib package. – Mico Jan 11 '16 at 1:17
  • 1
    @Mico, no. \include starts a new page, \input doesn't. \includes can be managed with includeonly (unsure about exact syntax, sorry), no control over \input available. – vonbrand Jan 11 '16 at 1:37
1

I can see no compelling reason for using \include in the setup you describe. The \input instruction seems to be tailor-made for just the case at hand.

\documentclass{article}
\usepackage[sort, authoryear, round]{natbib}
\bibliographystyle{unsrtnat}

\begin{document}
\input "Sections/The study plan"
\bibliography{References} % NOT "References.bib", i.e., omit ".bib"
\end{document} 

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.