How can I insert by .bib file into my .tex file?
You can use the filecontents
package to insert the contents of your bib
file into your tex
file.
Here is an MWE of how it would look using biblatex
and bibtex
.
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
@book{author_book,
title = {Book's title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
date = {2005},
}
\end{filecontents}
\usepackage[style=authoryear,backend=bibtex]{biblatex} %backend tells biblatex what you will be using to process the bibliography file
\addbibresource{jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
Here is a MWE without using biblatex
:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
@book{author_book,
title = {Book's title},
author = {Author, Some},
location = {The City},
publisher = {Publisher},
year = {2005},
}
\end{filecontents}
\begin{document}
\nocite{*}
\bibliographystyle{abbrv}
\bibliography{jobname}
\end{document}
When you compile this the first time, a bib
file is created just like several other files are created (aux
, toc
, log
, etc) so it shouldn't be a problem for whoever is requesting to have everything in a single file. After the first compile, you need to run bibtex
as you normally would. Everything is pretty much the same.
Edit: I see now that using filecontents
is the solution in the post to which @N.N. pointed in his comment.
After you run bibtex
, you can copy the contents of the .bbl
file into your document.