I would like to have a paper's bibliography entries inside its .tex file instead of outside in a .bib file. Is this possible with biblatex?

My reason for asking this is that I want to find the most convenient way to produce documents that uses biblatex from just one file to make collaboration on papers easier and to be able to handle submissions of papers to journals.

  • I get very curious as to why you want this. I would expect sending around a bunch of files or using a version control system e.g. git (which is what I do) to be easier but maybe I am missing something?
    – jonalv
    Jun 17, 2011 at 16:14

3 Answers 3


Not really. You can use the filecontents* environment. Put

<the bibliography database>

in the preamble (before \documentclass) and the database.bib file will be created if not already existent. This is the most convenient way to pack everything needed in a unique .tex file.

The filecontents* environment differs from filecontents in that the former doesn't add any initial comments, which could confuse bibtex or biber.

As mentioned by Gonzalo Medina, the filecontents package lifts some restriction about these environments, allowing for example to put them anywhere in the file. Notice that, with this package, existent files will be overwritten.

  • Is this how authors collaborating on papers handle reference entries for biblatex when sending drafts back and forth between each others?
    – N.N.
    Jun 9, 2011 at 14:16
  • @N.N. This is a convenient way; one can always use a compressed archive. Recall, however, that an existent file with the same name will not be overwritten.
    – egreg
    Jun 9, 2011 at 14:18
  • 7
    @N.N. In standard LaTeX the environments filecontents and filecontents* have two restrictions: 1) they can only be used before the \documentclass command, and 2) if the file to be created already exists, then nothing happens (except for an information message) and the body of the environment is bypassed. These two restrictions can be lifted if you load the filecontents package. Jun 9, 2011 at 14:26
  • 1
    @N.N. Yes. This is a good option, but sometimes journals don't accept an archive and the filecontents(*) environment is the option of choice.
    – egreg
    Jun 9, 2011 at 14:40
  • 2
    @egreg I guess using version control might be an option too (I'm using git for my own work) but not everyone is prepared to learn one such system.
    – N.N.
    Jun 9, 2011 at 14:52

The Journals of Elsevier recommend:

  • Open the bbl file; there, you'll see something like that:

    bibliography entries
  • Copy all the content in these file;

  • Paste the content in your tex file, replacing thebibliography environment.

After that you can define your bibliography style, as example:

\bibliographystyle{plainnat} (if you use natbib).

I hope you can solve your problem.

  • 3
    Be warned that this approach will not work if you are still in the stages of adding stuff to your bibliography and sending it to collaborators.
    – Seamus
    Jun 15, 2011 at 13:10
  • I'm not sure, but I don't think \bibliographystyle is supported by biblatex.
    – doncherry
    Jan 8, 2012 at 18:49
  • Be warned that this approach maybe will not work due to the lack of new file create authorization on another server using limited user credentials.
    – Sait
    Sep 11, 2012 at 11:26

I don't know about BibLaTeX specifically, but you can do it with BibTeX, although it is sort of silly. BibTeX ignores all text outside of @foo{...}. So what you can do is you can give your .tex file a .bib extension and put the document followed by a \endinput followed by your bibliography entries. Here's an example.


        author = {T.H. Me},
        title = {Silliness},
        year = 2011,
        month = jun,

One can compile this using the following.

$ pdflatex b.bib
$ bibtex b
$ pdflatex b.bib
$ pdflatex b.bib
  • 8
    This works provided the @ character never appears in the document before the bibliographic data. If, for instance, an email address appears, it breaks BibTeX.
    – egreg
    Jun 14, 2011 at 10:27
  • @egreg: Yep! As I said, this is sort of silly.
    – TH.
    Jun 14, 2011 at 10:35
  • 2
    If there were a sort of \endinput for BibTeX (or Biber), one might put the bibliographic data in front of the file, surrounded by \iffalse and \fi; but I don't think something like @ENDINPUT exists. However this would still require naming the file with the .bib extension.
    – egreg
    Jun 14, 2011 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .