25

This question led to a new feature in a package:
biblatex

Many biblatex citation styles feature the \textcite command which is "intended for use in the flow of text, replacing the subject of a sentence" (manual, section 3.6.2). At the moment, this works well for citations of single works -- e.g. (assuming the authoryear style), one may write in the source

The reference work is \textcite{knuth:ct:a}.

which will be typeset as

The reference work is Knuth (1984).

Citing multiple works, on the other hand, is somewhat tedious. If one simply writes (1):

Important works are \textcite{knuth:ct:a,knuth:ct:b,markey}.

the output is rather a list than a correct sentence (2):

Important works are Knuth (1984); Knuth (1986); Markey (2005).

One has to write (3):

Important works are \textcite{knuth:ct:a}, \textcite{knuth:ct:b}, and \textcite{markey}.

to get (4):

Important works are Knuth (1984), Knuth (1986), and Markey (2005).

Can \textcite be modified so that input (1) will yield output (4), hereby achieving a tighter integration "in the flow of text"?

\documentclass{article}

\usepackage[style=authoryear]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}

This is how \texttt{\textbackslash textcite} currently works:\\
Important works are \textcite{knuth:ct:a,knuth:ct:b,markey}.

\bigskip

But I'd like \texttt{\textbackslash textcite} to output the following:\\
Important works are \textcite{knuth:ct:a}, \textcite{knuth:ct:b}, and \textcite{markey}.

\printbibliography

\end{document}
David Carlisle
  • 757,742
lockstep
  • 250,273

1 Answers1

22

Upgrade to the the latest biblatex version. As of biblatex 2.7, this feature has been incorporated into all of the standard styles, including authoryear and its variants. Here's an example.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
%\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
%\usepackage[style=authoryear-comp]{biblatex}

\addbibresource{biblatex-examples.bib}
\begin{document}
\subsection*{\texttt{authoryear} and \texttt{\textbackslash textcite}}
%\subsection*{\texttt{authoryear-comp} and \texttt{\textbackslash textcite}}
\textcite{knuth:ct:a,knuth:ct:b} \\
\textcite{knuth:ct:b,markey} \\
\textcite{bertram,knuth:ct:a,knuth:ct:b} \\
\textcite{knuth:ct:a,knuth:ct:b,markey} \\
\textcite{markey,knuth:ct:a,knuth:ct:b,bertram}
\subsection*{\texttt{authoryear} and \texttt{\textbackslash textcites}}
%\subsection*{\texttt{authoryear-comp} and \texttt{\textbackslash textcites}}
\textcites(See)(for example){knuth:ct:a}{knuth:ct:b} \\
\textcites(See)(for example)[cf.][]{knuth:ct:b}[9--18]{markey} \\
\textcites[10--15]{knuth:ct:a}[cf.][]{knuth:ct:b}[9--18]{markey} \\
\textcites{bertram}{markey}{knuth:ct:a}{knuth:ct:b} \\
\textcites{companion}{knuth:ct:a}{knuth:ct:b} \\
\textcites{aristotle:poetics}{aristotle:rhetoric}{knuth:ct:a}{knuth:ct:b}
\end{document}

Here's the output with authoryear and american localization, which enables serial commas:

enter image description here

Here's the output with authoryear-comp and american localization:

enter image description here

Use of serial commas is not straightforward in nested lists, particularly in the verbose styles. Suggestions for improvements can be submitted to the biblatex github repo.

David Carlisle
  • 757,742
