# Using different aliases for textual and parenthetical citations in natbib

I need to define distinct aliases in textual and parenthetical citations for the same reference. For example, I would like \citetalias{Miller2012} to result in "Miller et al. [2012, Paper 1]", while \citepalias{Miller2012} should give "[Miller et al., 2012, Paper 1]".

Is there some way to achieve this by using a generalized version of the natbib command \defcitealias? Are there any alternatives?

I need the paper number to appear together with the year in all citations of this paper. Trying to include "Paper 1" directly in the year field in the .bib file leads to problems when citing several refs at the same time and it seems like an ugly solution.

Thanks for any suggestions!

-
According to the natbib user guide, the commands \citetalias and \citepalias "function much like \citet and \citep: they may take multiple keys in the argument, may contain notes, ...". Assuming that the key to the Miller piece is "miller" and you've already set \defcitealias{miller}{Miller et al.}, you might give \citetalias[2012, Paper 1]{miller} and \citepalias[2012, Paper 1]{miller} a try. –  Mico May 5 '12 at 13:42
The problem with this solution is that I have a large document (> 250 pages) and would like to define the Paper number in one central place, instead scattered throughout the various .tex files. –  Jona May 5 '12 at 14:18
Please consider augmenting your posting to explain in full detail what you're trying to achieve. For instance, is the miller/paper 1 piece the only case, or do you have several such cases? For the case you've stated so far, I'm afraid I don't understand why you're not simply using \citet[Paper 1]{miller} and \citep[Paper 1]{miller}. –  Mico May 5 '12 at 14:27
Mico: I have more than twenty references that require an additional paper number. These numbers are intended to highlight that the author (myself) contributed to the respective papers. Each of these is cited many times throughout the thesis. In total, there are about 400 references. This calls for a centralized solution in my opinion. Furthermore, I would like the paper numbers to appear as well in mixed citations like \citep{numberedpaper,otherpaper}´, where references with paper number "numberedpaper" appear together with those without such a number "otherpaper". –  Jona May 5 '12 at 14:38

"Are there any alternatives?" There's biblatex (which features a natbib compatibility option). The additional package options style=authoryear,maxcitenames=2 should result in an output that is fairly close to natbib. To add ", Paper~x" after the year of some bibentries,

• add the paper number as the usera field in the .bib file for those entries;

• define a bibmacro that will print ", Paper~" plus the content of the usera field if this field is defined;

• add the above bibmaco to the format definition of labelyear (if extrayear is empty) and extrayear;

• in case you don't want ", Paper~x" in the bibliography, add \AtEveryBibitem{\clearfield{usera}}.

\documentclass{article}

\usepackage[style=authoryear,maxcitenames=2,natbib=true]{biblatex}

\newbibmacro*{papernum}{%
\iffieldundef{usera}{%
}{%
Paper~\printfield{usera}%
}%
}

\DeclareFieldFormat{labelyear}{%
\stripzeros{#1}%
\iffieldundef{extrayear}{%
\usebibmacro{papernum}%
}{%
}%
}

\DeclareFieldFormat{extrayear}{%
\iffieldnums{labelyear}
{\mknumalph{#1}\usebibmacro{papernum}}
{\mkbibparens{\mknumalph{#1}\usebibmacro{papernum}}}}

\AtEveryBibitem{\clearfield{usera}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
author = {Author, A.},
year = {2001},
title = {Alpha},
}
@misc{Mil12x,
usera = {1},
author = {Miller, M. and Author, A. and Buthor, B.},
year = {2012},
title = {Malcom},
}
@misc{Mil12y,
usera = {2},
author = {Miller, M. and Author, A. and Buthor, B.},
year = {2012},
title = {Mike},
}
\end{filecontents}

\begin{document}

\citet{Mil12x}

\citep{Mil12x}

\citet{A01,Mil12y}

\citep{A01,Mil12y}

\printbibliography

\end{document}


-
This nearly solves my problem. Thank you very much! One caveat remains: If there are several papers by the same authors in the same year, the labels "a", "b" etc. are added after the paper number! This is misleading however, they should added after the year. –  Jona May 5 '12 at 19:08
Sorry, the full example does not fit into the comment box. Just add @misc{Mil13, usera = {2}, author = {Miller, M. and Author, A. and Buthor, B.}, year = {2012}, title = {Malcom}, }´ to the bib file and cite using `\citet{Mil12,Mil13}´ in the main document. Thanks for any help on this! –  Jona May 5 '12 at 19:11
@Jona I updated my answer. –  lockstep May 5 '12 at 19:47
Thank you very much, this does exactly what I need! ;) –  Jona May 6 '12 at 10:59
@Jona You're welcome -- and please upvote and accept my answer! –  lockstep May 6 '12 at 11:01