0

Follow-up of this question.

The question and answer explain how to add ibit to a numeric style in biblatex.

But that solution is indeed likely longer than citing the number twice, because it cites a sentence like this:

They say, “LaTeX is powerful“[96, p. 3], but state on the same page “WordTEX may be better”[96, p. 3]. On then next page, they talk about “trains driving backwards”[96, p. 4].

With the “ibit patch” applied, it is shown as this:

They say, “LaTeX is powerful“[96, p. 3], but state on the same page “WordTEX may be better”[ibid., p. 3]. On then next page, they talk about “trains driving backwards”[ibid., p. 4].

However, obviously this still makes the text longer. I however, want that it also compares the postnote there… (i.e. the 3 in \cite[3]{wildenhain2018})

Basically this question calls for the same, but they use a different citation style. As such, ibidpage is used and likely modified there – while I need to use ibidtracker=constrict as explained in the first question.

So simply combining these solutions does not work.

In the end, I'd like a result like this:

They say, “LaTeX is powerful“[96, p. 3], but state on the same page “WordTEX may be better”[ibid.]. On then next page, they talk about “trains driving backwards”[ibid., p. 4].

If possible easily, maybe also explain how I could only print ibid if such a “complete matching” entry is found so it basically never increases the size of the citation. In the example, this would lead to this:

They say, “LaTeX is powerful“[96, p. 3], but state on the same page “WordTEX may be better”[ibid.]. On then next page, they talk about “trains driving backwards”[96., p. 4].

How can this be achieved?

Note it also should be able to compare arbitrary data in the postnote. (as biblatex does not automatically prepend non-only-numeric arguments there, so one has to use \cite[p. 3~ff.]{wildenhain2018} or similar sometimes)

2
  • 1
    Unrelated to the actual question, but use \cite[3\psqq]{wildenhain2018} instead of *\cite[p. 3~ff.]{wildenhain2018} and biblatex will treat your postnote as purely numeric.
    – moewe
    Jul 20, 2020 at 20:32
  • Note that it would be easier to get started helping you if you could share a short example document that already has the "ibid." modification from the first post and that produces the sample citation. Of course we can piece these things together from the information in the question, but an MWE is still a nice nod to those reading your question that you appreciate their time and want to help them get started right away.
    – moewe
    Jul 20, 2020 at 20:35

1 Answer 1

1

As mentioned in the answer to Getting ibid for numeric citations from biblatex, the code there does not implement the ibidpage function, but it is possible to transplant the code for ibidpage from say authortitle-ibid.cbx to this solution.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=numeric-comp, backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}

\makeatletter
\DeclareBibliographyOption[boolean]{ibidpage}[true]{%
  \ifstrequal{#1}{true}
    {\ExecuteBibliographyOptions{loccittracker=constrict}}
    {\ExecuteBibliographyOptions{loccittracker=false}}}

\newtoggle{cbx:loccit}

\renewbibmacro*{cite:comp}{%
  \global\togglefalse{cbx:loccit}%
  \addtocounter{cbx@tempcntb}{1}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifbool{bbx:subentry}
          {\iffieldundef{entrysetcount}
             {\usebibmacro{cite:comp:comp}}
             {\usebibmacro{cite:comp:inset}}}
          {\usebibmacro{cite:comp:comp}}}}
    {\usebibmacro{cite:comp:shand}}}

\providecommand*{\mkibid}[1]{#1}
\newbibmacro*{cite:ibid}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
  \ifloccit
    {\global\toggletrue{cbx:loccit}}
    {}}

\letbibmacro*{orig:postnote}{postnote}
\renewbibmacro*{postnote}{%
  \iftoggle{cbx:loccit}
    {}
    {\usebibmacro{orig:postnote}}}
\makeatother

\ExecuteBibliographyOptions{ibidtracker=constrict, ibidpage=true}


\begin{document}
  \autocite[3]{sigfridsson}
  \autocite[3]{sigfridsson}
  \autocite[4]{sigfridsson}

  \printbibliography
\end{document}

The main ingredient is the new cbx:loccit flag and the \ifloccit test. Basically \ifloccit is \ifopcit+\if<same page as last cite>, where \ifopcit tests if the present citation is the same work that was last cited by the same author. Together \ifciteibid and \ifloccit give the desired "ibid."+page tracking.

[1, p. 3] [ibid.] [ibid., p. 4]


It is also possible to show "ibid." only if the last page was exactly the same. This is done by integrating the \ifloccit test directly into the \ifciteibid test that checks whether or not to print "ibid.".

Note that strictly speaking this does of course not take actual citation length into account. It purely chooses to print (or not to print) "ibid." based on the previous citation and the postnote argument.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=numeric-comp, backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}

\makeatletter
\newtoggle{cbx:loccit}

\renewbibmacro*{cite:comp}{%
  \global\togglefalse{cbx:loccit}%
  \addtocounter{cbx@tempcntb}{1}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\ifloccit\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifbool{bbx:subentry}
          {\iffieldundef{entrysetcount}
             {\usebibmacro{cite:comp:comp}}
             {\usebibmacro{cite:comp:inset}}}
          {\usebibmacro{cite:comp:comp}}}}
    {\usebibmacro{cite:comp:shand}}}

\providecommand*{\mkibid}[1]{#1}
\newbibmacro*{cite:ibid}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}%
  \global\toggletrue{cbx:loccit}}

\letbibmacro*{orig:postnote}{postnote}
\renewbibmacro*{postnote}{%
  \iftoggle{cbx:loccit}
    {}
    {\usebibmacro{orig:postnote}}}
\makeatother

\ExecuteBibliographyOptions{ibidtracker=constrict, loccittracker=constrict}


\begin{document}
  \autocite[3]{sigfridsson}
  \autocite[3]{sigfridsson}
  \autocite[4]{sigfridsson}

  \printbibliography
\end{document}

[1, p. 3] [ibid.] [1, p. 4]


Both of these solutions use the standard definition of the loccit tests that only compare page ranges in the postnote argument. But the solutions can be combined with Make Biblatex (Bibtex) recognize equal subsequent postnotes if you absolutely insist that non-page-range input needs to be compared as well.

1

You must log in to answer this question.

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