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?
Best Answer
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 withfilecontents
(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.
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
The
thebibliography
environment works more or less like anenumerate
oritemize
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.
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 ornotes2bib
. And you might also want to look into How to set up BibLaTeX for use with 'freeform' citations.