1

I use Papers to manage all my reference files and produce a bibtex.bib file. In some articles I want to include a reference not in that bibtex.bib file. This is often for things like "personal correspondence". I don't want to have to add a "fake" item in my software to do it.

Is it possible to add an item in my tex source that can then be referenced in the document and appear in the references section?

  • The idea is that all your entries come from a .bib file when you use BibTeX. You can load several .bib files, so you could use a throwaway .bib file without "polluting" your actual references .bib file. The package notes2bib automates this. You could also manipulate the .bbl file by hand, but that would have to be repeated after every BibTeX run. – moewe Oct 19 '18 at 6:20
  • So there is no way to add an additional entry inline? – Carl Oct 19 '18 at 6:43
  • 1
    There is: notes2bib or manual manipulation of the compiled .bbl file. notes2bib actually creates a throwaway .bib file internally, so that's more or less what I suggested you could do as well. – moewe Oct 19 '18 at 6:46
4

The whole point of BibTeX and .bib files is that you don't have to write anything ad-hoc in your document. All citable sources are given in the .bib file and can be called upon and formatted as desired in the document.

If you don't want to 'pollute' your main .bib file with certain entries, you can use a second .bib file for these one-off citations. BibTeX can easily process several .bib files. That second .bib file could be created from the .tex file with filecontents (see MWE below, where the 'main' .bib file is created that way).

Of course the output still depends on the way the bibliography style formats your entry. So if you want a 'freeform' citation, you might have to trick BibTeX a bit.

The package notes2bib takes this idea a step further and automates it. It allows you to create one-off bibliography entries from within the document on the fly. Internally, the package just writes a .bib entry to a separate .bib file and tells BibTeX to load it as well.

The package has many options to allow you to customise the output. Depending on the style and the desired output tweaks might be necessary.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[numbers]{natbib}
\usepackage{notes2bib}

% for unsrtnat
\bibnotesetup{
  note-name = ,
  use-sort-key = false
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
  author  = {Humphrey Appleby},
  title   = {On the Importance of the Civil Service},
  year    = {1980},
}
\end{filecontents}

\begin{document}
\cite{appleby}
\bibnote{Personal communication with Sir Humphrey Appleby}
\bibliographystyle{unsrtnat}
\bibliography{\jobname}
\end{document}

[1] Humphrey Appleby. On the Importance of the Civil Service. 1980.//[2] Personal communication with Sir Humphrey Appleby.


If you are not afraid of manual work, you can modify the .bbl file that is produced by BibTeX to typeset the bibliography.

In a simple document it might look like this

\begin{thebibliography}{1}

\bibitem[Appleby(1980)]{appleby}
Humphrey Appleby.
\newblock \emph{On the Importance of the Civil Service}.
\newblock 1980.

\end{thebibliography}

The thebibliography environment works more or less like an enumerate or itemize with \bibitem instead of \item. \bibitem has a mandatory argument: The entry key that you can use in \cite and an optional argument for a citation label or metadata for author-year citation commands. It depends on the citation management package how the optional argument is used and formatted.

You can easily add your own entries here.

\begin{thebibliography}{1}

\bibitem[Appleby(1980)]{appleby}
Humphrey Appleby.
\newblock \emph{On the Importance of the Civil Service}.
\newblock 1980.

\bibitem[Appleby(2018)]{app:perscomm}
Personal communication with Sir Humphrey Appleby.
\newblock 2018.

\end{thebibliography}

The disadvantage of this approach is that the .bbl file is temporary in nature: It is supposed to be rewritten on each BibTeX run.

When you are done, you can replace the \bibliography{\jobname} line with the contents of your .bbl file. That fixes the output and does away with needing to run BibTeX.


If you use biblatex, you can't modify your .bbl file, since the format of the file is different: It does not contain the formatted bibliography, it just contains the raw data in a format readable by LaTeX.

You can still use a second .bib entry or notes2bib. And you might also want to look into How to set up BibLaTeX for use with 'freeform' citations.

| improve this answer | |

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.