2

I am taking the class "LaTeX for Professional Publications" on Udemy and I am unable to get my citations to work. I am using MikTeX with the TeXworks editor. Following the instructions from the class, I have created a file called references.bib:

@article{Linusson2013,
author = "Henrik Linusson",
title = "Multi-Output Random Forests",
journal = "University of Borås",
year = "2013"
}

I would like to cite the article in my LateX doc article.tex, as well as add a bibliography in the reference section:

\documentclass[a4paper]{article}   
\begin{document}

\section{Introduction}
This is an example of a LaTeX document with BibTex~\cite{Linusson2013}

\section{References}

\bibliography{references} 

\end{document}

Based on the instructions from the class, I first ran references.bib with BibTeX in order to generate a bbl file but that failed (error message says .aux file cannot be found). Naturally, the citations don't show in my article when I compile article.tex using pdfLaTeX. Does anyone know what I am doing wrong?

  • 2
    you don't run bibtex on the bib-file, call bibtex article instead (after your ran pdflatex article) and then call pdflatex article again twice. – Ulrike Fischer Nov 10 '16 at 15:37
  • 2
    Your tex file appears to be missing a \bibliographystyle instruction. Without such a directive, BibTeX doesn't know what to do and therefore outputs nothing at all. – Mico Nov 10 '16 at 15:53
  • 1
    I'd say you need to seriously critique the course for its lack of proper instructions on how to use BibTeX. – Mico Nov 10 '16 at 16:16
4

There appear to be two issues with your approach to generating a bibliography and citation call-outs.

  • The tex file is missing a \bibliographystyle instruction. The argument of \bibliographystyle contains the style that is to be implemented. This is an essential directive; without it, BibTeX will generate no output at all.

  • It is simply misguided and misleading to say that one "runs [a bib file] with BibTeX". The bib file is an essential input for BibTeX, but it's only one of several inputs.

    If the main tex file is called mywork.tex, say, then one needs to run

    bibtex mywork
    

    BibTeX will inspect the file mywork.aux (which is created by an earlier LaTeX run) for information about the bibliography style to be adhered to, the items that were \cited, and the bib file(s) that contain the cited entries. Based on these pieces of information, it will create a file called mywork.bbl (the formatted bib entries) and mywork.blg, the associate log file. If there are any syntax errors in the bib file, you'll find out about it in the blg log file.

The workflow therefore is:

pdflatex mywork
bibtex mywork
pdflatex mywork
pdflatex mywork

Note that it's necessary to run LaTeX twice more after the BibTeX run in order to fully propagate all changes.

An MWE (minimum working example) -- observe that I've chosen the plain bibliography style; you should choose a style that meets your formatting needs.

enter image description here

\RequirePackage{filecontents}
\begin{filecontents}{myreferences.bib}
@misc{Linusson2013,
   author  = "Henrik Linusson",
   title   = "Multi-Output Random Forests",
   howpublished = "University of Borås",
   year    = "2013",
}
\end{filecontents}

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\bibliographystyle{plain}  % <-- choose a suitable bib style
\begin{document}

\section{Introduction}
This is an example of a \LaTeX\ document with a bibliography and citation call-outs generated by Bib\TeX~\cite{Linusson2013}.

\bibliography{myreferences} 
\end{document}

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.