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.
\citeauthor{iso9241-5,ansi2007,osha3092}

produces

International Organization for Standardization; Human Factors and Ergonomics Society; Occupational Safety and Health Administration

Is there a pretty command to make it produce

International Organization for Standardization, Human Factors and Ergonomics Society and Occupational Safety and Health Administration

so I don't have to write

\citeauthor{iso9241-5}, \citeauthor{ansi2007} and \citeauthor{osha3092}
share|improve this question
    
One could guess natbib is the package, as it is in the list of tags. The style is not yet revealed though. I was interested in the same matter though. I used the plainnat style. –  aghsmith Sep 8 '11 at 20:15
    
The command \citeauthor is the give-away that the citation management package is natbib. :-) –  Mico Sep 8 '11 at 20:32

4 Answers 4

up vote 2 down vote accepted

To format the punctuation of natbib the package provides the command \setcitestyle The character between citations can be set in the following way:

\setcitestyle{comma}

which is equal to

\setcitestyle{citesep={,}}

Here an example that can do what you want: (A bug is possible)

\documentclass{book}
\usepackage{lipsum}
\usepackage{natbib}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{test,
author={John Smith},
title={TITLE},
year={2011},
publisher={...},
}
@book{test1,
author={Theodor Fontane},
title={Zaubefloete},
year={1000},
publisher={...},
}
@book{test2,
author={Wolfgang Goethe},
title={Irgendwas},
year={1000},
publisher={...},
}
\end{filecontents*}
\makeatletter
\newcount\nat@length@list
\newcount\nat@tempcount
\renewcommand\NAT@sort@cites[1]{%
  \let\NAT@cite@list\@empty
  \nat@length@list=0%
  \@for\@citeb:=#1\do{%
     \global\advance\nat@length@list\@ne%
     \expandafter\NAT@star@cite\@citeb\@@}%
  \if@filesw
    \expandafter\immediate\expandafter\write\expandafter\@auxout
      \expandafter{\expandafter\string\expandafter\citation\expandafter{\NAT@cite@list}}%
  \fi
  \@ifnum{\NAT@sort>\z@}{%
    \expandafter\NAT@sort@cites@\expandafter{\NAT@cite@list}%
  }{}%
}%
%
\def\NAT@def@citea@close{%
 \def\@citea{%
     \NAT@@close%
     \ifnum\nat@length@list=2
         \NAT@space and\NAT@space%
      \else
         \NAT@separator\NAT@space%
      \fi
      \advance\nat@length@list-\@ne%
   }%
}

\makeatother
\begin{document}

\citeauthor{test,test1,test2}
\bibliography{\jobname.bib}
\bibliographystyle{plainnat}
\end{document} 

enter image description here

share|improve this answer

Here's a possible solution; instead of modifying the \citeauthor command, I defined a new \CiteList command to do what you want: it takes a comma separated list of bibliographical keys and calls \citeauthor for each element, using \MidSep (initially defined as a comma followed by a space) as separator except for the last two elements which will be separated using \LastSep (initially defined as the word "and" surrounded by spaces). Redefining \LastSep and \MidSep you can easily customize the style:

\begin{filecontents*}{mybiblio.bib}
@book{goossens93,
 author = "Michel Goossens and Frank Mittlebach and Alexander Samarin",
 title = "The {LaTeX} Companion",
 year = "1993",
 publisher = "Addison-Wesley",
 address = "Reading, Massachusetts"
}

@book{knuth84,
   author = "Donald E. Knuth",
   title= "The {TeX}book",
   publisher = "Addison-Wesley",
   year = 1984
}

@unpublished{patashnik88,
   author = "Oren Patashnik",
   title = "Using {BibTeX}",
   note = "Documentation for general BibTeX users",
   month = jan,
   year = 1988
}
\end{filecontents*}

\documentclass{article}
\usepackage{natbib}

\makeatletter
\newcommand\MidSep{, }% separator for two elements, not the last two
\newcommand\LastSep{ and }% separator for last two elements
\newcommand\CiteList[1]{%
  \let\last@elem\relax
  \let\last@sep\relax
  \@for\@list:=#1\do{%
    \ifx\last@elem\relax\else
      \ifx\last@sep\relax
        \def\last@sep{\LastSep}% the separator between the last two elements should is "and"
      \else\MidSep  % the separator between two elements (not the two last) is a comma
      \fi
      \citeauthor{\last@elem}%
    \fi
    \let\last@elem\@list
  }% the last element of the list:
  \ifx\last@elem\relax\else
    \last@sep\citeauthor{\last@elem}%
  \fi
}
\makeatother

\begin{document}

\CiteList{goossens93,knuth84,patashnik88}

\renewcommand\LastSep{/}
\renewcommand\MidSep{/}
\CiteList{goossens93,knuth84,patashnik88}

\bibliographystyle{plainnat}
\bibliography{mybiblio}

\end{document}

enter image description here

share|improve this answer

In natbib, to force the separator between citations (created, say, via \citeauthor) to be a comma instead of a semicolon, you'd type the following in the preamble (after loading the natbib package):

\setcitestyle{citesep={,}}

However, this change won't insert a nice "and" between the penultimate and final items of the list, which is what you want, right? I guess you'll have to type \citeauthor{iso9241-5, ansi2007} and \citeauthor{osha3092}. Not a huge improvement over your initial idea, but at least a small step in the right direction...

share|improve this answer
    
See the second paragraph, which I added after realizing that I'd hit the "Post Your Answer" button prematurely. :-) –  Mico Sep 8 '11 at 20:27

Here is an hack inspired by the more elegant approaches of Marco and Mico that provides a \citeauthors command without using TeX primitives.

\setcitestyle{comma}
\newcommand\citeauthors[2]{\citeauthor#1 and \citeauthor#2}
\citeauthors{john,paul,george}{ringo}

But Marco still wins.

share|improve this answer

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.