LaTeX forum ⇒ BibTeX, biblatex and bibernatbib and subfiles packages Topic is solved

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
nich
Posts: 14
Joined: Fri Aug 13, 2010 8:22 am

natbib and subfiles packages

Postby nich » Thu Sep 30, 2010 1:01 pm

Anyone know how I can get these two to work together.

Obviously I only want one reference list in my final document so I cant include an instruction to crease a bibliography in every subfile. But when I do not include the commands to crease a bibliography in each subfile I cant get the in text citations to show when I compile individual subfiles.

Thanks

Tags:

User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Postby frabjous » Thu Sep 30, 2010 7:57 pm

I don't have a lot of experience with the subfiles package, but one option that occurs to me would be to go ahead and include the bibliography in each subdocument, but use the comment package to suppress its output:

  1. \usepackage{comment}
  2. \excludecomment{thebibliography}

GregNash
Posts: 1
Joined: Sat Jan 22, 2011 11:56 pm

Postby GregNash » Sun Jan 23, 2011 12:10 am

Packages cannot be declared in subfiles. My current solution is to add
  1. %\bibliographystyle{plain}
  2. %\bibliography{../References}

at the end of each subfile and to uncomment them when I'm compiling the individual subfiles.

Note that I use "../References" instead of "References" because my References.bib file is located in the parent directory.

crowding
Posts: 1
Joined: Wed Apr 20, 2011 3:46 am

Postby crowding » Wed Apr 20, 2011 3:55 am

Here via google, just worked out the answer to this one. Define something like \biblio to produce a bibliography in the individual files, but undefine it in the body of your main file.

In your main file:
  1. \documentclass[...]{...}
  2. \usepackage{natbib}
  3. \usepackage{subfiles}
  4. ...
  5. \def\biblio{\bibliographystyle{plainnat}\bibliography{bibliography}}
  6. \begin{document}
  7. \def\biblio{}
  8. ...
  9. \subfile{chapter_1}
  10. \subfile{chapter_2}
  11. ...
  12. \bibliographystyle{plainnat}
  13. \bibliography{bibliography}
  14. \end{document}


In your chapter files:
  1. \documentclass[main]{subfiles}
  2. \begin{document}
  3. ...
  4. \biblio
  5. \end{document}

AlexIgamberdiev
Posts: 1
Joined: Sun Aug 09, 2015 5:28 pm

Postby AlexIgamberdiev » Sun Aug 09, 2015 5:33 pm

Awesome, it works perfectly, thank you!

User avatar
Stefan Kottwitz
Site Admin
Posts: 8792
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Tue Aug 11, 2015 12:52 am

Hi Alex,

welcome to the forum!

It's great to read, that it worked for you. Just to mention that, perhaps the challenge could be tackled with the modern biblatex package too.


Stefan
Site admin


Return to “BibTeX, biblatex and biber”

Who is online

Users browsing this forum: No registered users and 2 guests