-1

I'm new to LaTex. I'm having difficulty citing literature from Bibtex .bib files in LaTex. I use Texmaker as LaTex editor and JabRef as bibliography manager. Here, I created a sample LaTex file and a BibTex file in Texmaker:

\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[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{natbib}
\usepackage{amssymb}
\usepackage{graphicx}
\author{Tanmoy}
\title{XYZ}
\begin{document}
\maketitle
\section{Introduction}
dajhgdahbsdkfjhsdhsdjknsdnsdjkl 
\subsection{A}
ahbshbcsdgcjbhcjh ~\cite{Linusson2013}
\bibliographystyle{unsrtnat}
\bibliography{myreferences}
\end{document}

I've enabled the "Pdflatex + Biblatex + Pdflatex(x2) + view PDF" in Quick Build in Texmaker configuration. However, after each PdfLaTex compilation, I get the 'warning'- "Citation 'Linusson2013' on page 1 undefined". Followed by the second 'warning'- "There were undefined citations". On importing references from .bib file generated in JabRef, in addition to the above errors, the statusbar shows- "No file abc.bbl". P.S.: I've also tried "\citep{}" to the same errors. P.P.S: I've also tried enabling "Pdflatex + Biblatex + Pdflatex(x2) + view PDF" via terminal, where it gives the error- "I couldn't open filename abc.bib.aux".

1

It works for me if I make 2 seperate files:

A {documentname}.tex file from:

\documentclass[11pt,a4paper]{article} ... \end{document}

A myreferences.bib file with just:

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

Run as Mico suggested: Pdflatex + BibTex + Pdflatex + Pdflatex + Internal Pdf Viewer

Using BibTex in two different documents gives a lot of advantages if you have a lot of references. If you only have a few references consider using the bibliography within the script, like this:

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
%\usepackage{natbib} No need for this package
\usepackage{amssymb}
\usepackage{graphicx}
\author{Tanmoy}
\title{XYZ}

\begin{document}
\maketitle
\section{Introduction}
dajhgdahbsdkfjhsdhsdjknsdnsdjkl 
\subsection{A}
ahbshbcsdgcjbhcjh ~\cite{Linusson2013}

\begin{thebibliography}{9}
    \bibitem{Linusson2013} 
    Henrik Linusson. 
    \textit{Multi-Output Random Forests}. 
    University of Borås, 2013.
\end{thebibliography}

\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.