11

This question is about author-year citations using biblatex where citations are set inline in parentheses.

Sometimes, it is necessary to cite two authors and to specify some connection between them using a 'joining word'. [Is there a technical term for this?]

For example:

Marvin 2009, citing Arthur 2007

or:

Marvin 1333, interpreting Dent 1245

More specifically, I want this typeset as an in-text citation in parentheses:

(Marvin 2009, citing Arthur 2007)

or:

(Marvin 1333, interpreting Dent 1245)

I cannot figure out how to do this at all, or at all elegantly, using biblatex. The closest I've come is

  1. a version which uses a semicolon rather than a comma;
  2. a long-winded hack which fails if one of the entries has no author.

attempts at citation

\documentclass{article}
\usepackage[citestyle=authoryear-comp,bibstyle=authoryear,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}

  Desired output is (CTAN 2006, interpreting Gillies 1933).

  The following are almost correct except that they use the default delimiter (of course) so I have a semicolon rather than a comma: \autocites{ctan}[interpreting][]{gillies} or \parencites{ctan}[interpreting][]{gillies}.

  The following is a bit long-winded. Worse, it fails if an entry does not actually have an author: \parentext{\citeauthor{ctan} \citeyear{ctan}, interpreting \citeauthor{gillies} \citeyear{gillies}}.

\end{document}

Note that redefining the delimiter between citations from a semicolon to a comma is not a good solution as the semicolon is correct for almost all occurrences of multiple citations (all bar 2 in my paper). Only when there is a special 'joining word' do I want the comma instead.

I'm wondering if I need to define a new citation command. That's fine but I'd like to know that I'm not missing something before I reinvent the wheel and end up with a lop-sided parallelogram instead of the roundish circle I could more easily have used.

It seems surprising if there is no straightforward way to do this as it seems like a fairly common thing to want to do. Hence, I suspect I'm missing some obvious solution and just can't find it.

What is the most elegant way to arrange such citations?

  • 6
    Perhaps this is one situation where the simple solution is best. What I have done is manually type the parentheses, insert the first cite command, type the necessary text including punctuation in between, then the closing citation. E.g. (\cite{CTAN 2006}, interpreting \cite{Gillies 1933}). Of course you need to customise/choose the cite commands depending on your house style. – penguinpreferred Nov 21 '14 at 1:24
  • @penguinpreferred Thanks! You mean (\cite{ctan}, interpreting \cite{gillies})? biblatex just seems so comprehensive I expected it to have some facility for this! – cfr Nov 21 '14 at 1:28
  • 2
    Yes. I actually saw that myself and made the edit before your comment came in. I'm not sure if biblatex does or not have this facility. My choice to go this way was based on the flexibility it offered. Sometimes, as you observed, you may need to rephrase the "connection" text. – penguinpreferred Nov 21 '14 at 1:30
  • Do you think you could move that edit of yours into the answer space? It is an answer after all, albeit one you see as far from elegant, though I think it is reasonably nice. – moewe Aug 16 '15 at 7:38
  • @moewe Done - though I'm really not sure it counts as an answer.... – cfr Aug 18 '15 at 22:38
5

One solution is to use a multicite approach and redefine the \multicitedelim appropriately following “And” between last and second last cite using the \footcites command and authoryear-icomp.

