2

I use a Mac. I have a a .tex file called references test.tex. I have (what I think is) a plaintext file called sample1.bib. The files are super minimal. The references test.tex file looks like this:

\documentclass[12pt]{article}
\usepackage{natbib}
\renewcommand{\refname}{References}

\begin{document}
\cite{blackholes}

\bibliographystyle{plain} 
\bibliography{sample1}
\end{document}

And the sample1.bib file looks like this:

@article{blackholes,
      author="Rabbert Klein",
      title="Black Holes and Their Relation to Hiding Eggs",
      journal="Theoretical Easter Physics",
      publisher="Eggs Ltd.",
      year="2010",
      note="(to appear)"
}

Apologies for the way the output looks - I'm not so good at LaTeX, but it looks like the input if you were to try to edit this original post

They're even saved in the same place (macintosh HD/User/Documents). So why does my reference appear as "[?]"? Do I need to compile somehow or something? Really quite confused.

5
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Regarding your problem: Did you run BibTeX on your file? See also Question mark instead of citation number.
    – moewe
    Jan 28 '15 at 15:25
  • 1
    Well, you certainly have to run bibtex in order for it to resolve the citations. And if whatever editor you are using is not doing that automatically for you, you will have to do it by hand. Don't forget to again run latex after the bibtex run, so that it can read the output bibtex produced. Jan 28 '15 at 15:29
  • I'm on Tekmaker. Dumb question obviously, but how do I run bibtex?
    – Luke
    Jan 28 '15 at 16:53
  • it's all rather confusing - the bibtek file is a plaintext file so on one hand I can open it using textedit, but also it's available to use in Tekmaker itself?
    – Luke
    Jan 28 '15 at 16:54
  • @Luke Well, on Windows you just type bibtex <File> on the command line, as you would type latex <File> for a LaTeX run. I do not know how that works on Mac. But since Texmaker seems to be designed for compiling LaTeX, I am sure that somewhere you can adjust the editor so that it compiles the bibliography automatically. Jan 28 '15 at 17:11
4

I had no problem to typeset your file, my graphical interface to (La)TeX being TeXShop.

enter image description here

In your case you seems to have forgotten to use BibTeX. As an example, when TeXShop is opened, you have the typesetting menu available ("composition" in my case, since I'm French-speaking).

enter image description here

First open your TeX file with TeXShop. Then, in the above menu, select LaTeX first, and then BibTeX, and then LaTeX twice again. The results should be the same as it was with mine

There is a shorter way: to select, in the Macro menu, the "Bibliography" script:

enter image description here

Once selected, the four compilations above should execute themselves automatically.

There are even other ways, such as using the more general latexmk utility, which TeXShop can interface. Don't hesitate to read the "Help" menu of TeXShop or another editors and the documentation it contains, most notably the one for beginners.

3

In TeXMaker, you can choose the compile method in the top of the window.

Choosing compile method

Select BibTeX and press the "Run"-arrow to the left. Then, switch back to PDFLaTeX and compile twice. Another option is to use the function keys. The default shortcuts (at least for Windows) are F6 for PDFLaTeX, and F11 for BibTeX.

You may also change the Quick-Build to include BibTeX. To do so, go to Options > Configure Texmaker > Quick Build and select the PDFLaTeX + BibTeX + 2x PDFLaTeX + View PDF option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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