3

I would like to have a colon as the delimiter between the year and the page number in an author-year footnote citation. But after the word "ibid" I would like to have a comma instead of a colon.

Minimal Working Example

\documentclass[12pt]{article}

\usepackage[
autocite=footnote,
bibstyle=authoryear-ibid,
citestyle=authoryear-ibid,
]{biblatex}

\renewcommand*{\postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

\begin{filecontents*}[overwrite]{bibliography.bib}
@book{book,
  title={Fabulous Book},
  author={Fred Smith},
  year={2006},
}
\end{filecontents*}
\addbibresource{bibliography.bib}

\begin{document}

\autocite[5]{book}
\autocite[6]{book}

\end{document}

Right now, it puts a colon after the word "ibid" because of the settings. Is there a way to make the delimiter a comma only after the word "ibid"?

enter image description here

1 Answer 1

1

You can use the following construction.

We can't simply test for \ifciteibid in postnotedelim, because the citation tracker may already be in a different state when the postnote is finally printed. So we have to go via a helper toggle that we explicitly switch in each citation.

\documentclass[12pt]{article}

\usepackage[
  style=authoryear-ibid,
  autocite=footnote,
]{biblatex}

\newtoggle{cbx:isibid}

\AtEveryCitekey{\global\togglefalse{cbx:isibid}}

\renewbibmacro*{cite:ibid}{%
  \global\toggletrue{cbx:isibid}%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
  \ifloccit
    {\global\booltrue{cbx:loccit}}
    {}}

\DeclareDelimFormat*{postnotedelim}{%
  \iftoggle{cbx:isibid}
    {\addcomma}
    {\addcolon}%
  \space}

\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{volcitepages}{\mknormrange{#1}}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocites[5]{sigfridsson}
ipsum \autocites[6]{sigfridsson}
dolor \autocites[5]{nussbaum}
sit \autocites[6]{sigfridsson}
amet \autocites[6]{sigfridsson}
\end{document}

1 Sigfridsson and Ryde 1998: 5.//2 Ibid., 6.

3
  • This worked! Thank you. One additional follow-up question: in order for me to make it work, I had to add in an extra # in two places, resulting in the code below. Do you know why that is the case? \DeclareFieldFormat{postnote}{\mknormrange{##1}} \DeclareFieldFormat{volcitepages}{\mknormrange{##1}} Dec 3, 2020 at 2:20
  • 1
    @classicsbro Mhh, in the example you definitely don't need doubled hashes. Doubled hashes are only needed to refer to arguments if you nest your macro definition (in this case \DeclareFieldFormat) inside another macro definition. This isn't the case in this example. Maybe it is the case in your real-world example or maybe this is just the symptom of a forgotten curly brace or a similar syntax error.
    – moewe
    Dec 3, 2020 at 5:54
  • That makes sense. In the MWE I un-nested my commands, but in my "real" document, this is all nested inside other commands that I can use to switch to a different kind of bibliography when needed, thus the need for the second hash. Thanks again for all the help. Dec 3, 2020 at 8:06

You must log in to answer this question.

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