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.

Someone asked me to troubleshoot a LaTeX+BibTeX document. The problem, I've found, boils down to an abuse of the author-year system in the citations in the following way:

@article{W1,
   author = {Waldo, W},
   title = {First paper},
   year = {in prep. }
}
@article{W2,
   author = {Waldo, W},
   title = {Second paper},
   year = {in prep. }
}

With the actual document looking like

\documentclass{article}
\usepackage{natbib}
\begin{document}
Cite first \cite{W1}. Cite second \cite{W2}. Cite both \cite{W1,W2}.

\bibliographystyle{plainnat}
\bibliography{test}
\end{document}

For the single citations, it will look correct:

Cite first Waldo [in prep.a]. Cite second Waldo [in prep.b].

But for the two items, it looks like

Cite both Waldo [in prep.a,i]

whereas the author of the document expects it to read

Cite both Waldo [in prep.a,b]

Remark If you replace the "in prep" in the bibtex file above by a made up year, say 2038, the document shows correctly

Cite both Waldo [2038a,b]

Questions:

  1. Why did the numbering switch from alphabetical to roman, and restart from 1?
  2. Most likely this is the incorrect way of abusing the author-year citation style from NatBib to include "in prep" papers. Is there a better way? Or a way to hack this so it would work? The goal is for published papers to show "Author [year]" and for manuscripts in preparation to show "Author [in prep.]", with multiple manuscripts by the same author correctly handled.
share|improve this question
    
@Willy Wong - don't know what style of referencing you are using, but at least according to APA 6th, the in-text citation should be the year of the draft you read - not in preparation (p. 211-22 in the manual). In the reference list, however, it should say "Manuscript in preparation". –  Tormod Nov 22 '11 at 14:31
    
@Tormod: APA has nothing to do with this question (it is not the style guide used for the preparation of this document). The output referred to in the question text is the desired output: for published paper it should show "Author [year]", and for in prep paper it should read "Author [in prep.]" or "Author [in prep.b]" if it is the second of a list of manuscripts in preparation. –  Willie Wong Nov 22 '11 at 15:03
    
The question is about why for years, Natbib correctly produces "Author [1997a,b]", but for manuscripts in prep it shows "Author [in prep.a,i]", and how to fix it. I've edited the question to clarify. –  Willie Wong Nov 22 '11 at 15:05
add comment

1 Answer 1

up vote 7 down vote accepted

Ad 1: The letter "i" in your example is not a roman 1, but the first non-numerical character in the year field ("in prep. "). Replace the contents of year with "still in prep. ", and your example will change to "Waldo [still in prep.a,s]". This is caused by the macro \NAT@parse@date with the following definition:

\def\NAT@parse@date#1#2#3#4#5#6@@{%
  \ifnum\the\catcode`#1=11\def\NAT@year{}\def\NAT@exlab{#1}\else
  \ifnum\the\catcode`#2=11\def\NAT@year{#1}\def\NAT@exlab{#2}\else
  \ifnum\the\catcode`#3=11\def\NAT@year{#1#2}\def\NAT@exlab{#3}\else
  \ifnum\the\catcode`#4=11\def\NAT@year{#1#2#3}\def\NAT@exlab{#4}\else
    \def\NAT@year{#1#2#3#4}\def\NAT@exlab{{#5}}\fi\fi\fi\fi}

Ad 2: Maybe someone is able to hack natbib internals so your example would work. I prefer to use (surprise) biblatex:

\documentclass{article}

\usepackage[style=authoryear-comp]{biblatex}

\DeclareFieldFormat{extrayear}{% = the 'a' in 'Jones 1995a'
  \mknumalph{#1}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{W1,
   author = {Waldo, W},
   title = {First paper},
   year = {in prep. }
}
@misc{W2,
   author = {Waldo, W},
   title = {Second paper},
   year = {in prep. }
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Cite first \textcite{W1}. Cite second \textcite{W2}. Cite both \textcite{W1,W2}.

\printbibliography

\end{document}

enter image description here

share|improve this answer
    
Yet another reason to switch to biblatex. (Unfortunately that is not my document that is being prepared yada yada.) Thanks for the diagnosis: while it doesn't solve the problem, it cleared up where the problem is (and so we were able to work around it). –  Willie Wong Dec 19 '11 at 14:34
add comment

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.