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
BibTeX, biblatex and biber ⇒ natbib and subfiles packages
natbib and subfiles packages
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:
Code: Select all
\usepackage{comment}
\excludecomment{thebibliography}
natbib and subfiles packages
Packages cannot be declared in subfiles. My current solution is to add
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.
Code: Select all
%\bibliographystyle{plain}
%\bibliography{../References}
Note that I use "../References" instead of "References" because my References.bib file is located in the parent directory.
natbib and subfiles packages
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:
In your chapter files:
In your main file:
Code: Select all
\documentclass[...]{...}
\usepackage{natbib}
\usepackage{subfiles}
...
\def\biblio{\bibliographystyle{plainnat}\bibliography{bibliography}}
\begin{document}
\def\biblio{}
...
\subfile{chapter_1}
\subfile{chapter_2}
...
\bibliographystyle{plainnat}
\bibliography{bibliography}
\end{document}
Code: Select all
\documentclass[main]{subfiles}
\begin{document}
...
\biblio
\end{document}
-
- Posts: 1
- Joined: Sun Aug 09, 2015 5:28 pm
Re: natbib and subfiles packages
Awesome, it works perfectly, thank you!
- Stefan Kottwitz
- Site Admin
- Posts: 10290
- Joined: Mon Mar 10, 2008 9:44 pm
natbib and subfiles packages
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
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
LaTeX.org admin