# Not generating the .aux for the bibliography to run

I'm trying to generate my bibliography and, for what I read, I need to run my main.tex, then bib.aux and then, again main.tex twice, right?

I have created my .bib file and the name on the \bibliography{bib} is the same as my file. The thing is, although I have saved the bib.bib, when I run main.tex the bib.aux is not generated. I saved the bib file as a TeX bib file. It's correct, right?

I'm working on a Mac OS, does this make it different?

I don't know what am I doing wrong.

-

Your question is not very clear and without an MWE I can only guess. I think there are some missunderstandings causing your problems.

First of all have a look on my MWE, store it with the understandable filename mwe-bibtex.tex (main.tex can be nothing or everything ...):

%File mb-bibtex.tex, then \jobname = mb-bibtex
\documentclass{article}
\usepackage[numbers]{natbib}         % bibliography style
\usepackage[colorlinks]{hyperref}    % better urls in bibliography

\begin{filecontents*}{\jobname.bib}  % writing file \jobname.bib
@Book{companion,
author    = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
title     = {The LaTeX Companion},
edition   = {1},
year       = {1994}
}
title     = {The Restaurant at the End of the Universe},
series    = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year      = {1980}
}
\end{filecontents*}

\begin{document}
Test of bibliography:

\bibliographystyle{plainnat}  % needs package natbib
\bibliography{\jobname}       % uses \jobname.bib, according to \jobname.tex
\end{document}


Run it first with typing pdflatex mwe-bibtex.tex in your terminal comand line. You will find a new file mwe-bibtex.bib (comming from the used package filecontentsin my MWE) containing the data of a example bibliography. Now run bibtex mwe-bibtex. This builds, using the file mwe-bibtex.aux, the file mwe-bibtex.bbl LaTeX needs to include a correct bibliography in your document. Now run LaTeX twice with pdflatex mwe-biblatex.tex. Afterwards you should have a mwe-biblatex.pdf file containing the complete document.

Update:

With TeXShop you can also run pdflatex and bibtex. Perhaps question all in one engine for texshop can help you. Otherwise have a look into the TeXShop manual.

-
Thank you, I see the point. But I may also create the .bib file by myself, right? Ok the problem I'm having now is that I don't know where to type the pdflatex and bibtex commands. I am using TeXShop and I never had to type any commands to generate my pdfs. Eventhough I tried to use the terminal on mac and I couldn't run the bib file. It showed:bibtex: Not writing to /Users/juliocosta/Desktop/cenalatex/mwe-bibtex.blg (openout_any = p). I couldn't open file name /Users/juliocosta/Desktop/cenalatex/mwe-bibtex.blg' –  Luis Sep 27 '12 at 10:24
I already solved the problem. Thanks for your time. I managed to run it on terminal and got your file right, and then applied to mine. –  Luis Sep 27 '12 at 10:49
@Luis: fine. Please upvote and accept that answer that helps you most. Package filecontents is a good thing to have two complete files in one compiling MWE :-) –  Kurt Sep 27 '12 at 11:25

The .aux generated for bibtex is main.aux not bib.aux

You should run

latex main
bibtex main
latex main


(and possibly other times. It happens that bibtex has to be run twice or more, when using crossreferences).

Some packages use other .aux (see e.g. multibib` package), but this is not your case.

-
Thank you. But where do I type those commands? I am using TeXShop, and every time I need to check on my pdf I just click on Typeset on the menu bar, I never had to type any command lines. I tried to do it in the console for the main.tex but nothing happens... –  Luis Sep 27 '12 at 10:12
I already solved the problem. Thanks for your time. –  Luis Sep 27 '12 at 10:47