Audrey
  • 28,881
  • This is great! If I may ask a follow-up-question: Can you also modify \textcite for the authoryear-comp style so that my original example would result in Important works are Knuth (1984, 1986), and Markey (2005).? – lockstep Sep 14 '11 at 22:08
  • @lockstep I'll take a look. You know, that comma before "and" (, and) bothers me. Are you wanting the comma to handle the case where maxcitenames > 1and the first citation is a two-author work? For example:Smith and Doe (1998), and Markey (2005)`? – Audrey Sep 14 '11 at 22:17
  • Yes, this is a great solution. I'll delete mine. – Gonzalo Medina Sep 14 '11 at 22:19
  • I think the comma before "and" is required in English for "enumerations" with at least three elements. On second thought, a) my example should read Knuth (1984, 1986) and Markey (2005) b) one would need to differentiate between \textcite with two vs. with at least three works in its argument. – lockstep Sep 14 '11 at 22:23
  • @lockstep So "elements" are (possibly compact) citations? In the multicite setting knowing the total number of citations from the outset can get tricky for cases like: \textcites{<key1>}{<key2>,<key3>}. Here multicitetotal is 2. In order of iteration citetotal is: 1, 2, 2. – Audrey Sep 14 '11 at 22:44
  • Re: "elements" -- indeed. But I don't think that cases like \textcites{<key1>}{<key2>,<key3>} are of practical importance. – lockstep Sep 14 '11 at 22:46
  • @lockstop Turns out that case isn't a problem. Getting the final delimiter right before a compact citation is tricky, though. I'll update this post to cover off the final delimiter issue in authoryear. But for authoryear-comp, I'll need to find some more spare time to take a closer look at it. – Audrey Sep 15 '11 at 15:34
  • @Audrey: Accepted right now. I'm looking forward to an authoryear-comp solution, and your code should make it into the biblatex core. – lockstep Sep 15 '11 at 15:50
  • @lockstep Getting the solution for authoryear-comp wasn't very difficult after all, thanks to Marco's feature request. My first update didn't handle multipostnote, but it does now. It will also handle the mix of qualified and unqualified citations lists we discussed earlier - I just neglected to include an example. – Audrey Sep 16 '11 at 16:31
  • @Audrey: Is your answer to my question somehow part of Marco's feature request, or should I (or possibly you) add another feature request at sourceforge.biblatex? – lockstep Sep 16 '11 at 16:36
  • @lockstep No, Marco's request won't cover this answer. It is very specific to the problem considered in henrique's question on defining a \textcite command for verbose styles. Another feature request is probably in order. I'd rather have it come from you, but if you insist I could post a request myself. – Audrey Sep 16 '11 at 16:55
  • Just trying to clean up some feature requests - was this implemented does anyone know? I see this feature request, perhaps just a duplicate: https://sourceforge.net/p/biblatex/features/145/ – PLK Jan 29 '13 at 11:06
  • 2
    @PLK No. I'll look at it within the next few months. This question is related to a more recent one: http://tex.stackexchange.com/q/89625/4483 – Audrey Jan 29 '13 at 14:22
  • @Audrey Thanks again for looking into this. It would be great if this feature is implemented for all authoryear variants ("bare", comp, ibid, icomp) and possibly for the other style families as well. – lockstep Feb 16 '13 at 11:09
  • @lockstep We've made progess on this issue here. If you're interested in testing, pull the dev branch from the github repo and install with, say, /build/build.sh install 2.7 ~/texmf/. The resulting version requires the latest biber, but the updated \textcite output is backend-invariant. – Audrey Jun 06 '13 at 13:48
  • @lockstep : does this also work with \cites (instead of \textcites)? It seems that it does not. What speaks against it? It would be nice to be able to have a footnote \footnote{Cf. \cites[23]{key1}[99]{key2}[15]{key3}} rendered as Cf. Author1, work1, pp. 23; Author2, work2, pp. 99; **and** Author3, work3, pp. 15. -- Using \footcites here creates a reference including brackets wich is not suitable for footnotes. (Using authortitle-comp) – ClintEastwood Jan 03 '14 at 06:21
  • @lockstep : (and the same question applies to \footcites[23]{key1}[99]{key2}[15]{key3} as well.) – ClintEastwood Jan 03 '14 at 06:28
  • @ClintEastwood The new feature applies only to commands based on \textcite because its output forms part of a sentence. Other citation commands are generally parenthetical. Most style guides delimit parenthetical citation lists with semicolons. – Audrey Jan 14 '14 at 16:32
  • @math It is possible, but you wouldn't re-define \textcite that way - probably something like \AtNextCite{<swap and string with or string>}\textcite. This comment trail is long enough, so please ask a new question. – Audrey Feb 26 '14 at 01:25