1

BibLaTex knows ibid and I've also found loco citato as loccit in the text. So now I want to combine that.

So this is yet another follow-up of how to force ibit-like things in the numeric style – and I still consider it a missing feature in biblatex in general. Now I want to force it not only to use ibid properly as it is defined, but also l.c.. I.e., I want both, as proper citation guidelines suggest.

To illustrate, again this example:

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 solution, I want:

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”[l.c., p. 4].

l.c. is just one – very short – possibility I have seen how that can be abbrevated or called. "Loc. cit." is another one and in German that is e.g. called "a. a. O." ("am angegebenen Ort"). As per their definition, ibid may only be used if everything is exactly the same and „in the place cited” only applies when the page or so may be different, but the source is still the same.

I've already found out that it is defined in biblatex and the old solution also makes use of it.

So I've tried to adapt it but my solution fails and now does not print the postnote (the optional part of the citation) anymore at all:

% ATTENTION: BROKEN EXAMPLE!

% consider all postnotes for check-if-previous-postnote-was-the-same
\def\blx@loccit@stricttracker#1{%
  \global\csundef{blx@lastnote@#1@\abx@field@entrykey}%
  \blx@imc@iffieldundef{postnote}
    {}
    {\blx@ifcitesingle
       {\global\cslet{blx@lastnote@#1@\abx@field@entrykey}\abx@field@postnote
           \xifinlistcs\abx@field@entrykey{blx@trackkeys@#1}
             {}
             {\listcsxadd{blx@trackkeys@#1}\abx@field@entrykey}}
       {}}}

\def\blx@loccit@numcheck#1{%
  \blx@imc@iffieldundef{postnote}
    {\@secondoftwo}
    {\blx@imc@iffieldequalcs{postnote}{blx@lastnote@#1@\abx@field@entrykey}}}

% ibid for postnote, but repeat number, if you subsequently use different pages/postnotes
% https://tex.stackexchange.com/a/554363/98645
\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}}}}
    {\ifthenelse{\ifciteibid\AND\NOT\ifloccit\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:loccit}}
       {\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}

So my LaTeX coding "skills" fail here.

For a MWE refer to the example in the previous solutions.

It would be great, if you could add how to use loccit now here?

7
  • 1
    Is there any chance we can talk you out of this idea? It is already extremely unusual to use 'ibid.' with numeric citation labels. Using something as obscure as 'l.c.' probably doesn't make it easier to read. Plus with numeric citations your actual citations don't get (much) shorter with 'ibid.'/'l.c.' if at all (which is their main selling point with other styles, where they can save space or save your readers having to read through a verbose reference).
    – moewe
    Commented Aug 10, 2020 at 15:14
  • 1
    I don't see why you would want this. "ibid" and your "locit" makes it more difficult to find a citation. That is a price that you can accept if you get much shorter citations back, but here you pay only without any gain. Commented Aug 10, 2020 at 15:17
  • 1
    An advantage of this approach, also with numerical citations, is that it is more explicit that you are discussing various parts of the same reference. It helps the reader to notice this more easily, while saying consider X [23, p10] and (long description here) [23, p35] requires the reader to remember that [23] was used for the previous topic of discussion as well, and therefore belongs to the same reference. This could (or maybe should) also be apparent from the text, but I think it could be a useful feature nonetheless.
    – Marijn
    Commented Aug 10, 2020 at 15:26
  • I agree with @Marijn. As for how to find the reference, I do have hyperlinks on the labels and hope people will process the document digitally. By using these, you know at one glance that it is still the same source we are talking about. And I also find[1] it visually dusturbuing[1], to see a „lot of numbers“[1] just quoting the same reference.[1] (Obviously exaggerated example.)
    – rugk
    Commented Aug 10, 2020 at 16:26
  • Also, nearly all arguments apply to the other styles too. So I don't get why I should not use that nice feature just because I use a different citation style. And in other languages the abbreviations for these are very short, so they may not be such a big "loss of space".
    – rugk
    Commented Aug 10, 2020 at 16:31

1 Answer 1

2

It's not too difficult to build this into the solutions shown in Getting ibid for numeric citations while comparing optional arguments/postnotes from biblatex. Most of it is already there.

But as mentioned in the comments I would advise against using these unusual Latin abbreviations. I have my doubts that they make your prose easier to parse.

\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
\def\blx@loccit@check#1{%
  \blx@imc@iffieldundef{postnote}
    {\ifcsempty{blx@lastnote@#1@\abx@field@entrykey}}
    {\blx@imc@iffieldequalcs{postnote}{blx@lastnote@#1@\abx@field@entrykey}}}

\let\blx@loccit@numcheck\blx@loccit@check

\def\blx@loccit@stricttracker#1{%
  \global\csundef{blx@lastnote@#1@\abx@field@entrykey}%
  \blx@imc@iffieldundef{postnote}
    {\global\cslet{blx@lastnote@#1@\abx@field@entrykey}\@empty}
    {\blx@ifcitesingle
       {\expandafter\blx@imc@ifpages
        \expandafter{\abx@field@postnote}
          {\global\cslet{blx@lastnote@#1@\abx@field@entrykey}\abx@field@postnote
           \xifinlistcs\abx@field@entrykey{blx@trackkeys@#1}
             {}
             {\listcsxadd{blx@trackkeys@#1}\abx@field@entrykey}}
          {}}
       {}}}

\newtoggle{cbx:loccit}

\renewbibmacro*{cite:comp}{%
  \global\togglefalse{cbx:loccit}%
  \addtocounter{cbx@tempcntb}{1}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\ifloccit
          {\usebibmacro{cite:ibid}}
          {\usebibmacro{cite:loccit}}}
       {\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}}

\newbibmacro*{cite:loccit}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{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}

  \autocite{worman}

  \autocite{sigfridsson}
  \autocite{sigfridsson}

  \printbibliography
\end{document}

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

3
  • Thanks, but I guess this has a bug: If you only cite \cite{sigfridsson} and afterwards \cite{sigfridsson} again, it lists it as [loc. cit.], while it should obviously list it as [ibid.], because even without any postnote it is exactly the same and not "only" the same document.
    – rugk
    Commented Aug 10, 2020 at 16:24
  • 1
    @rugk Try again, please.
    – moewe
    Commented Aug 10, 2020 at 17:16
  • Thanks! Indeed seems to work now! (Just as a last tip: Better update the screenshot now, it does not fit the code anymore😜)
    – rugk
    Commented Aug 10, 2020 at 20:18

You must log in to answer this question.

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