2

This is a follow-up question to a previous question I asked about "How to tweak volcite in biblatex-chicago to cite volume and page using Arabic numerals separated by a colon".

I would like to know if there is any way (when using a colon to separate volume and page references, but only when both a volume and a page are given) to further instruct biblatex-chicago to omit the comma between citation and volume/page number when both of the following conditions apply:

  1. a shorthand field is being used (i.e., the bib entry has a non-empty shorthand field AND biblatex-chicago has been set up to use shorthands AND the conditions are such that this particular citation will in fact be using that shorthand)
  2. both a volume and a page are indicated in the cite command (e.g., \volcite{5}[102]{CCAG:astrology})

MWE:

\documentclass{article}

\usepackage[notes]{biblatex-chicago}

\begin{filecontents*}{\jobname.bib}
@book{CCAG:astrology,
    Address = {Brussels},
    Date = {1898/1953},
    Editor = {Cumont, Franz},
    Title = {Catalogus codicum astrologorum graecorum},
    Shorthand = {\emph{CCAG}}}
\end{filecontents*}
\addbibresource{\jobname.bib}

% VOLCITE USING COLON (solution by David Purton)
\renewcommand*{\volcitedelim}{\addcolon}
\renewrobustcmd*{\mkvolcitenote}[2]{%
  \ifblank{#2}
    {\printtext[volcitevolume]{#1}}
    {\printtext{#1}\volcitedelim\printtext{#2}}}

\begin{document}
\volcite{5}[102]{CCAG:astrology}.\mancite

\volcite{5}[102]{CCAG:astrology}.
\end{document}

I would like the output of the second paragraph to be

CCAG 5:102.

instead of

CCAG, 5:102.

but would like everything else to remain the same.

  • Do you need "ibid."? And if so should it always output "ibid., 5:102" even for shorthands? – David Purton Jan 29 at 6:04
  • :( I can't make it work for the multicite version (\volcites). But if an answer supporting just \volcite is acceptable, I think I can help. – David Purton Jan 29 at 13:47
  • @DavidPurton, I hadn't thought of ibid. Yes, I think it should do "ibid., 5:102" if possible. I personally rarely use multicite commands, so for me it doesn't make a difference. But I had no idea it would take so many lines of code! Thank you so much for making it work! – Alex Roberts Jan 30 at 4:51
  • Most of the code in my answer is to do with deciding when a shorthand will be printed based on biblatex-chicago's options. Hooking that code into \volcite was straight forward. But hooking it into each cite in \volcites took me a while to figure out. I feel like there should have been a better way and I've pinged moewe to take a look as well. – David Purton Jan 30 at 6:45
3

Oooo. I did it!

Just don't ask me to explain how it works. It was basically trial and error.

It works with \volcite, \volcites and the various ibid related options.

It just won't work with something like \volcite{5}[102]{knuth:ct,CCAG:astrology}, but I think you are better served with using \volcites in this kind of case.

MWE

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@mvbook{CCAG:astrology,
  Address = {Brussels},
  Date = {1898/1953},
  Editor = {Cumont, Franz},
  Title = {Catalogus codicum astrologorum graecorum},
  Shorthand = {\emph{CCAG}}
}
\end{filecontents}

\usepackage[notes]{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
\addbibresource{\jobname.bib}

\renewcommand*{\volcitedelim}{\addcolon}
\newcommand*{\volcitepostnotedelim}{\addcomma\space}

\renewrobustcmd*{\mkvolcitenote}[2]{%
  \ifblank{#2}
    {\printtext[volcitevolume]{#1}}
    {\printtext{#1}\volcitedelim\printtext{#2}}}

\makeatletter

\newtoggle{blx@use@volcitepostnotedelim}

\newrobustcmd*{\blx@setvolcitepostnotedelim}{%
  \renewcommand*{\volcitepostnotedelim}{\addcomma\space}%
  \iffieldundef{shorthand}
    {}
    {\iftoggle{cms@shorthandibid}
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {}
          {\ifboolexpr{
             not togl {cms@firstshort}
             and
             not test {\ifciteseen}
           }
             {}
             {\renewcommand*{\volcitepostnotedelim}{\addspace}}}}
       {\ifboolexpr{
         not togl {cms@firstshort}
         and
         not test {\ifciteseen}
        }
          {}
          {\renewcommand*{\volcitepostnotedelim}{\addspace}}}}%
  \iftoggle{blx@use@volcitepostnotedelim}
    {\renewcommand*{\postnotedelim}{\volcitepostnotedelim}}
    {}}

\renewrobustcmd*{\volcitecmd}{%
  \AtNextCite{\DeclareFieldAlias{postnote}{volcitenote}}%
  \AtNextCitekey{\blx@setvolcitepostnotedelim}%
  \begingroup\let\blx@citeargs\blx@volciteargs}

\long\def\blx@volciteargs@i#1[#2]#3{%
  \@ifnextchar[%]
    {\toggletrue{blx@use@volcitepostnotedelim}%
     \eappto\blx@tempe{\toggletrue{blx@use@volcitepostnotedelim}}%
     \blx@volciteargs@ii{#1}{#2}{#3}}
    {\togglefalse{blx@use@volcitepostnotedelim}%
     \eappto\blx@tempe{\togglefalse{blx@use@volcitepostnotedelim}}%
     \blx@citeargs@iii{#1{#2}{{#3}{}}}}}

\protected\def\blx@volmciteargs#1{%
  \eappto\blx@tempe{\AtNextCitekey{\blx@setvolcitepostnotedelim}}%
  \@ifnextchar[%]
    {\blx@volciteargs@i{#1}}
    {\blx@volciteargs@i{#1}[]}}

\makeatother

\begin{document}
\volcite{1}[50]{knuth:ct}.\mancite

\volcite{1--2}{knuth:ct}.

\volcite{5}[102]{CCAG:astrology}.

\volcite{5}[103]{CCAG:astrology}.

\volcite{5}{CCAG:astrology}.

\volcites{1}[50]{knuth:ct}{5}[102]{CCAG:astrology}.

\volcites{5}[102]{CCAG:astrology}{1}[50]{knuth:ct}.

\volcites{1}{knuth:ct}{5}{CCAG:astrology}.

\volcites{5}{CCAG:astrology}{1}{knuth:ct}.

\end{document}

output

  • Ignoring the question of detecting whether or not the shorthand is present and actively used, the main tasks were to get \volcite to use \volcitepostnotedelim instead of the normal \postnotedelim (or more or less equivalently, to detect that we are in a \volcite and use a different definition for \postnotedelim) and to detect whether there was an additional page reference. As far as I can see there is nothing present already that would give you that, so I guess low-level redefinitions of \volcitecmd and friends are your only chance. ... – moewe Jan 30 at 10:14
  • ... It would be nice if that could be avoided. But I'm not entirely sure what exactly would be useful here (one or two (!) new delimiters?, a few tests to check the status of volcite and volcite's postnote?). Maybe you can open an issue at github.com/plk/biblatex/issues to discuss this. – moewe Jan 30 at 10:16
  • 1
    Issue opened at github.com/plk/biblatex/issues/868 – David Purton Jan 31 at 1:35

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.