Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have problem displaying the author name in citation when using natbib. I wrote

This is explained in \citeauthor{lamport94}, and what I get is:

enter image description here

, and my entire code is given by:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\PassOptionsToPackage{square,numbers}{natbib}
 \usepackage{natbib}

\makeatother

\usepackage{babel}
\begin{document}
This is explained in \citeauthor{lamport94}.

\begin{thebibliography}{9}
\bibitem{lamport94}   Leslie Lamport,   \emph{\LaTeX: A Document Preparation System}.   Addison Wesley, Massachusetts,   2nd Edition,   1994.
\end{thebibliography}
\end{document}

I wonder what is wrong?

Note: I'm using LyX. I'm aware of thread Author not appearing, but there's no resolution there, and I use \citeauthor{} insteand of \citet{}.

share|improve this question
2  
With natbib the bibliography entry must have a specific format (so that natbib can extract the author information) which is described in the documentation. (2.2 The Syntax of the thebibliography). –  Ulrike Fischer Mar 11 '13 at 9:47
    
@UlrikeFischer Oh, I see. By the way, if I use Bibtex the problem will disappear ? –  user26939 Mar 11 '13 at 10:05
1  
Only if you use a bibliography style which is adapted to natbib and so "produce" correct entries. –  Ulrike Fischer Mar 11 '13 at 10:07
    
@UlrikeFischer Thanks! –  user26939 Mar 11 '13 at 10:44

1 Answer 1

up vote 2 down vote accepted

Using the command \citeauthor, which is provided by the natbib citation management package, only makes sense if you use an authoryear-style citation method. However, you're loading the natbib package with the numbers option, i.e., you're telling it to use a numeric-style citation method.

Hence, if you want to use numeric-style citations, don't use \citeauthor. Aside: When natbib is loaded with the numbers option, the command \citet is modified to behave like \cite and will thus create a numeric-style rather than an authoryear-style callout to the piece in question. However, the \citeauthor command isn't aliased to \cite when the numbers option is set, and that's why you're receiving the error message you're reporting.

Alternatively, if you do wish to use authoryear-style citations along with the natbib package, you should (i) not specify the numbers option when loading the natbib package and (ii) augment the entry in the thebibliography environment to include the optional argument [Lamport (1994)], as is done in the following modified form of your MWE:

\documentclass{article}
\usepackage{natbib}
\begin{document}
\citeauthor{lamport94}

\citet{lamport94}

\begin{thebibliography}{9}
\bibitem[Lamport (1994)]{lamport94}Leslie Lamport,   \emph{\LaTeX: 
   A Document Preparation System}.   Addison Wesley, Massachusetts,   
   2nd Edition,   1994.
\end{thebibliography}
\end{document}

enter image description here

share|improve this answer
    
Thanks. I think the problem in my MWE is that I only have \bibitem{lamport94} ... instead of \bibitem[Lamport (1994)]{lamport94}. I've tried that the \PassOptionsToPackage{square,numbers}{natbib} still allow me to use \citeauthor{} –  user26939 Mar 12 '13 at 8:18
    
@user26939 - I'm glad you've found a workable solution. Don't forget to upvote and/or accept answers that you found useful. :-) –  Mico Mar 12 '13 at 10:55
    
Ok, done ! .... –  user26939 Mar 12 '13 at 14:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.