3

for tl;dr check the example

I am using Biblatex (biber-backend) as bibliography tool, but I guess this question could be relevant for Bibtex as well. The style I use is: authoryear-icomp

I cite like this:

\****cite[<number>]{<bibkey>}

That way Biblatex recognizes the number as page and a repeated citation cites as:

(ibid.)

Now to the problem:
I have same sources with special page numbers like "20:16" (or postnotes like "chapter XY"), so Biblatex does not recognize it as page number and I have to cite it like:

\****cite[p.~20:16]{<bibkey>}

That of course means Biblatex does not recognize repeated citation and cites it as:

(ibid., p. 20:16)

instead of:

(ibid.)

Example (how it should be)

<text1> \cite[\ibid{chapter XY}]{authorXY}. <text2> \cite[\ibid{chapter XY}]{authorXY}
becomes:
<text1> (authorXY, chapter XY). <text2> (ibid.)

but

<text1> \cite[\ibid{chapter XY}]{authorXY}. <text2> \cite[\ibid{chapter AB}]{authorXY}
becomes:
<text1> (authorXY, chapter XY). <text2> (ibid., chapter AB)

The ibid{...} - command is just a placeholder, because I don't know how to achieve, what I described. It is just to explain the idea.
I hope that clears things up.

Help and ideas are very much appreciated :)
Many thanks in advance!

  • A MWE would be be very much appreciated (which style do you use?). Of course you could just make biblatex accept : as page number characters (via \DeclareNumChars*{:}), then there would be no need for the p.~ prefix. – moewe Jan 14 '15 at 16:22
  • thanks, this is a good idea, but doesn't exactly accomplish all I try to achieve. I want that also things like chapter are recognized. – Benutzer193 Jan 14 '15 at 16:44
  • OK, a proper MWE would still help us, especially because I always get the page number after the ibid, even if I have a bare page number. It would also help if you could include the use cases you had in mind. (More complicated constructs etc.) – moewe Jan 14 '15 at 16:51
  • Sorry, I already added it in the OP, have forgotten to mention it in the comment. – Benutzer193 Jan 14 '15 at 17:00
  • Yes, you added the style you are using, a full proper MWE is still missing though. Your edit with \cite****[\ibid{XYZ}]{<bibkey>} confuses me, sorry. Another thing you should think about is where you want to draw the line on what postnote is to be dropped when doubled (p. 14, chapter 14 etc.) and what is to be retained, you probably would not want an important postnote comment to be dropped, just because it happens to appear twice. – moewe Jan 14 '15 at 17:06
  • added an example, hope that explains what I mean and doesn't confuse more :D I cant think of an MWE because I have no idea how to achieve what I want (the \ibid{...}) is just a placeholder for a command to let biblatex know I want it to recognize it for changing it to ibid. – Benutzer193 Jan 14 '15 at 17:15
  • I'm still somewhat confused about the \ibid command suddenly appearing, do you want only postnotes seasoned with this (presumably to-be-defined) command to be dropped if doubled? I could find a solution to drop all subsequent postnotes that appeared immediately before. – moewe Jan 14 '15 at 17:20
  • yes now you understand what I mean... but it can't just recognize all as pages, because: (author, p. chapter 6) :D and I would prefer to find a solution where I can tell biblatex where to to drop postnote, because it could lead to problems, perhaps? – Benutzer193 Jan 14 '15 at 17:24
  • Though, drop all equal subsequent postnotes would be also very good, if you know how, I would be thankful, if you'd post it as answer :) – Benutzer193 Jan 14 '15 at 17:33
  • Well, this solution would not make everything into a page number, but would let all postnotes "qualify" for the tracker that checks if the previous note was the same. This \ibid command you seem to have in mind would probably have to manipulate quite some intestines of biblatex, I'll see what I can come up with. – moewe Jan 14 '15 at 17:38

1 Answers1

4

This solution comes pretty close to what you seem to want, the difference being that your proposed \ibid does exactly the opposite of my \noibidonly.

We modify biblatex's trackers in such a way that all postnotes are considered for the "check-if-previous-postnote-was-the-same" tracker, not just proper page numbers.

\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}}}

This is just the standard definition with the \ifpages check deleted.

We then define \noibidonly to allow us to reset the postnote tracker, in effect causing the current and the next postnote to appear regardless of whether it has been displayed immediately before or not.

\newrobustcmd*{\noibidonly}{%
  \iftoggle{blx@footnote}
    {\blx@loccit@reset{foot}}
    {\blx@loccit@reset{text}}%
}

We want to be able to use this command in the postnote, so we issue

\DeclarePageCommands*{\noibidonly}

(Though, thinking about it that should not be necessary any more.)

MWE

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[style=authoryear-icomp,ibidpage]{biblatex}
\addbibresource{biblatex-examples.bib}

\makeatletter
\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}}}

\newrobustcmd*{\noibidonly}{%
  \iftoggle{blx@footnote}
    {\blx@loccit@reset{foot}}
    {\blx@loccit@reset{text}}%
}
\makeatother
\DeclarePageCommands*{\noibidonly}

\begin{document}
\cite[20]{cicero} and \cite[20]{cicero} and \cite[20]{cicero}.

\cite[p.~20:16]{wilde} and \cite[p.~20:16]{wilde} and \cite[p.~20:16]{wilde}.

\cite[lorem]{cicero} and \cite[ipsum]{cicero} and \cite[ipsum]{cicero}.

\cite[lorem]{wilde} and \cite[lorem]{wilde} and \cite[lorem\noibidonly]{wilde} and \cite[lorem]{wilde} and \cite[lorem]{wilde}.

\printbibliography
\end{document}

which yields

enter image description here

moewe
  • 175,683
  • Thank you very much, it is even a better solution than the one I asked for! The \noibidonly is a very good idea, as the the times I don't want it to be considered will be near zero! Just tested, working as excepted!!! – Benutzer193 Jan 14 '15 at 18:04