TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a document called "myfile.tex" with the following code.



As we can see in \cite{goossens93}...


This compiles fine in PDFLatex however when I try to run bibtex to create the references I get the following error.

I couldn't open file name `myfile.bib.aux'

Does anyone have any idea what Im doing wrong?

Edit to respond to comments:

I am running bibtex on myfile. There is no myfile.bib the bib file is called testbib

share|improve this question
How exactly are you running BibTeX? It sounds as if you are trying to run it on the .bib file rather than the .tex file. – Joseph Wright Jan 26 '13 at 16:08
bibtex myfile not bibtex myfile.bib – David Carlisle Jan 26 '13 at 16:08
Your given MWE must be a .tex file to be compiled. The bib file contains the entrys for your bibliography ... So rename myfile.bib to myfile.tex ... – Kurt Jan 26 '13 at 16:10
no, i am running bibtex on the .tex file. – Chris Headleand Jan 26 '13 at 16:12
well bibtex thinks that your tex file was called mytex.bib and it is looking for the aux file. So it and/or latex are confused, delete all the files except myfile.tex and testbib.bib and run pdflatex myfile;bibtex myfile; pdflatex myfile and things should get back in sync – David Carlisle Jan 26 '13 at 16:24

Store the following complete MWE as file mb-bibtex.tex. Then compile: pdflatex mb-bibtex.tex. It creates a file mb-bibtex.bib (package filecontents). Compile two more times and you will get a result as expected ...

%File mb-bibtex.tex, then \jobname = mb-bibtex
\RequirePackage{filecontents}        % loading package filecontents
% writing file \jobname.bib, for example mb-bibtex.bib.
  author    = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
  title     = {The LaTeX Companion},
  edition   = {1},
  publisher = {Addison-Wesley},
  location  = {Reading, Mass.},
  year      = {1994},
  title     = {The Restaurant at the End of the Universe},
  author    = {Douglas Adams},
  series    = {The Hitchhiker's Guide to the Galaxy},
  publisher = {Pan Macmillan},
  year      = {1980},


Test of bibliography: 
The \LaTeX{} companion~\cite{companion}, the funny book of Adams~\cite{adams}.

\bibliography{\jobname}       % uses \jobname.bib, according to \jobname.tex

Your error was to name a .tex file (containing TeX code) as .bib file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.