80

I would like to show the author names using \citet but I get just the reference number. Here is a minimal code:

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{natbib}

\begin{document}

 The author \citet{toschi09} has shown that ..

\bibliographystyle{plain}
\bibliography{foo}

\end{document}

And here is foo.bib

@article{toschi09,
author = {Toschi, F. and Bodenschatz, E.},
title = {Lagrangian Properties of Particles in Turbulence},
journal = {Annual Review of Fluid Mechanics},
volume = {41},
number = {1},
pages = {375-404},
year = {2009}, 
}

What I get is:

The author (author?) [1] has shown that ..

Any help will be more than welcome, thank you!

egreg
  • 1,121,712
keynes
  • 1,617
  • 8
    Does switching to \bibliographystyle{plainnat} help? – Torbjørn T. Mar 21 '14 at 10:46
  • @TorbjørnT. yes Thank you! it works! but what is the file which is created .aux I got a message with regard to it – keynes Mar 21 '14 at 10:58
  • 1
    The .aux file is a temporary file that is created when you compile a document. It contains among other things all the citation commands you used. When you run bibtex, it reads this file, finds all those citations, extracts the corresponding information from the .bib file, and generates the bibliography (the .bbl file). The next time you run pdflatex, this bbl file is read, and you get a bibliography. – Torbjørn T. Mar 21 '14 at 11:08
  • @TorbjørnT. Thank you a lot for your explanations – keynes Mar 21 '14 at 11:11

5 Answers5

66

The plain bibliography style is for numerical references only, while \citet only makes sense for author-year citations. Use natbibs own version of plain, called plainnat, instead, and this works fine. I.e. change to

\bibliographystyle{plainnat}

This is in fact documented on page 7 of natbibs manual:

The authors can only be listed if the .bst file supports author–year citations. The standard .bst files, such as plain.bst are numerical only and transfer no author–year information to LaTeX. In this case, \citet prints “(author?) [21].”

Torbjørn T.
  • 206,688
  • 5
    Is there some hack that can make this work without changing style? I am forced to use amsplain but I have a lot of citet. I don't want to add author name everywhere manually. – NonalcoholicBeer May 07 '19 at 14:39
  • @ablmf Find-and-replace \citet with \cite? I don't know amsplain, but if it's a numerical style then one wouldn't usually have both author name and number, would one? If you are after both, then I'd suggest asking a new question about it. – Torbjørn T. May 07 '19 at 14:47
  • Is there any way to do this in a way that preserves numbered ranges, like the unsrt bibliography class? I want to use \citet to refer to authors in sentences, but still allow for numbered ranges (e.g. [55-63]) for compact citations. – MRule Mar 08 '21 at 11:14
  • Answering my own question: see this answer – MRule Mar 08 '21 at 11:15
  • @MRule I suggest you post a new question, I don't know. – Torbjørn T. Mar 08 '21 at 11:15
19

I was getting this problem with a custom-generated bibliography style (using Patrick Daly's custom-bib generator, merlin.mbs). The solution (pointed out to me very helpfully by Patrick) is to generate a style using author-year citations, but use the "numbers" option in the LaTeX document, i.e. in the .dbj file produced by merlin.mbs, uncomment the line

ay,%: Author-year

and in the .tex file specify

\usepackage[numbers]{natbib}
  • Is there any way to do this in a way that preserves numbered ranges, like the unsrt bibliography class? I want to use \citet to refer to authors in sentences, but still allow for numbered ranges (e.g. [55-63]) for compact citations. – MRule Mar 08 '21 at 11:14
  • Answering my own question: see this answer – MRule Mar 08 '21 at 11:15
5

For those who are also confused by these kinds of problem: Please check there should be not space in the cite command. You should write \cite{aa,bb,cc} instead of \cite{aa, bb, cc}.

maple
  • 151
  • Thanks, simple and clear answer, which solved my problem quickly. I was difficult to replicate the problem and explain it as the error doesn't tell you much about it. – Aryan Firouzian May 14 '19 at 11:50
3

In case of the IEEEtran document class, one has to replace

\bibliographystyle{IEEEtran}

by

\bibliographystyle{IEEEtranN}
koppor
  • 3,252
1

For Lyx users, remember that in Lyx bibliography settings are configured in two places:

Document / Settings / Bibliography

Click on Document / Settings / Bibliography to open this configuration dialog: enter image description here Here you can set the citation style format to natbib author year.

The BibTex bibliography dialog

The first time, click on Insert / List TOC / Bib(la)Tex Bibliography to insert this dialog at the end of your document. For future edit simply click on the BibTex bibliography dialog at the end of your document.

enter image description here

This is where you should change the style to plainnat [author year] or apalike (author year). This citation key style will then be used by the \citep{} and \citet{} in your text as well as in the bibliography section.