2

I need the in-text citation style to be author-year, i.e: "Author1, 1999". I have implemented

\renewcommand{\citep}[1]{(\citeauthor{#1},~\citeyear{#1})}

(from this post) which returns what I want if there's only one author. But if there's multiple authors it returns:

(Author1, Author2, 1999, 1998)

What I need is:

(Author1, 1999, Author2, 1998)

How can I do this?

2 Answers 2

2

Instead of changing the citation command, you should set the citation style. As far as I can deduce from the example, in your case this would be:

\setcitestyle{authoryear,comma,aysep{,}}

The first option indicates you will use author year, the second option that the separation between citations needs to be a comma, and the final option that the separation between author and year needs to be a comma.

2
  • This is exactly what I was looking for, thanks!! How can I encolse the citation in parantheses though?
    – PaulG
    Commented Nov 7, 2022 at 16:57
  • The command \citep means you place the citation in parentheses. The alternative is \citet where you place the citation in the running text. In author-year style, this means only the year will be placed in parentheses. Note that both are natbib commands. If you wish to use biblatex as your tag implies, you are better off using \parencite and \textcite. See the answer of @moewe for more on that.
    – cktai
    Commented Nov 8, 2022 at 13:37
2

If you are using biblatex as the tagging suggests, use an authoryear style, set nameyeardelim and \multicitedelim and cite with \autocite.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

\renewcommand*{\multicitedelim}{\addcomma\space}

\DeclareDelimFormat[parencite]{nameyeardelim}{\addcomma\space}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson,worman}
dolor \autocite{nussbaum}

\printbibliography
\end{document}

Lorem (Sigfridsson and Ryde, 1998, Worman, 2002) dolor (Nussbaum, 1978)

It is almost always a bad idea to combine several \...cite commands into a single \newcommand, because commands thus defined cannot deal with multiple citations, need additional help to handle pre- and postnotes and can confuse the various citation tracking features.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .