1

Is it possible to configure biblatex-chicago to compress a case like "Karasti et al. 2016a, 2016b, 2016c, 2016d" into "Karasti et al. 2016a-d"? If yes, how?

All the four entries have the same author/year combinations but are actually different publications.

If necessary, am happy to provide MWE.

2
  • Please provide an MWE, yes :) Commented Jul 1, 2018 at 16:16
  • 3
    Please do provide an MWE. Your question is reasonably clear without one, but it gives us a good place to start and makes sure that we are all talking about the same thing. It should be possible, but it can be really messy with biblatex-chicago. Since you would not comply with Chicago style with these changes anyway, would it be possible to use one of the standard styles (style=authoryear-comp)?
    – moewe
    Commented Jul 1, 2018 at 16:16

1 Answer 1

5

As it turns out this is a bit more complicated than I initially thought. It is possible to sort this out for the standard style authoryear-comp as shown below, but I'm a bit more sceptical about biblatex-chicago.

Since version 0.5 biblatex-ext includes the styles ext-authoryear-ecomp and ext-authoryear-iecomp with native compression of extradate lists based on the code presented here. See commit e1c4116 on GitHub.

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

\usepackage[style=ext-authoryear-ecomp, backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{hyperref}


\begin{document}
\cite{sigfridsson}

\cite{knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e}

\printbibliography
\end{document}

The solution is similar to what numeric-comp does. The main problem is that biblatex normally does not know what the next entry is because the items in a list of citations are handled one-by-one with little knowledge of the overall list. So it is not entirely trivial to process a list of citations and decide whether or not to skip over a particular citation because it happens to be the b in a-c.

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

\usepackage[style=authoryear-comp, backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{hyperref}

\makeatletter
\newcounter{cbx@extradatecount}

\renewbibmacro*{cite:init}{%
  \ifnumless{\value{multicitecount}}{2}
    {\global\boolfalse{cbx:parens}%
     \global\undef\cbx@lastkey
     \global\undef\cbx@lasthash
     \global\undef\cbx@lastyear
     \global\undef\cbx@lastextradate
     \setcounter{cbx@extradatecount}{0}}
    {\iffieldundef{prenote}
       {}
       {\global\undef\cbx@lastkey
        \global\undef\cbx@lasthash
        \global\undef\cbx@lastyear
        \global\undef\cbx@lastextradate
        \setcounter{cbx@extradatecount}{0}}}}

\renewbibmacro*{cite:reinit}{%
  \global\undef\cbx@lastkey
  \global\undef\cbx@lasthash
  \global\undef\cbx@lastyear
  \global\undef\cbx@lastextradate
  \setcounter{cbx@extradatecount}{0}}

\newcommand*{\extradateonlycompcitedelim}{\addcomma}
\newcommand*{\extradateonlycompciterangedelim}{\bibrangedash}


\newbibmacro*{generic:dump:extradate}{%
  \ifundef\cbx@lastkey
    {}
    {\entrydata{\cbx@lastkey}
       {\ifnumless{\value{cbx@extradatecount}}{1}
          {\blx@warning{% This should not happen, so warn when it does
             Uh-oh!
             The extradate compression is quite likely\MessageBreak
             wrong for \cbx@lastkey}}%
          {}%
        \ifnumgreater{\value{cbx@extradatecount}}{1}
          {\setunit{\extradateonlycompciterangedelim}}
          {\setunit{\extradateonlycompcitedelim}}%
        \usebibmacro{cite:extradate}}%
     \setunit{\cbx@thiscitedelim}}%
  \global\undef\cbx@lastkey
  \setcounter{cbx@extradatecount}{0}%
}

\newbibmacro*{cite:dump:extradate}{%
  \def\cbx@thiscitedelim{\multicitedelim}%
  \usebibmacro{generic:dump:extradate}}

\newbibmacro*{textcite:dump:extradate}{%
  \def\cbx@thiscitedelim{%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}%
    \textcitedelim}%
  \usebibmacro{generic:dump:extradate}}

\newbibmacro*{cite:comp:extradate}{%
  \ifnumequal{\cbx@lastextradate+1}{\thefield{extradate}}
    {\stepcounter{cbx@extradatecount}%
     \savefield{entrykey}{\cbx@lastkey}}
    {\usebibmacro{cite:dump:extradate}%
     \setunit{\extradateonlycompcitedelim}%
     \usebibmacro{cite:extradate}}%
  \savefield{extradate}{\cbx@lastextradate}%
}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:dump:extradate}%
        \usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}%
        \usebibmacro{cite:labeldate+extradate}%
        \usebibmacro{cite:reinit}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                       \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
             {\usebibmacro{cite:comp:extradate}}
             {\usebibmacro{cite:dump:extradate}%
              \setunit{\compcitedelim}%
              \usebibmacro{cite:labeldate+extradate}%
              \savefield{labelyear}{\cbx@lastyear}%
              \savefield{extradate}{\cbx@lastextradate}%
              \setcounter{cbx@extradatecount}{0}}}}
          {\usebibmacro{cite:dump:extradate}%
           \printnames{labelname}%
           \setunit{\printdelim{nameyeardelim}}%
           \usebibmacro{cite:labeldate+extradate}%
           \savefield{namehash}{\cbx@lasthash}%
           \savefield{labelyear}{\cbx@lastyear}%
           \savefield{extradate}{\cbx@lastextradate}%
           \setcounter{cbx@extradatecount}{0}}}
    {\usebibmacro{cite:dump:extradate}%
     \usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}%
  \setunit{\multicitedelim}}

\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\iffieldundef{shorthand}
       {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                    \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
          {\usebibmacro{cite:comp:extradate}}
          {\usebibmacro{textcite:dump:extradate}%
           \setunit{\compcitedelim}%
           \usebibmacro{cite:labeldate+extradate}%
           \savefield{labelyear}{\cbx@lastyear}%
           \savefield{extradate}{\cbx@lastextradate}%
           \setcounter{cbx@extradatecount}{0}}}
       {\usebibmacro{textcite:dump:extradate}%
        \setunit{\compcitedelim}%
        \usebibmacro{cite:shorthand}%
        \global\undef\cbx@lastyear}}
    {\usebibmacro{textcite:dump:extradate}%
     \ifnameundef{labelname}
       {\iffieldundef{shorthand}
          {\usebibmacro{cite:label}%
           \setunit{%
             \global\booltrue{cbx:parens}%
             \printdelim{nonameyeardelim}\bibopenparen}%
           \ifnumequal{\value{citecount}}{1}
             {\usebibmacro{prenote}}
             {}%
           \usebibmacro{cite:labeldate+extradate}}
          {\usebibmacro{cite:shorthand}}}
       {\printnames{labelname}%
        \setunit{%
          \global\booltrue{cbx:parens}%
          \printdelim{nameyeardelim}\bibopenparen}%
        \ifnumequal{\value{citecount}}{1}
          {\usebibmacro{prenote}}
          {}%
        \iffieldundef{shorthand}
          {\iffieldundef{labelyear}
             {\usebibmacro{cite:label}}
             {\usebibmacro{cite:labeldate+extradate}}%
           \savefield{labelyear}{\cbx@lastyear}%
           \savefield{extradate}{\cbx@lastextradate}%
           \setcounter{cbx@extradatecount}{0}}
          {\usebibmacro{cite:shorthand}%
           \global\undef\cbx@lastyear}}%
     \stepcounter{textcitecount}%
     \savefield{namehash}{\cbx@lasthash}}%
  \setunit{%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}%
    \textcitedelim}}

\DeclareCiteCommand{\cite}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:dump:extradate}%
   \usebibmacro{postnote}}

\DeclareCiteCommand*{\cite}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {}
  {\usebibmacro{cite:dump:extradate}%
   \usebibmacro{postnote}}

\DeclareCiteCommand{\parencite}[\mkbibparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:dump:extradate}%
   \usebibmacro{postnote}}

\DeclareCiteCommand*{\parencite}[\mkbibparens]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {}
  {\usebibmacro{cite:dump:extradate}%
   \usebibmacro{postnote}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:dump:extradate}%
   \usebibmacro{postnote}}

\DeclareCiteCommand{\footcitetext}[\mkbibfootnotetext]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:dump:extradate}%
   \usebibmacro{postnote}}

\DeclareCiteCommand{\smartcite}[\iffootnote\mkbibparens\mkbibfootnote]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {}
  {\usebibmacro{cite:dump:extradate}%
   \usebibmacro{postnote}}

\DeclareCiteCommand{\cbx@textcite}
  {\usebibmacro{cite:init}}
  {\usebibmacro{citeindex}%
   \usebibmacro{textcite}}
  {}
  {\usebibmacro{textcite:dump:extradate}%
   \usebibmacro{textcite:postnote}}
\makeatother


\begin{document}
\cite{sigfridsson}

\cite{knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e}

\cite{knuth:ct:b,knuth:ct:c,knuth:ct:d}

\cite{knuth:ct:b,knuth:ct:c,knuth:ct:e}

\cite{knuth:ct:b,knuth:ct:d,knuth:ct:e}

\cite{knuth:ct:c,knuth:ct:d,knuth:ct:e}

\cite{knuth:ct:a,knuth:ct:b,knuth:ct:c}


\cite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e,sigfridsson}

\cite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:d,sigfridsson}

\cite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:e,sigfridsson}

\cite{aksin,knuth:ct:b,knuth:ct:d,knuth:ct:e,sigfridsson}

\cite{aksin,knuth:ct:c,knuth:ct:d,knuth:ct:e,sigfridsson}

\cite{aksin,knuth:ct:a,knuth:ct:b,knuth:ct:c,sigfridsson}

\textcite{sigfridsson}

\textcite{knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e}

\textcite{knuth:ct:b,knuth:ct:c,knuth:ct:d}

\textcite{knuth:ct:b,knuth:ct:c,knuth:ct:e}

\textcite{knuth:ct:b,knuth:ct:d,knuth:ct:e}

\textcite{knuth:ct:c,knuth:ct:d,knuth:ct:e}

\textcite{knuth:ct:a,knuth:ct:b,knuth:ct:c}


\textcite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e,sigfridsson}

\textcite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:d,sigfridsson}

\textcite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:e,sigfridsson}

\textcite{aksin,knuth:ct:b,knuth:ct:d,knuth:ct:e,sigfridsson}

\textcite{aksin,knuth:ct:c,knuth:ct:d,knuth:ct:e,sigfridsson}

\textcite{aksin,knuth:ct:a,knuth:ct:b,knuth:ct:c,sigfridsson}

\textcite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:d,knuth:ct:e,sigfridsson,worman}

\textcite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:d,sigfridsson,worman}

\textcite{aksin,knuth:ct:b,knuth:ct:c,knuth:ct:e,sigfridsson,worman}

\textcite{aksin,knuth:ct:b,knuth:ct:d,knuth:ct:e,sigfridsson,worman}

\textcite{aksin,knuth:ct:c,knuth:ct:d,knuth:ct:e,sigfridsson,worman}

\textcite{aksin,knuth:ct:a,knuth:ct:b,knuth:ct:c,sigfridsson,worman}

\printbibliography
\end{document}

enter image description here

I would not even want to get started doing that for biblatex-chicago. The style is much more complicated than the already tricky authoryear-comp. biblatex-chicago's citation code for dates is longer than the entire authoryear-comp.cbx and the code for cite and textcite is again roughly as long. Additionally, the citation format of the CMS does not even omit the years for citations from the same year and the origyear handling makes that complicated on a conceptual level as well.

You must log in to answer this question.

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