Is there a way to have references in the same latex file (i.e. instead of having the references in a separate .bib file)


3 Answers 3


Yes and no.

You can create your own bibliography manually:

  \textsc{Author}, \textit{Title}, ...



However, this lacks consistency through automation as well as ease-of-maintenance.

A far better alternative to handling a bibliography "within the same file" would be to embed it via the aid of thefilecontents or filecontents* environment (with the overwrite option to accommodate perpetual changes). This way you can manage your bibliography within the main TeX file, while it is actually always written out to file for use in the expected way.

Here is an example:



  author = {Author, A.},
  year = {2001},
  title = {Alpha},
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},






The file general.bib is overwritten with every compilation, allowing you to add/remove bibliography entries as you please. Every change, however, should still be accompanied with the appropriate BibTeX engine (biber in the above case).

  • this code needs a biblatex.sty file, how to do that? Jun 16, 2014 at 13:28
  • @user3741635 you need to install biblatex. On miktex and texlive there are package installers to do this for you.
    – Chris H
    Jun 16, 2014 at 15:24
  • @user3741635: You can follow the direction in How do I update my TeX distribution? to install packages. If you're talking about the general use of a bibliography and how to obtain/display it in your document, then that's a different question. That requires a compilation sequence (pdf)LaTeX > BibTeX/Biber > (pdf)LaTeX (and possibly one more (pdf)LaTeX).
    – Werner
    Jun 16, 2014 at 15:37
  • 1
    @DiaaAbidou: The filecontents environment adds a specific 4-line commented header to the output file (see page 2 of the filecontents documentation). filecontents* does not add this header. You'd use filecontents* when eventual reading may have comments (via %) interpreted; this is typically the case when you would read in via (say) \lstinputlisting.
    – Werner
    Mar 2, 2017 at 16:22
  • 1
    @zyy: You need need to compile multiple times with every change in the bibliography. Once there aren't changes, a single compilation should suffice. The same goes for references.
    – Werner
    Jan 12, 2020 at 17:47

In case this is the request of a publisher who wants only one file compiling with standard packages only, the classical way of doing this is:

  1. Use bibtex when preparing your manuscript, say manuscript.tex.

  2. Before sending to the publisher, make a copy your manuscript .tex file, say to submitted_version.tex, edit that copy and replace the lines calling Bibtex by the contents of the manuscript.bbl file.

Send that file submitted_version.tex to the publisher.

  • 3
    Though this is common, all cases I've come across for this require bibtex not biblatex - be warned :)
    – Chris H
    Jun 16, 2014 at 15:23

In addition, you may use the amsrefs-package.

According to the documentation, there are three ways of using the package:

  1. Enter bibliography items directly in your LaTeX-document using the biblist-environment and the \bib-command.
  2. Import items from an external .ltb-file.
  3. Import items from a .bib file using BibTeX and the special bibliography styles distributed with the amsrefs-package

Item 1 is the method you are asking for. The amsrefs-package is included in TeX-distributions.

  • 1
    An example for the how to use the syntax would be really nice
    – lucidbrot
    Aug 5, 2020 at 20:59
  • 1
    @lucidbrot The package documentation offers simple examples for each of the three methods at the beginning itself. You may glance through it to gather an idea of what it's like. Jun 21, 2021 at 17:41

You must log in to answer this question.

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