[Tex/LaTex] Additional references in BibTeX

bibtex

I have a master BibTeX file that gets updated and maintained by BibDesk. I link to it from my TeX documents, but would sometimes like to add "on the fly" references without having to add these to BibDesk in order for them to get put into the master file. In other words, I would like the option to "mix in" additional \bibitems into my bibliography, something like:

\bibliographystyle{plain}
\bibliography{/Users/Papers/master.bib}
\bibitem{additional}Authors, paper, etc.

(Of course, this gives errors.) Any suggestions? Many thanks, and my apologies if this is a very standard or silly question.

Best Answer

There are two solutions possible:

1. Patch the \end{thebibliography} as follows:

\AtEndEnvironment{thebibliography}{
% all your extra bibitems go here
\bibitem{extra1}A. Uthor, Some Extra Paper, vol 123, p.2--3 
}

Do not forget to put \usepackage{etoolbox} somewhere in the preamble. MWE:

\documentclass{article}

\usepackage{etoolbox}

\begin{document}

\AtEndEnvironment{thebibliography}{
% all your extra bibitems go here
\bibitem{extra1}A. Uthor, Some Extra Paper, vol 123, p.2--3 
}

Cite from above \cite{extra1}.
Cite from bib-file \cite{bookWhatever}.

\bibliographystyle{plain}
\bibliography{/Users/Papers/master.bib} 

\end{document}

2. Create a "local" bib file.

Basically, the same trick, as has been suggested already by R. Schumacher.
But, if you prefer to keep everything in one .tex file, just do like in the following MWE:

\begin{filecontents}{mylocalbib.bib}
@article{extra1,
  title={Title},
  author={A. Uthor},
  journal={PRL},
  volume={12},
  pages={123--124},
  year={1999},
}
\end{filecontents}

\documentclass{article}

\begin{document}
\cite{extra1}

\bibliographystyle{plain}
\bibliography{/Users/Papers/master.bib,mylocalbib} 
% here both your "global" and "local" bib-files are mentioned

\end{document}
Related Question