\newcommand{\interp}[1]{%
  \renewcommand*{\multicitedelim}{%
    \ifnumequal{\value{multicitecount}}{\value{multicitetotal}}
      {\addcomma\space\printtext{#1}}
      {}%
    \space}%
  \renewcommand*{\textcitedelim}{%
    \ifnumequal{\value{multicitecount}}{\value{multicitetotal}}
      {\addspace\printtext{#1}}
      {}%
    \space}%
}

We then simply define new multicitecommands

\DeclareMultiCiteCommand{\citeint}[\interp{interpreting}]{\cite}{\setunit{\multicitedelim}}
\DeclareMultiCiteCommand{\citesla}[\interp{slagging off}]{\cite}{\setunit{\multicitedelim}}
\DeclareMultiCiteCommand{\citepint}[\interp{interpreting}\mkbibparens]{\parencite}{\setunit{\multicitedelim}}
\DeclareMultiCiteCommand{\citepsla}[\interp{slagging off}\mkbibparens]{\parencite}{\setunit{\multicitedelim}}
\makeatletter
\DeclareMultiCiteCommand{\citetint}[\interp{interpreting}\cbx@textcites@init\cbx@textcites]{\textcite}{\setunit{\multicitedelim}}
\DeclareMultiCiteCommand{\citetsla}[\interp{slagging off}\cbx@textcites@init\cbx@textcites]{\textcite}{\setunit{\multicitedelim}}
\makeatother

Which we can then use as

\citeint{ctan}{gillies} and \citesla{ctan}{gillies}

You can also use your initial idea of \parencites{ctan}[interpreting][]{gillies}

if you issue a

\AtNextCite{\renewcommand{\multicitedelim}{\addcomma\space}}

before the citation command.

As in

\AtNextCite{\renewcommand{\multicitedelim}{\addcomma\space}}
\parencites{ctan}[interpreting][]{gillies}

MWE

\documentclass{article}
\usepackage[citestyle=authoryear-comp,bibstyle=authoryear,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\newcommand{\interp}[1]{%
  \renewcommand*{\multicitedelim}{%
    \ifnumequal{\value{multicitecount}}{\value{multicitetotal}}
      {\addcomma\space\printtext{#1}}
      {}%
    \space}%
  \renewcommand*{\textcitedelim}{%
    \ifnumequal{\value{multicitecount}}{\value{multicitetotal}}
      {\addspace\printtext{#1}}
      {}%
    \space}%
}

\DeclareMultiCiteCommand{\citeint}[\interp{interpreting}]{\cite}{\setunit{\multicitedelim}}
\DeclareMultiCiteCommand{\citesla}[\interp{slagging off}]{\cite}{\setunit{\multicitedelim}}
\DeclareMultiCiteCommand{\citepint}[\interp{interpreting}\mkbibparens]{\parencite}{\setunit{\multicitedelim}}
\DeclareMultiCiteCommand{\citepsla}[\interp{slagging off}\mkbibparens]{\parencite}{\setunit{\multicitedelim}}
\makeatletter
\DeclareMultiCiteCommand{\citetint}[\interp{interpreting}\cbx@textcites@init\cbx@textcites]{\textcite}{\setunit{\multicitedelim}}
\DeclareMultiCiteCommand{\citetsla}[\interp{slagging off}\cbx@textcites@init\cbx@textcites]{\textcite}{\setunit{\multicitedelim}}
\makeatother

\begin{document}
  Desired output is (CTAN 2006, interpreting Gillies 1933).

  \autocites{ctan}{gillies}

  \citepint{ctan}{gillies} and \citepsla{ctan}{gillies}

  \citetint{ctan}{gillies} and \citetsla{ctan}{gillies}

  \citeint{ctan}{gillies} and \citesla{ctan}{gillies}

  \autocites{ctan}{gillies}
\end{document}

enter image description here

  • 2
    This looks nice. I still find it surprising there's nothing in Biblatex for this as it just seems quite an ordinary thing to want to do! I haven't had a chance to actually try this out, yet, though.... – cfr Aug 18 '15 at 22:37
  • @cfr It's probably nothing the developers have ever lost sleep over. I wouldn't say that phrases are very common in mathematics and physics (I might be mistaken there), I would have placed them in the humanities. Many LaTeX developers come ultimately from mathematics or natural sciences and related fields. And it is fairly easy to hack something (maybe not entirely elegant, but usable) together if push comes to shove. – moewe Aug 19 '15 at 6:01
  • You're right. I realised after I wrote it that it might be discipline-specific, at least in the broad sense of 'discipline'. – cfr Aug 19 '15 at 12:24
  • I'm still trying to find a solution I really like for this and I have to admit that I've not accepted your answer because I'm still using my inelegant one as it is easier for me to use. Would it be terrible to use \newbibmacro*{connectcites:multipostnote}{% \setunit{\addcomma\space}% \iffieldundef{multipostnote} {\printtext{quoting}} {\printfield{multipostnote}\clearfield{multipostnote}}% \space} \DeclareMultiCiteCommand{\pconnectcites}[\mkbibparens]{\parencite}{\usebibmacro{connectcites:multipostnote}} ? See example below. Ignore if you don't care/don't have time/etc. ;). – cfr Feb 4 '16 at 2:50
  • 1
    @cfr That approach works as well and I wouldn't dare say it is more hacky or ugly than what I came up with above. – moewe Feb 4 '16 at 7:51
3

EDIT

Or... er... this gets me the same output as shown below with the same document content:

\newbibmacro*{connectcites:multipostnote}{%
  \setunit{\addcomma\space}%
  \iffieldundef{multipostnote}
    {\printtext{quoting}}
    {\printfield{multipostnote}\clearfield{multipostnote}}%
    \space}
\DeclareMultiCiteCommand{\pconnectcites}[\mkbibparens]{\parencite}{\usebibmacro{connectcites:multipostnote}}

But it probably violates the Biblatex Bible in a hundred different ways....

MWE:

\documentclass{article}
\usepackage[citestyle=authoryear-comp,bibstyle=authoryear,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\newbibmacro*{connectcites:multipostnote}{%
  \setunit{\addcomma\space}%
  \iffieldundef{multipostnote}
    {\printtext{quoting}}
    {\printfield{multipostnote}\clearfield{multipostnote}}%
    \space}
\DeclareMultiCiteCommand{\pconnectcites}[\mkbibparens]{\parencite}{\usebibmacro{connectcites:multipostnote}}


\begin{document}

  \pconnectcites(interpreting){ctan}{gillies}

  \pconnectcites[see][56]{ctan}[details from][47--89]{gillies}

  \pconnectcites(interpreting)[based on][87]{ctan}[original argument in][32]{gillies}

  \pconnectcites(interpreting)[98]{ctan}[67]{gillies}

  \pconnectcites(interpreting)[see][]{ctan}[an earlier version in][]{gillies}

\end{document}

Original Answer

At moewe's request, I'm posting this as an 'answer' although I don't really consider it one since it is so very far from elegant!

Using penguinpreferred's suggestion and xparse, I come up with this:

\NewDocumentCommand \pconnectcites { D() {quoting} o o m o o m }{%
  \parentext{%
    \IfNoValueTF{#3}{%
      \IfNoValueTF{#2}{%
        \cite{#4}%
      }{%
        \cite[#2]{#4}%
      }%
    }{%
      \cite[#2][#3]{#4}%
    }%
    , #1 %
    \IfNoValueTF{#6}{%
      \IfNoValueTF{#5}{%
        \cite{#7}%
      }{%
        \cite[#5]{#7}%
      }%
    }{%
      \cite[#5][#6]{#7}%
    }%
  }%
}

which allows me to say:

  \pconnectcites(interpreting){ctan}{gillies}

  \pconnectcites[see][56]{ctan}[details from][47--89]{gillies}

  \pconnectcites(interpreting)[based on][87]{ctan}[original argument in][32]{gillies}

  \pconnectcites(interpreting)[98]{ctan}[67]{gillies}

  \pconnectcites(interpreting)[see][]{ctan}[an earlier version in][]{gillies}

to produce:

pconnectcites

  • Though I can't do the same thing for a \tconnectcites all I get in that case is the single word 'quoting' ! No doubt, why should be obvious... but isn't... – cfr Feb 4 '16 at 3:56
  • \textcite is always a special case because one needs to take care of some subtleties when implementing it, so the \DeclareMultiCiteCommands are a bit different there. Unfortunately, I couldn't get your solution to work with \textcite, maybe I will have more success later (if I don't forget) ... – moewe Feb 4 '16 at 7:54
  • @moewe Thanks. I took a look and realised that the \textcite stuff was doing something different. I couldn't quite see why it ate everything, but I did figure that must be the reason. (I can get it to work with \cite, for example, just fine.) – cfr Feb 4 '16 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.