1

I use

\usepackage[round, sort, numbers]{natbib} 

and

\bibliographystyle{plainnat}.

Then for cite I use \citet{Smith}, in my .bib file:

@article{Smith,
Author = {Smith, D.A.},
Year = {1999},
Title = {Manipulability measures of common social choice functions},
Journal = {Social Choice and Welfare},
Volume = {16},  
Pages = {639-661},
}

in my .bbl the output is

\bibitem[Smith(1999)]{Smith}
D.A. Smith.
\newblock Manipulability measures of common social choice functions.
\newblock \emph{Social Choice and Welfare}, 16:\penalty0 639--661, 1999.

I put \citet{Smith}, but get output in my .tex file as Smith(3), the number instead of the year. How could the author-year be output? like Smith(1999). Any help would be appreciated.

This is my file with all the commands, put into the .cls file

 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
 \ProcessOptions\relax
 \ifx\pdfoutput\undefined
    \LoadClass[dvips, a4paper]{book}
 \else
    \LoadClass[pdftex, a4paper]{book}
  \fi


  \usepackage{amssymb}
  \usepackage{graphics} % for improved inclusion of graphics
 \usepackage[margin=10pt,font=small,labelfont=bf]{caption} % for improved       layout of figure captions with extra margin, smaller font than text
  \usepackage{fancyhdr} % for better header layout
  \usepackage{eucal}
  \usepackage[english]{babel}
  \usepackage[usenames, dvipsnames]{color}
  \usepackage[perpage]{footmisc}
  %\usepackage[round, sort, numbers]{natbib} 
  \usepackage[round, sort, numbers]{natbib}
  %\usepackage[round]{natbib}
  %\usepackage[authoryear,round,colon]{natbib}
  \usepackage{ifthen}
  %\usepackage{multicol} % for pages with multiple text columns, e.g.    References
  \setlength{\columnsep}{20pt} % space between columns; default 10pt quite    narrow
  \usepackage[nottoc]{tocbibind} % correct page numbers for bib in TOC,    nottoc suppresses an entry for TOC itself
  %\usepackage{nextpage}
  %\usepackage{hyperref}
  \usepackage[pdftex]{graphicx}
  \usepackage{amsmath}
  \usepackage{amssymb}
  \usepackage{amsthm}
  \usepackage{color}
  \usepackage[dvipsnames]{xcolor}
  \usepackage{tikz}
  \usepackage{pgfplots}
  \usepgfplotslibrary{fillbetween}
  \usepackage{caption}
  \usetikzlibrary{trees}
  \usepackage{verbatim}
  \usepackage[rightcaption]{sidecap}
  \usepackage{subcaption}
  \usepackage{bm}
  \usepackage{array}
  \usepackage{enumitem}
  \usepackage{multirow}
  \usepackage{floatrow}
  \usepackage{tabularx}
  \usepackage[utf8x]{inputenc} 
  \tikzset{
    treenode/.style = {shape=rectangle, rounded corners,
                  draw, align=center,
                 top color=white, bottom color=blue!20},
root/.style     = {treenode, font=\Large, bottom color=red!30},
env/.style      = {treenode, font=\ttfamily\normalsize},
dummy/.style    = {circle,draw}

}

  • 1
    Welcome to TeX.SE! Did you try it without option numbers for natbib? Can you please show us an short compilable code building your bibliography? – Mensch Oct 25 '18 at 18:48
  • I tried with numbers, I get now Smith[3]... I use a thesis template – Anna Oct 25 '18 at 18:55
  • 1
    You missunderstood me. try \usepackage[round, sort]{natbib}! – Mensch Oct 25 '18 at 19:01
  • It is a huge file, it calls the external file references.bib with \bibliography{9_backmatter/references} – Anna Oct 25 '18 at 19:02
  • I got this error:! Package natbib Error: Bibliography not compatible with author-year citations. without numbers – Anna Oct 25 '18 at 19:03
1

Okay, let us do it step by step.

First: Your given question: to get the wished result you want please try the following MWE (please see that I only used package filecontents to get bib file and tex code together into one MWE):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{Smith,
  Author  = {Smith, D.A.},
  Year    = {1999},
  Title   = {Manipulability measures of common social choice functions},
  Journal = {Social Choice and Welfare},
  Volume  = {16},  
  Pages   = {639--661},
}
\end{filecontents*}


\documentclass[10pt,a4paper]{article}

\usepackage[round, sort]{natbib}  % <======================================


\begin{document}

This is text with \cite{Smith} or \citet{Smith}.

\bibliographystyle{plainnat} 
\bibliography{\jobname}

\end{document}

As you can see you get the result:

enter image description here

Please run my MWE on your computer and confirm that you get the same result.

Second:

Your other problem in your comment, it does not compile at all:

Please check in your log file the first error, create a new question, add there the first error, change my MWE to show your resulting error (for example by adding an second bib entry giving problems) ...

  • I tried it in my thesis.tex file still get the same error.! Package natbib Error: Bibliography not compatible with author-year citations. does it matter if the documentclass is article or book? – Anna Oct 25 '18 at 19:50

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.