[Tex/LaTex] Using BibTex entries directly in .tex file

bibliographiesbibtex

Is there any way to use BibTex entries in thebibliography environment like following:

\begin{thebibliography}{9}
@article{greenwade93,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351"
}

@book{goossens93,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The LaTeX Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
}

\end{thebibliography}

For example consider that you want to quickly write a note that refers to three papers those their BibTex entries are available (perhaps via scholar.google.com ), it is easier that you directly insert them to your document instead of creating a .bib file or converting bibtex entries.

Best Answer

Converting my comments into an answer: Maybe the filecontents package can do what you want.

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{greenwade93,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351"
}
@book{goossens93,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The LaTeX Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
}
\end{filecontents}

\usepackage{natbib}

\begin{document}
Lorem ipsum~\citep{goossens93}.
Dolor sit amet~\citet{greenwade93}.
\bibliographystyle{plainnat}
\bibliography{\jobname} 
\end{document}

In contrast to the filecontents environment provided by LaTeX2e, the filecontents environment provided by the filecontents packge does overwrite existing files.