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'm trying to convert my manuscript to PloS Comp Bio style. They provide a BibTeX style file. This works fine for inline citations with \usepackage[numbers,sort&compress]{natbib} (i.e. \citep{FooYear} -> [1]).

However, this style file does not seem to be compatible with the natbib \citet command. Whenever I use this I get \citet{FooYear} -> "(author?) [1]" (the reference to the author's name is unresolved). What I want is to display a reference to the author (i.e. "Foo & Smith [1]". Obviously, I could fix this manually, but I have quite a large number of cases in the manuscript.

If I use a different BibTeX style then the citations work fine but then the bibliography is not formatted correctly.

Minimum example

As suggested below here is a minimum example.

\documentclass{article}
\usepackage[numbers]{natbib}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{A01,
   author = {Test, A. and Foo, B.},
   year = {2001},
   title = {Alpha},
}
@misc{A02,
   author = {Alex, A. and Bar, B.},
   year = {2005},
   title = {Alpha},
}
\end{filecontents}

\begin{document}

% These citations will work but in the apalike bibstyle they will not be sorted
% in citation order (the first citation is [2]).
\citep{A01}, \citep{A02}, \citet{A02} 

% The author name will be undefined with the unsrt bibtex style
\citeauthor{A02}, \citet{A01}

\bibliography{\jobname}
\bibliographystyle{unsrt}
%\bibliographystyle{apalike}

\end{document}
share|improve this question
    
Welcome to TeX.SE! –  Mico Apr 18 '12 at 15:47
    
I ended up solving this by switching to biblatex see this question –  jjh May 17 '12 at 5:52

2 Answers 2

You observe:

However, [the plos.bst] style file does not seem to be compatible with the natbib \citet command.

You may be mixing up two aspects of the process of creating (i) a bibliography and (ii) citations to entries in the bibliography. The first aspect -- determining how entries are typeset in the bibliography -- is handled by the bibliography style file (plos.bst in your case). The second aspect -- how citations/references to entries in the bibliography are formatted -- is handled by natbib.

By loading natbib with the numbers option, you are actually instructing the package to create numeric-style citations. If you want authoryear-style citations -- as would seem to be indicated by your attempted use of the \citet command -- you must specify the authoryear option instead.

Incidentally, when natbib is set to perform authoryear-style citations, specifying the option sort&compress is not necessary (and has no effect).

Addendum: From the OP's follow-up comments, I gather that a hybrid between "pure" numeric and authoryear citation styles -- viz., a combination of the author's (or authors') name and the associated citation number -- is what's needed. If this interpretation is correct, the following command may be of use (to be placed in the preamble):

\newcommand{\hybridcite}[1]{\citeauthor{#1} \citenum{#1}}

Invoking \hybridcite{People} (assuming that People is the key to an entry which is listed first in the references and which has two authors, named Author1 and Author 2) will then generate the citation Author1 and Author2 [1].

share|improve this answer
    
Sorry I wasn't clear [I'll try and edit the question to make this clearer]. I want my citation format according to the plos2009.bst style file. I also want numeric-style citation so that citep{Test} is transformed into something like "[1]". However, I also want to be able to use \citet when I'm discussing a paper directly (i.e "\citet{People} did some amazing work on ..." which should become "Author1 & Author2 [3] did some amazing work on ..." –  jjh Apr 18 '12 at 23:53
    
This works fine when using a different bibtex style that is not designed for authoryear citations. However, in this case the bibliography is not formatted correctly (in particular, it is not ordered by citation order). –  jjh Apr 18 '12 at 23:55
    
Please see the addendum I've provided. I now understand that you're looking for a hybrid citation command that lists both the authors and the number of a given reference. To simplify this task, I suggest in the addendum that you use a new command, say \hybridcite, that combines the outputs of \citeauthor and \citenum. –  Mico Apr 19 '12 at 3:09
    
Thanks for your continuing help @Mico. That is exactly what I want to do. However, \citeauthor is also undefined with this bibtex style file (so \citenum{Test} -> "1" but \citeauthor{Test} -> "(author?)"). I think the issue is that bibtex styles which are made for numerical citation don't seem to include the author info. –  jjh Apr 19 '12 at 3:34
    
I'm afraid I don't understand the issue. \citeauthor and \citenum are commands that are defined in the natbib package, independently of the bibliography style file in use. Please consider posting a MWE (minimum working example) that generates the problems you're encountering. –  Mico Apr 19 '12 at 3:44

It's been 7 months since the question was brought up, but as I came up with the very same problem I'd like to share with anyone looking for a solution what I found out when dealing with the same.

If we look into natbib.sty we will find:

 % With standard numerical .bst files, only numerical citations are
 % possible. With an author-year .bst file, both numerical and
 % author-year citations are possible.

Pretty much self-explanatory. So, after trying to edit the original .bst file, which is quite easy for minor retouch but impractical for bigger issues, I ended up generating my own .bst file.

On any terminal just execute latex makebst and answer the questions prompted. Make sure to choose Author-year with some non-standard interface instead of Numerical as in standard LaTeX when asked for STYLE OF CITATIONS. Basically, the executable will ask you question about how you want you References to look like, more information at CTAN/custom-bib.

share|improve this answer
    
Welcome to TeX.sx! –  henrique Nov 23 '12 at 22:50

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.