TeX - LaTeX Asked on January 24, 2021
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
defblx@loccit@stricttracker#1{%
globalcsundef{blx@lastnote@#1@abx@field@entrykey}%
blx@imc@iffieldundef{postnote}
{}
{blx@ifcitesingle
{globalcslet{blx@lastnote@#1@abx@field@entrykey}abx@field@postnote
xifinlistcsabx@field@entrykey{blx@trackkeys@#1}
{}
{listcsxadd{blx@trackkeys@#1}abx@field@entrykey}}
{}}}
defblx@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}{%
globaltogglefalse{cbx:loccit}%
addtocounter{cbx@tempcntb}{1}%
iffieldundef{shorthand}
{ifthenelse{ifciteibidANDifloccitANDNOTiffirstonpage}
{usebibmacro{cite:ibid}}
{ifbool{bbx:subentry}
{iffieldundef{entrysetcount}
{usebibmacro{cite:comp:comp}}
{usebibmacro{cite:comp:inset}}}
{usebibmacro{cite:comp:comp}}}}
{ifthenelse{ifciteibidANDNOTifloccitANDNOTiffirstonpage}
{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}}%
globaltoggletrue{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?
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
defblx@loccit@check#1{%
blx@imc@iffieldundef{postnote}
{ifcsempty{blx@lastnote@#1@abx@field@entrykey}}
{blx@imc@iffieldequalcs{postnote}{blx@lastnote@#1@abx@field@entrykey}}}
letblx@loccit@numcheckblx@loccit@check
defblx@loccit@stricttracker#1{%
globalcsundef{blx@lastnote@#1@abx@field@entrykey}%
blx@imc@iffieldundef{postnote}
{globalcslet{blx@lastnote@#1@abx@field@entrykey}@empty}
{blx@ifcitesingle
{expandafterblx@imc@ifpages
expandafter{abx@field@postnote}
{globalcslet{blx@lastnote@#1@abx@field@entrykey}abx@field@postnote
xifinlistcsabx@field@entrykey{blx@trackkeys@#1}
{}
{listcsxadd{blx@trackkeys@#1}abx@field@entrykey}}
{}}
{}}}
newtoggle{cbx:loccit}
renewbibmacro*{cite:comp}{%
globaltogglefalse{cbx:loccit}%
addtocounter{cbx@tempcntb}{1}%
iffieldundef{shorthand}
{ifthenelse{ifciteibidANDNOTiffirstonpage}
{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}}%
globaltoggletrue{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}
Correct answer by moewe on January 24, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP