2

I have the following tex-code where I tried using bibtex:

\documentclass[preprint,3p,twocolumn,authoryear]{elsarticle}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{cite}
\usepackage{natbib}

\begin{document}

\title{Testing bibtex in Texmaker}
\maketitle

\section{Introduction}
This is a test cite:\citep{ab94}

\bibliographystyle{elsarticle-num-names}
\bibliography{biblio}

\end{document}

I'm using elsarticle-num-names.bst bibliography style file and my biblio.bib is the following:

@article{ahu61,
       author={Arrow, Kenneth J. and Leonid Hurwicz and Hirofumi Uzawa},
       title={Constraint qualifications in maximization problems},
       journal={Naval Research Logistics Quarterly},
       volume={8},
       year = 1961,
       pages = {175-191}
     }

@book{ab94,
       author = {Charalambos D. Aliprantis and Kim C. Border},
       year = {1994},
       title = {Infinite Dimensional Analysis},
       publisher = {Springer},
       address = {Berlin}
     }

@incollection{m85,
       author={Maskin, Eric S.},
       year={1985},
       title={The theory of implementation in {N}ash equilibrium: a survey},
       booktitle={Social Goals and Social Organization},
       editor={Leonid Hurwicz and David Schmeidler and Hugo Sonnenschein},
       pages={173-204},
       publisher={Cambridge University Press},
       addess={Cambridge}
     }

If I run this file in Texmaker I get the error:

enter image description here

If I remove the \citep{ab94} command I get no errors, but the bibliography doesn't appear in the PDF-file, no matter how many times I compile the tex-file.

I'm using Texmaker 3.5.2 and here is my configurations:

enter image description here

Another very common errors I get (using different tex- and bibtex-file) with bibtex in Texmaker are:

! Package inputenc Error: Keyboard character used is undefined
(inputenc) in inputencoding `utf8'.

and

! Undefined control sequence.
<argument> C.~D. Renn\�
o
l.257 \bibinfo{author}{C.~D. Renn\�o}
, \bibinfo{author}{J.~ao~Ricardo~de

My operating system is 64-bit Windows 7. Any ideas what is causing my problems...? Why can't I get BibTex working here?

P.S. Please let me know if you need any more details. I will provide if required :)

  • 1
    Remove \usepackage{cite}. Almost all of its functionalities are provided by natbib. Then it should work. – user11232 Apr 2 '15 at 8:48
  • Hi @HarishKumar I removed the \usepackage{cite} and it compiled now. However in the place of the \citep{ab94} I got a question mark even though I compiled multiple times. I also got two warnings: Citation 'ab94' on page 1 undefined, and: there were undefined citations. – jjepsuomi Apr 2 '15 at 9:22
  • 2
    You have to run bibtex too. Select bibtex from the compile menu and run it. Then again xelatex two times. – user11232 Apr 2 '15 at 10:42
2

The first page of natbibs user manual says this:

It is compatible with the packages: babel, index, citeref, showkeys, chapterbib, hyperref, koma and with the classes amsbook and amsart. It can also emulate the sorting and compressing functions of the cite package as well as the multiple citation (and merg- ing) functions of Thorsten Ohl’s mcite package. (The natbib package, however, is not compatible with either cite or mcite themselves.)

Hence you can't use both cite and natbib packages. As you can emulate the functionalities of cite package with natbib itself, remove \usepackage{cite} and add the option sort&compress to natbib package:

\usepackage[sort&compress]{natbib}

You can read more on this in section 2.16, page 18 of natbib guide.

To get citations properly, you have to compile the document with pdflatex the bibtex, again pdflatex & pdflatex.

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.