Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a real idemtracker=strict and idemtracker=constrict #518

Open
pripple opened this issue Dec 9, 2016 · 21 comments
Open

Provide a real idemtracker=strict and idemtracker=constrict #518

pripple opened this issue Dec 9, 2016 · 21 comments
Assignees

Comments

@pripple
Copy link
Contributor

pripple commented Dec 9, 2016

Hi!

In the manual, it says about idemtracker=strict:

This is an alias for true, provided only for consistency with the other trackers. Since ‘idem’ replacements do not get ambiguous in the same way as ‘ibidem’ or ‘op. cit.’, the strict tracking mode does not apply to them.

I think ‘idem’ replacements DO get ambiguous as discussed in German on http://www.mrunix.de/forums/archive/index.php/t-72860.html where no one came up with a solution.

Of course, if there are multiple works by the same author in one footnote (and only works by that author!), and another one in the next, idem is no problem at all:

1: Taylor, Zebras; Idem, Tigers.
2: Idem, Zebras.

But consider this case: Let's say we have two books with the same shorttitle from author Taylor and author Potter, let's call the books "Rabbits" and we use a footnote citation style with author, shorttitle.

If I had \footcite{taylor} text \footcite{potter}, the output would be:
1: Taylor, Rabbits.
2: Potter, Rabbits.
OK.

But if I had \footcite{potter}{taylor} text \footcite{potter}, the output would be:
1: Potter, Rabbits; Taylor, Rabbits.
2: Idem, Rabbits.

How can the reader tell which book is meant?

Even if the books didn't have the same title, it would still be confusing. Let's say Taylor wrote "Rabbits" and also "Cats" and Potter "Dogs" and imagine there are dozens of citations in an article.

If I now have \footcite{taylor_rabbits}{potter_dogs} text \footcite{taylor_cats}, the output will be:
1: Taylor, Rabbits; Potter, Dogs.
2: Idem, Cats.

Now the reader has to go to the bibliography to find out that "Cats" was written by Taylor! I think that's really confusing, even though in this case, there is at least a way to find out, different from the example above.

That's why I suggest providing a real idemtracker=strict and idemtracker=constrict. I only had the problem with one citation in a small article so far and as there weren't any other occurrences of idem, I just switched to idemtracker=false, but that's not a solution in general, as in other places, I would really like to have idem! If it's not possible to provide a real idemtracker=strict and idemtracker=constrict, I suggest providing \noidem and \noibid commands as there were with BibTeX so that at least I have a chance to resolve such issues manually once I find them.

Thank you for your great work with BibLaTeX!

Take care,

Lorenz

@moewew
Copy link
Collaborator

moewew commented Dec 10, 2016

It seems as though

\def\blx@ifciteidem@strict{%
  \ifbool{citetracker}
    {\blx@ifcitesingle
       {\blx@ifciteidem@global}
       {\@secondoftwo}}
    {\@secondoftwo}}

\def\blx@ifciteidem@constrict{%
  \ifbool{citetracker}
    {\blx@ifcitesingle
       {\iftoggle{blx@footnote}
          {\blx@ifmpfncheck
             {\blx@imc@iffieldequals{fullhash}\blx@lasthash@foot}
             {\@secondoftwo}}
          {\blx@imc@iffieldequals{fullhash}\blx@lasthash@text}}
       {\@secondoftwo}}
    {\@secondoftwo}}

\def\blx@idemtracker@strict{%
  \blx@ifcitesingle
    {\blx@idemtracker@global}
    {\blx@idemreset@global}}

\def\blx@idemtracker@constrict{%
  \blx@ifcitesingle
    {\blx@mpfnsave
     \blx@idemtracker@context}
    {\blx@idemreset@context}}

should be enough.

See

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{A,
author = {Autor A},
title = {Titel A},
subtitle = {Untertitel A},
shorttitle = {Kurztitel A},
location = {München},
year = {1991}
}
@Book{B,
author = {Autor B},
title = {Titel B},
subtitle = {Untertitel B},
shorttitle = {Kurztitel B},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\makeatletter
\def\blx@ifciteidem@strict{%
  \ifbool{citetracker}
    {\blx@ifcitesingle
       {\blx@ifciteidem@global}
       {\@secondoftwo}}
    {\@secondoftwo}}

\def\blx@ifciteidem@constrict{%
  \ifbool{citetracker}
    {\blx@ifcitesingle
       {\iftoggle{blx@footnote}
          {\blx@ifmpfncheck
             {\blx@imc@iffieldequals{fullhash}\blx@lasthash@foot}
             {\@secondoftwo}}
          {\blx@imc@iffieldequals{fullhash}\blx@lasthash@text}}
       {\@secondoftwo}}
    {\@secondoftwo}}

\def\blx@idemtracker@strict{%
  \blx@ifcitesingle
    {\blx@idemtracker@global}
    {\blx@idemreset@global}}

\def\blx@idemtracker@constrict{%
  \blx@ifcitesingle
    {\blx@mpfnsave
     \blx@idemtracker@context}
    {\blx@idemreset@context}}
\makeatother

\ExecuteBibliographyOptions{ibidtracker=constrict, idemtracker=constrict}

\begin{document}
%%%%%%%%%% Hier soll kein Ebd. /ders. ausgegeben werden.
Man ist das ein schöner Text.\footcites{A}{B} Jetzt geht der schöne Text weiter.\footcite{B}
%%%%%%%%%% Hier soll Ebd. ausgegeben werden

Dann noch eine Citation C, damit der Tracker nicht auf B steht.\footcite{C}

Ein weiterer schöner Text.\footcite{B}Jetzt geht der schöne Text weiter.\footcite{B}
\end{document}

I'd be glad if you could test that in more detail and provide more test cases. Maybe write an MWE for the cases you have above. I couldn't get the output you claimed to get with the standard styles.

@plk Do you think the request is reasonable? I'd say it is not really a problem to properly enable 'strict' modes of the 'idem' tracker, and it seems easy enough following the example of the ibid tracker.

@plk
Copy link
Owner

plk commented Dec 10, 2016

@moewew - I'm happy about this if you are - it seems reasonable if it is really just new features. Feel free to merge into the dev branch if you are happy.

@moewew
Copy link
Collaborator

moewew commented Dec 11, 2016

Something just occurred to me.

  1. Writer: Book 1, Writer: Book 2
  2. Idem: Book 3

is not ambiguous, but the new strict feature would make the second citation read 'Writer: Book 3' as well.

So maybe this needs more thought and not just a straight copy of the 'ibid' feature.

I'd definitely want to see a bit more testing with the new feature and sanity checking with not-so-obvious corner cases.

@moewew
Copy link
Collaborator

moewew commented Dec 18, 2016

@pripple Could you do some more testing? Did you find any other cases that need special handling? What do you say about the problematic case I mentioned above?

@pripple
Copy link
Contributor Author

pripple commented Dec 19, 2016 via email

@plk
Copy link
Owner

plk commented Sep 5, 2017

@pripple - any time to look at these suggestions? We would like to get this resolved.

@moewew
Copy link
Collaborator

moewew commented Nov 1, 2017

I've had a look at this again, but I didn't have any good ideas to solve this properly.

Just a few notes on the general problem and what I tried in case this becomes relevant in the future.

  • It is not enough to check if there were several citations in the last \cite call. We need to explicitly check if all citations in the last call were by the same fullhash.
  • That sounds easy enough, but needs quite a bit of work.
    • It needs a new fullhash tracker that is 'local' to the citation(s) currently being processed.
    • It is not easy to find a good place to initialise fullhash tracking because multicite commands issue several completely independent \cites. (multicite support could be less of an issue, if it turns out that the other trackers also fail to support multicite properly. Not sure on that)

@pripple Any comment, suggestion, test document would be appreciated.

@pripple
Copy link
Contributor Author

pripple commented Jul 20, 2020

So, I’m finally back to (BibLa)TeXing and starting a longer project, so I thought I’d have a look into this again before starting. I’m so sorry that shortly after discovering this issue just before handing in my last thesis, my priorities changed and I didn’t find the time to come back – I did some TeXing in the meantime, but with minimal references. Now, however, I can contribute. I put together three files, one with constrict settings without your extra code,

withoutextracode.txt

% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\ExecuteBibliographyOptions{ibidtracker=constrict, idemtracker=constrict}
\setlength\parindent{0pt}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\footcite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\footcite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\footcite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\footcite{AA}

\section{Nicht-Ambiguität bei eingeschobenen Fußnoten}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Zunächst zitieren wir AA.\footcite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\footcite{AA}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{BA}.} Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\footcite{BA} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{BA}.} Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\footcite{BB} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Auch wenn zwei Bücher des gleichen Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{AB}.} (Siehe oben.)

Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\footcite{AB}  \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\footnote{\cite{AA}, vgl. auch \cite{AB}.}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\footcite{AC}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\footcite{ABA}

Es muss nun der Name erscheinen.\footcite{AA}

Jetzt darf der erste Autor durch „Ders.“ ersetzt werden.\footcite{ABA} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\footcite{ABA}

Es muss nun wieder der Name erscheinen.\footcite{BA}

Und wieder müssen die Namen erscheinen.\footcite{ABA}

\end{document}
one with the suggested code withextracode.txt
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\makeatletter
\def\blx@ifciteidem@strict{%
  \ifbool{citetracker}
    {\blx@ifcitesingle
       {\blx@ifciteidem@global}
       {\@secondoftwo}}
    {\@secondoftwo}}

\def\blx@ifciteidem@constrict{%
  \ifbool{citetracker}
    {\blx@ifcitesingle
       {\iftoggle{blx@footnote}
          {\blx@ifmpfncheck
             {\blx@imc@iffieldequals{fullhash}\blx@lasthash@foot}
             {\@secondoftwo}}
          {\blx@imc@iffieldequals{fullhash}\blx@lasthash@text}}
       {\@secondoftwo}}
    {\@secondoftwo}}

\def\blx@idemtracker@strict{%
  \blx@ifcitesingle
    {\blx@idemtracker@global}
    {\blx@idemreset@global}}

\def\blx@idemtracker@constrict{%
  \blx@ifcitesingle
    {\blx@mpfnsave
     \blx@idemtracker@context}
    {\blx@idemreset@context}}
\makeatother

\ExecuteBibliographyOptions{ibidtracker=constrict, idemtracker=constrict}
\setlength\parindent{0pt}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\footcite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\footcite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\footcite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\footcite{AA}

\section{Nicht-Ambiguität bei eingeschobenen Fußnoten}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Zunächst zitieren wir AA.\footcite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\footcite{AA}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{BA}.} Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\footcite{BA} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{BA}.} Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\footcite{BB} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Auch wenn zwei Bücher des gleichen Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{AB}.} (Siehe oben.)

Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\footcite{AB}  \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\footnote{\cite{AA}, vgl. auch \cite{AB}.}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\footcite{AC}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\footcite{ABA}

Es muss nun der Name erscheinen.\footcite{AA}

Jetzt darf der erste Autor durch „Ders.“ ersetzt werden.\footcite{ABA} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\footcite{ABA}

Es muss nun wieder der Name erscheinen.\footcite{BA}

Und wieder müssen die Namen erscheinen.\footcite{ABA}

\end{document}
and one with strict settings and without the extra code. withoutextracodestrict.txt
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\ExecuteBibliographyOptions{ibidtracker=strict, idemtracker=strict}
\setlength\parindent{0pt}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\footcite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\footcite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\footcite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\footcite{AA}

\section{Nicht-Ambiguität bei eingeschobenen Fußnoten}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Zunächst zitieren wir AA.\footcite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\footcite{AA} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{BA}.} Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\footcite{BA} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{BA}.} Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\footcite{BB} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Auch wenn zwei Bücher des gleichen Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\footnote{\cite{AA}, vgl. auch \cite{AB}.} (Siehe oben.)

Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\footcite{AB}  \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\footnote{\cite{AA}, vgl. auch \cite{AB}.}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\footcite{AC}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\footcite{ABA}

Es muss nun der Name erscheinen.\footcite{AA}

Jetzt darf der erste Autor durch „Ders.“ ersetzt werden.\footcite{ABA} \textbf{Das funktioniert nicht so wie ich es mir vorstellen würde.}

Rücksetzung durch völlig anderes Zitat.\footcite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\footcite{ABA}

Es muss nun wieder der Name erscheinen.\footcite{BA}

Und wieder müssen die Namen erscheinen.\footcite{ABA}

\end{document}

The constrict settings are better suited for my purposes as they avoid ibid/id after (potentially ambiguous) text footnotes. However, there weren’t any differences between the document with your special code in it and the one without – have I mixed something up? I compile with LuaLaTeX on a freshly updated MacTeX 2020, probably that’s why I had to change some lines in the preamble – it didn’t display ß correctly. When I finished, I realized there was only some German text in your example document above, but our conversation was in English. So, if these test documents are of any relevance to you, I can translate them, no problem. It wouldn’t let me upload .tex files, so I changed the extension to .txt.

@moewew
Copy link
Collaborator

moewew commented Jul 20, 2020

The German in your example document is no problem. Don't worry about translating it. The example I posted was German because I copied it from the linked mrunix post you linked, which was in German. But conversations on GitHub are usually in English, so as many people as possible can understand what's going on.

Some observations, because the files are long (you can include code directly in the question by copy-and-paste, no need to upload files)

  • The strict tracker is actually quite simple-minded. It works by checking if the current citation command cited only one key. If yes, the citation is not ambiguous and the next cite can use "ibid."/"ebd."; if not, the citation is potentially ambiguous. In your example \footnocite{\cite{AA} and \cite{BA}}...\footcite{BB} you have two citation commands one after the other, each citing one key. The strict tracker simply does not read this as potentially ambiguous.

    The constrict tracker additionally also tracks footnote numbers, but only of the current and last citation. The idea is to suppress "ibid." when the footnotes are further than one number apart (i.e. when there is another footnote between them). But when the potentially "ibid." occurs in your example the footnote number pass the plausibility check, since in \footnocite{\cite{AA} and \cite{BA}}...\footcite{BB} the last citation was in the previous footnote - and that's all biblatex checks for. Then the strict test yields true, because each citation involved is a single citation: There's your "ibid.".

    The solution is to use one citation command for both citations \footcites{AA}[vgl. auch]{BA} is not only shorter, but also lets the strict tracker know that there are two citations processed at once.

    I guess you could try and keep track not only of the previous footnote, but also the one before that. That would help in this case, but I'm not sure if it would help in general. And it makes things a whole lot more complicated.

  • (About section 4 in your examples.) In biblatex-dw (and in the biblatex standard styles that use "idem"/"ders.") "idem." always applies to the whole list of authors. There is no partial "idem."/"ders." for author lists as in

    Sigfridsson, Title A
    Idem and Ryde, Title B (for a work by Sigfridsson and Ryde)

    https://tex.stackexchange.com/q/11138/35864 shows and attempt at implementing a feature like this for the bibliography of the standard styles. I haven't looked more closely at that code in a long time, but since it is by Audrey I expect it can be trusted. Note, however, that Audrey mentions having made some assumptions to simplify the code which may or may not have to be addressed when one wants to use that idea in citations or more generally.

    For now I'd say this is a phenomenon that is related to, but not at the core of the citation tracking feature we're discussing here. It definitely has a style component to it that can be addressed by custom styles if so desired, but will probably not be implemented for the standard styles.

@pripple
Copy link
Contributor Author

pripple commented Jul 20, 2020

Okay, thank you for your input! We can disregard the partial idem for now, that’s no problem for me, I just wanted to provide an extensive test file. After all, most publishers accept docx only and for the pandoc conversion all that beautiful BibLaTeX has to be replaced by some publisher specific CSL anyway. So if there/this is a problem that isn’t worth considering in your eyes, I’m fine with that. And if that’s better practise, I will of course copy and paste the code from now on.

Question on multicites

I was already wondering how to use multiple cites in one command while still providing details, somehow, I hadn’t seen an extensive example before. At least, I have mostly worked it out now. The only problem I have stumbled upon is that I wasn’t able to have it set f. plus the semicolon: I can either get First Cite, 23 f; see also … or First Cite, 23 f; see also …. Actually, it should read First Cite, 23 f.; see also …. When I enter the abbreviation dot, the delimiter doesn’t get set anymore. Am I expected to provide the delimiter as part of the optional argument then?

Clarification of strict-constrict-difference

So if I understand correctly, the only difference between strict and constrict is whether it takes normal footnotes in consideration or not. Considering also the combined citations, some of the errors from before have been resolved in my test file, thank you! But now that it really works, I discovered that with the extra code, it even doesn’t use idem when there is a second citation from the same author in the same multicite!

Summing up the results

So, at the moment – see the comments in the files below –,

  • with the added code, the system sets the name again even if I cite the same author twice in the same footnote and if I cite him again in the next footnote,

  • without the added code, it produces the shown ambiguities.

Proposal

I haven’t dived into how fullhash and trackers work enough to be able to give indications on that. However, my thought is: When after the first citation in the last footnote, there were only instances of idem and no spelled out names, we can use idem for the immediately following footnote, too, if the corresponding author is cited there.

A thought on tests

By the way, in all the programming languages I use, there is automated testing or specing in advance. Is there a way to develop this in a behaviour-driven way and automate it in LaTeX? I think it’s quite error-prone to test and check manually in the compiled PDF if tests are passing or not.

What further input is needed?

Should I further add details to my test files? I could think of incollection and inbook citation types, maybe that would make a difference … Would you consider one of the above results as good enough so we just have to test the consistency of the two options?

Test files

strict, no code added

% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\ExecuteBibliographyOptions{ibidtracker=strict, idemtracker=strict}
\setlength\parindent{0pt}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\cite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\cite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\cite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\cite{AA}

\section{Eingeschobene Fußnoten}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Zunächst zitieren wir AA.\cite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\cite{AA} \textit{Das funktioniert nicht so wie ich es mir vorstellen würde, aber das ist wohl beim strict-Stil so gedacht.}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\cites[Vor allem][23\,f.]{AA}[vgl. auch][60–80]{BA} Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\cite{BA} \textbf{Es erscheint aber Ders. – bei gleichen Titeln bzw. Kurztiteln wäre das nicht eindeutig – gleiches Problem wie beim nächsten Unterabschnitt.}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\cites[Vor allem][23\,f.]{AA}[vgl. auch][60–80]{BA} Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\cite{BB} \textbf{Es erscheint aber Ders.}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Auch wenn zwei Bücher desselben Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\cites[35]{AA}[vgl. auch][]{AB} (Siehe oben.)

Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\cite{AB}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\cites[35]{AA}[vgl. auch][]{AB}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\cite{AC}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun der Name erscheinen.\cite{AA}

Jetzt dürfte der erste Autor durch „Ders.“ ersetzt werden.\cite{ABA} \textit{Das tut er nicht, aber okay.}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun wieder der Name erscheinen.\cite{BA}

Und wieder müssen die Namen erscheinen.\cite{ABA}

\end{document}
constrict, no code added
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\ExecuteBibliographyOptions{ibidtracker=constrict, idemtracker=constrict}
\setlength\parindent{0pt}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\cite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\cite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\cite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\cite{AA}

\section{Eingeschobene Fußnoten}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Zunächst zitieren wir AA.\cite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\cite{AA}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\cites[Vor allem][23\,f.]{AA}[vgl. auch][60–80]{BA} Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\cite{BA} \textbf{Es erscheint aber Ders. – bei gleichen Titeln bzw. Kurztiteln wäre das nicht eindeutig – gleiches Problem wie beim nächsten Unterabschnitt.}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\cites[Vor allem][23\,f.]{AA}[vgl. auch][60–80]{BA} Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\cite{BB}  \textbf{Es erscheint aber Ders.}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Auch wenn zwei Bücher desselben Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\cites[35]{AA}[vgl. auch][]{AB} (Siehe oben.)

Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\cite{AB}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\cites[35]{AA}[vgl. auch][]{AB}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\cite{AC}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun der Name erscheinen.\cite{AA}

Jetzt dürfte der erste Autor durch „Ders.“ ersetzt werden.\cite{ABA} \textit{Das tut er nicht, aber okay.}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun wieder der Name erscheinen.\cite{BA}

Und wieder müssen die Namen erscheinen.\cite{ABA}

\end{document}
constrict, extra code from above added
% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\makeatletter
\def\blx@ifciteidem@strict{%
  \ifbool{citetracker}
    {\blx@ifcitesingle
       {\blx@ifciteidem@global}
       {\@secondoftwo}}
    {\@secondoftwo}}

\def\blx@ifciteidem@constrict{%
  \ifbool{citetracker}
    {\blx@ifcitesingle
       {\iftoggle{blx@footnote}
          {\blx@ifmpfncheck
             {\blx@imc@iffieldequals{fullhash}\blx@lasthash@foot}
             {\@secondoftwo}}
          {\blx@imc@iffieldequals{fullhash}\blx@lasthash@text}}
       {\@secondoftwo}}
    {\@secondoftwo}}

\def\blx@idemtracker@strict{%
  \blx@ifcitesingle
    {\blx@idemtracker@global}
    {\blx@idemreset@global}}

\def\blx@idemtracker@constrict{%
  \blx@ifcitesingle
    {\blx@mpfnsave
     \blx@idemtracker@context}
    {\blx@idemreset@context}}
\makeatother

\ExecuteBibliographyOptions{ibidtracker=constrict, idemtracker=constrict}
\setlength\parindent{0pt}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\cite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\cite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\cite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\cite{AA}

\section{Eingeschobene Fußnoten}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Zunächst zitieren wir AA.\cite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\cite{AA}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\cites[Vor allem][23\,f.]{AA}[vgl. auch][60–80]{BA} Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\cite{BA}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\cites[Vor allem][23\,f.]{AA}[vgl. auch][60–80]{BA} Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\cite{BB}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Auch wenn zwei Bücher desselben Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\cites[35]{AA}[vgl. auch][]{AB} (Siehe oben.) \textbf{Das zweite Buch desselben Autors hätte aber problemlos mit Ders. wiedergegeben werden können.}


Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\cite{AB}  \textbf{Jetzt ist das System zu streng: Der Autor wird angegeben, obwohl es nicht nötig wäre.}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\cites[35]{AA}[vgl. auch][]{AB} \textbf{Das zweite Buch desselben Autors hätte aber problemlos mit Ders. wiedergegeben werden können.}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\cite{AC} \textbf{Auch hier ist das System zu streng: Der Autor wird angegeben, obwohl es nicht nötig wäre.}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun der Name erscheinen.\cite{AA}

Jetzt dürfte der erste Autor durch „Ders.“ ersetzt werden.\cite{ABA} \textit{Das tut er nicht, aber okay.}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun wieder der Name erscheinen.\cite{BA}

Und wieder müssen die Namen erscheinen.\cite{ABA}

\end{document}

@moewew
Copy link
Collaborator

moewew commented Jul 20, 2020

Thanks for the extensive reply. I can't promise I'll be able to go through it before the weekend (and maybe not even then: it's TUG 2020), so the low-hanging fruit first

Okay, thank you for your input! We can disregard the partial idem for now, that’s no problem for me, I just wanted to provide an extensive test file. After all, most publishers accept docx only and for the pandoc conversion all that beautiful BibLaTeX has to be replaced by some publisher specific CSL anyway. So if there/this is a problem that isn’t worth considering in your eyes, I’m fine with that.

Well, the 'partial idem' thing is an interesting problem on its own, but it is orthogonal to the problem discussed here and it is probably not something I'd want to add to the standard styles, so if you are interested in it I suggest you ask at https://tex.stackexchange.com/ or another LaTeX forum.

Question on multicites

I was already wondering how to use multiple cites in one command while still providing details, somehow, I hadn’t seen an extensive example before. At least, I have mostly worked it out now. The only problem I have stumbled upon is that I wasn’t able to have it set f. plus the semicolon: I can either get First Cite, 23 f; see also … or First Cite, 23 f; see also …. Actually, it should read First Cite, 23 f.; see also …. When I enter the abbreviation dot, the delimiter doesn’t get set anymore. Am I expected to provide the delimiter as part of the optional argument then?

Use \psq instead of f. and \psqq instead of ff. Compare

\documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authortitle, backend=biber]{biblatex}


\addbibresource{biblatex-examples.bib}


\begin{document}
Lorem \autocites[380\psq]{sigfridsson}[see also][]{nussbaum}% good

Lorem \autocites[380f.]{sigfridsson}[see also][]{nussbaum}% bad!

\printbibliography
\end{document}

biblatex tries to avoid punctuation clashes (undesirable double punctuation like ";."). A literal . is treated like a sentence-ending full stop, which cannot be followed by other punctuation marks like semicolons. But the . in f. is an abbreviation dot, which can be followed by other punctuation. You need to tell biblatex that this . is not a sentence-ending full stop, it is an abbreviation dot. There are other possible ways to do that, but the commands \psq/\psqq expand to "f." and "ff." in German and have a marker to treat the . as an abbreviation dot. They are intended for exactly this job, so I suggest that's what you use.

See also https://tex.stackexchange.com/q/296390/35864, https://tex.stackexchange.com/q/511738/35864, https://tex.stackexchange.com/q/541099/35864, https://tex.stackexchange.com/q/428091/35864 on TeX.SX or https://texwelt.de/fragen/26420/wie-kann-ich-das-zusammenziehen-von-satzzeichen-verhindern on TeXwelt.

@pripple
Copy link
Contributor Author

pripple commented Jul 21, 2020

I can't promise I'll be able to go through it before the weekend (and maybe not even then: it's TUG 2020)

Never mind – thank you for your participation there!

Well, the 'partial idem' thing is an interesting problem on its own, but it is orthogonal to the problem discussed here and it is probably not something I'd want to add to the standard styles, so if you are interested in it I suggest you ask at https://tex.stackexchange.com/ or another LaTeX forum.

Okay, we’ll leave it out here.

Use \psq instead of f. and \psqq instead of ff.

Thank you for those directions, now I’m completely fine with multicites. – To comply with German typesetting guidelines and set a small, I can still use \renewcommand*{\sqspace}{\,}. To have a correct citation via pandoc, however, it seems necessary to include \renewcommand{\psq}{\sqspace{}f.} in the preamble as otherwise it just leaves out the f.. Pandoc also doesn’t seem to be capable of narrow non-breaking spaces, it just outputs a normal space, so I have to use the default ~ there.

@pripple
Copy link
Contributor Author

pripple commented Jul 21, 2020

By the way, if there were – as proposed in my original question – a \noibid and \noidem command – the second implying the first, of course –, I could just manually enter them when I enter the citations. When I put in a multicite, I have to know what I am citing there anyway, I can easily tell if my multicite renders the next cite potentially ambigous. So I could just suffix the multicite with \noidem, so the the next \cite or \cites will not start with idem if it otherwise did.

I have implemented a hackish \noidem command here by citing C and suppressing the output and of course, it yields the expected results. It would, however, add my additional noidem-Citation to the bibliography if it were printed.

% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\ExecuteBibliographyOptions{ibidtracker=constrict, idemtracker=constrict}
\setlength\parindent{0pt}
\newcommand{\noidem}{\begingroup\sbox0{\cite{C}}\addtocounter{footnote}{-1}\endgroup}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\cite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\cite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\cite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\cite{AA}

\section{Eingeschobene Fußnoten}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Zunächst zitieren wir AA.\cite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\cite{AA}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\cites[Vor allem][23\psq]{AA}[vgl. auch][60–80]{BA}\noidem Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\cite{BA}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\cites[Vor allem][23\psq]{AA}[vgl. auch][60–80]{BA}\noidem Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\cite{BB}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Auch wenn zwei Bücher desselben Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\cites[35]{AA}[vgl. auch][]{AB} (Siehe oben.)

Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\cite{AB}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\cites[35]{AA}[vgl. auch][]{AB}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\cite{AC}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun der Name erscheinen.\cite{AA}

Jetzt dürfte der erste Autor durch „Ders.“ ersetzt werden.\cite{ABA} \textit{Das tut er nicht, aber okay.}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun wieder der Name erscheinen.\cite{BA}

Und wieder müssen die Namen erscheinen.\cite{ABA}

\end{document}

@moewew
Copy link
Collaborator

moewew commented Jul 21, 2020

There is \mancite defined as

\newrobustcmd*{\mancite}{%
\csuse{blx@hook@mancite}%
\blx@ibidreset
\blx@idemreset
\blx@opcitreset
\blx@loccitreset}

it resets 'ibid', 'idem', 'opcit' and 'loccit' in the current context. Quoth the manual

[\mancite] Use this command to mark manually inserted citations if you mix automatically generated and manual citations. This is particularly useful if the citation style replaces repeated citations by an abbreviation like ibidem which may get ambiguous
or misleading otherwise. Always use \mancite in the same context as the manual citation, e.g., if the citation is given in a footnote, include \mancite in the footnote. The \mancite command executes a style specific reset hook defined with the
\OnManualCitation command from § 4.3.1. It also resets the internal ‘ibidem’ and ‘idem’ trackers of this package. The reset will affect the \ifciteibid and \ifciteidem tests discussed in § 4.6.2.

It would be possible to define user-accessible names for \blx@ibidreset, \blx@idemreset and friends as well, but this probably needs a bit of thought, because the combination in which the tests are used in styles may influence whether or not user think it natural that one reset implies the another (which the internal resets \blx@...reset don't always).

Unfortunately the fact that \mancite only affects the current context makes it a but clumsy for \autocite/\footcite

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=verbose-trad1, backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}
% this does what we hoped for
Lorem \autocite{sigfridsson,knuth:ct:a,knuth:ct:b}
ipsum \autocite{nussbaum}
Dolor \footnote{\Cite{sigfridsson,knuth:ct:a}\mancite.}
sit \autocite{knuth:ct:b}

\citereset
% this not so much
Lorem \autocite{sigfridsson,knuth:ct:a,knuth:ct:b}
ipsum \autocite{nussbaum}
Dolor \autocite{sigfridsson,knuth:ct:a}\mancite\
sit \autocite{knuth:ct:b}

\printbibliography
\end{document}

@pripple
Copy link
Contributor Author

pripple commented Jul 21, 2020

Great, thank you for pointing me to the \mancite command. Sometimes you have to change perspective to find the solution … Instead of looking for a command that is called after what I want BibLaTeX to be doing, I have to look for a command that tells BibLaTeX what it should suppose I have done: put a manual citation. Replacing my improvised \noidem command from above with \mancite works just as well, without the undesired side effect of adding something to the Bibliography. So, for me, entering \mancite manually after every multicite with different authors combined is a viable workaround.

As to an automatic solution: Inside the multicite command, if not all authors/editors are the same or all author/editor fields (at least after the first) have been replaced by idem, trigger \mancite at the end. I think you are much more familiar with how this comparison could be set up than I am. If the next cite is from another author/editor anyway, it isn’t affected by the \mancite, if it is from the same, idem gets suppressed by the \mancite.

Here is the updated test file:

% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\ExecuteBibliographyOptions{ibidtracker=constrict, idemtracker=constrict}
\setlength\parindent{0pt}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\cite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\cite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\cite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\cite{AA}

\section{Eingeschobene Fußnoten}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Zunächst zitieren wir AA.\cite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\cite{AA}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\cites[Vor allem][23\psq]{AA}[vgl. auch][60–80]{BA}\mancite Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\cite{BA}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\cites[Vor allem][23\psq]{AA}[vgl. auch][60–80]{BA}\mancite Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\cite{BB}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Auch wenn zwei Bücher desselben Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\cites[35]{AA}[vgl. auch][]{AB} (Siehe oben.)

Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\cite{AB}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\cites[35]{AA}[vgl. auch][]{AB}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\cite{AC}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun der Name erscheinen.\cite{AA}

Jetzt dürfte der erste Autor durch „Ders.“ ersetzt werden.\cite{ABA} \textit{Das tut er nicht, aber okay.}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun wieder der Name erscheinen.\cite{BA}

Und wieder müssen die Namen erscheinen.\cite{ABA}

\end{document}

@moewew
Copy link
Collaborator

moewew commented Jul 26, 2020

A first attempt at stricter 'idem' tracking can be seen in https://gist.github.com/moewew/457a1d42fb3d779e08dd8b1e29d07302. Unfortunately the changes I had to apply grew a bit larger than what we discussed here before, so it is no longer viable to include the code directly in the document preamble. The linked file is a drop-in replacement for biblatex v3.14's biblatex.sty. Drop it in a new, empty folder and compile your test documents there. LaTeX will automatically prefer the local file over your system-installed biblatex.sty. (Just don't forget that you have the file in the folder and don't use the folder for production work.)

Remember that the idem-tracker just remembers the last primary name (labelname) in \blx@lasthash.... The idea is to set the macro only in the first work/key (if we are in a situation where we handle multiple works in one \cite). Subsequent keys in the same \cite can only reset the tracker (namely, if the have a different primary name). That way the tracker is reset if there are different primary names in the same \cite. If there is only one primary name in the \cite, that name is saved in \blx@lasthash.... I think that should give the desired result.

There was a small bump on the road taking us there. The footnote tracker (the feature that makes sure to use 'ibid.' only in the same or directly neighbouring footnotes) would be reset too often, so I had to split it into several trackers. One for each citation tracker. The interface I chose is not backwards compatible and I doubt there is a good way to make things fully backwards compatible. In theory that shouldn't be an issue since this is a very, very internal command, but a short grep suggests biblatex-gost might be affected. This needs some investigation.

When I updated the documentation with the change I also realised that the ambiguous 'idem' references we are suppressing here are not ambiguous on the same level as the ambiguous 'ibidem' references that ibidtracker=strict suppresses. Given that some of the standard styles use idemtracker=constrict, we may want to think about renaming the new option to something new like verystrict to avoid backwards compatibility issues.

Anyhow, the attempt needs thorough testing, so it would be appreciated if you could give it a spin.

@moewew
Copy link
Collaborator

moewew commented Jul 26, 2020

To address some points that I didn't address before.

Clarification of strict-constrict-difference

So if I understand correctly, the only difference between strict and constrict is whether it takes normal footnotes in consideration or not. Considering also the combined citations, some of the errors from before have been resolved in my test file, thank you! But now that it really works, I discovered that with the extra code, it even doesn’t use idem when there is a second citation from the same author in the same multicite!

In your examples, the only difference between strict and constrict is whether or not normal footnotes are also taken into account, yes. But more generally strict tracks citations in the body text and footnotes with the same tracker, while constrict (=context+strict) tracks citations in footnotes and in the body text separately.

Consider the difference in

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear-ibid, ibidtracker=constrict, backend=biber]{biblatex}

\addbibresource{biblatex-examples.bib}


\begin{document}
\null\vfill % just for the example
Lorem \footcite{geer}
Lorem \parencite{nussbaum}
ipsum \footcite{nussbaum}
dolor \parencite{sigfridsson}
ipsum \footcite{sigfridsson}

\printbibliography
\end{document}

A thought on tests

By the way, in all the programming languages I use, there is automated testing or specing in advance. Is there a way to develop this in a behaviour-driven way and automate it in LaTeX? I think it’s quite error-prone to test and check manually in the compiled PDF if tests are passing or not.

The LaTeX3 team have developed l3build, which can be used for testing. It can be used for PDF-based comparison and .log-file based comparison, but I think it is mainly used for regression testing, not speccing. A while ago Joseph tried to set up l3build-based tests for biblatex, but I don't think the attempts were finished. I sort of managed to set something up for biblatex-ext (see https://github.com/moewew/biblatex-ext), but I'm not completely happy with that. The biggest problem I faced was that it is pretty hard (or extremely inefficient) to properly separate out specific functions (macros) for testing, since they are almost always used in a much larger context. So I almost always ended up with a complete test document. Especially because we need to run LaTeX, Biber, LaTeX, LaTeX that means that tests take quite a while. Since we have complete documents that also means that the .log-based comparison uses quite large .log files (I had trouble with PDF-based comparison, plus in log-based comparison it is easier to see where things are wrong). In any case tests based on full documents are susceptible to false positives when things beyond our control change (fonts, hyphenation, ...).

At the moment we have a very small Perl-based PDF comparison test suite for biblatex. Essentially it just compiles all the example documents in https://github.com/plk/biblatex/tree/dev/doc/latex/biblatex/examples and looks for changes. That catches very bad mistakes early on, but doesn't even begin to scratch the surface of what some custom styles and heavily customised document out there might do.

I'd love to have more comprehensive tests, but I think we have yet to identify a framework that would work for us.

I guess with where we are now the problem with automatic test-driven development (as I understand it, I have no idea about software development in general) in LaTeX is that you'd have to manually produce a document with the desired behaviour to use for either log or PDF comparison, which to me just seems like more of a hassle than looking at the output.

What further input is needed?

Should I further add details to my test files? I could think of incollection and inbook citation types, maybe that would make a difference … Would you consider one of the above results as good enough so we just have to test the consistency of the two options?

Entry types should not play a role for the implementation of the cite trackers. I don't want to exclude the possibility that some styles do advanced stuff that causes these trackers to behave differently.

Because I'm lazy, I of course prefer short and compact examples and prefer to look at additional cases only if necessary. Of course it's a matter of taste, but I find I work much more efficiently with several small examples rather than one big example. (Especially because I work by looking at the output, in a large document it's easy to get lost.) (The amount of scrolling we have to do to navigate through this issue is already quite something, so if we can avoid adding to that, I think that would be a win.)

@pripple
Copy link
Contributor Author

pripple commented Aug 4, 2020

After a couple of days off I appreciate your effort and test it.

Until now I have used Package: biblatex 2019/12/01 v3.14 programmable bibliographies (PK/MW) with the test document without extra code above. Now I put it in an extra folder and put also your new file there. The log file shows your warning … drop-in replacement ….

Anyhow, the attempt needs thorough testing, so it would be appreciated if you could give it a spin.

My test document shows no errors, it works as expected. You’ll find it below. — Is this what you expected me to do?

I’m not sure how BibLaTeX considers different authors with the same primary name … There might be a married couple writing different articles, for example, or consider Reinhard Cardinal Marx’s „Das Kapital“ and Karl Marx’s work with the same title. You might not want to confuse them when writing about social theory …

I don’t know anything about the Russian citation package you mentioned, sorry.

The verystrict option sounds good to me.

Tests

Thank you for your input on PDF- and log-file-based testing! Some thoughts:

Since we have complete documents that also means that the .log-based comparison uses quite large .log files

It might be possible to single out specific sections with regular expressions or by characteristic lines above and below (that might be included in the test documents, some random characters just before and after the important part)?

I guess with where we are now the problem with automatic test-driven development (as I understand it, I have no idea about software development in general) in LaTeX is that you'd have to manually produce a document with the desired behaviour to use for either log or PDF comparison, which to me just seems like more of a hassle than looking at the output.

In the example at hand, it was possible to produce the desired output with \mancite commands, wouldn’t this be suitable as a document specing the desired behaviour? And when developing new styles, couldn’t you still use normal font change commands to mock up the desired output?

Enough?

Because I'm lazy, I of course prefer short and compact examples and prefer to look at additional cases only if necessary. Of course it's a matter of taste, but I find I work much more efficiently with several small examples rather than one big example. (Especially because I work by looking at the output, in a large document it's easy to get lost.) (The amount of scrolling we have to do to navigate through this issue is already quite something, so if we can avoid adding to that, I think that would be a win.)

I understand. Sorry for my lack of creativity and dedication to come up with something shorter in the first place.

It would be a great option if we could “fold” the code snippets and only show them when needed. Even though this seems not to be possible, I consider it clearer to include the code I used for testing and not just describing the differences:

% !TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=footnote-dw]{biblatex}\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{AA,
author = {Andreas Alphamann},
title = {Titel AA},
subtitle = {Untertitel AA},
shorttitle = {Kurztitel AA},
location = {München},
year = {1991}
}
@Book{AB,
author = {Andreas Alphamann},
title = {Titel AB},
subtitle = {Untertitel AB},
shorttitle = {Kurztitel AB},
location = {München},
year = {1991}
}
@Book{AC,
author = {Andreas Alphamann},
title = {Titel AC},
subtitle = {Untertitel AC},
shorttitle = {Kurztitel AC},
location = {München},
year = {1991}
}
@Book{BA,
author = {Berthold Betamann},
title = {Titel BA},
subtitle = {Untertitel BA},
shorttitle = {Kurztitel BA},
location = {München},
year = {1991}
}
@Book{BB,
author = {Berthold Betamann},
title = {Titel BB},
subtitle = {Untertitel BB},
shorttitle = {Kurztitel BB},
location = {München},
year = {1991}
}
@Book{ABA,
author = {Andreas Alphamann and Berthold Betamann},
title = {Titel ABA},
subtitle = {Untertitel ABA},
shorttitle = {Kurztitel ABA},
location = {München},
year = {1991}
}
@Book{C,
author = {Autor C},
title = {Titel C},
subtitle = {Untertitel C},
shorttitle = {Kurztitel C},
location = {München},
year = {1991}
}

\end{filecontents}
\addbibresource{\jobname.bib}

\ExecuteBibliographyOptions{ibidtracker=constrict, idemtracker=constrict}
\setlength\parindent{0pt}
\begin{document}
	
\section{Standardfunktionalität}

Zunächst sollte AA voll zitiert werden.\cite{AA}

Jetzt sollte AB mit „Ders.“ voll zitiert werden.\cite{AB}

Jetzt sollte AA mit „Ders.“ kurz zitiert werden.\cite{AA}

Jetzt sollte „Ebd.“ zitiert werden.\cite{AA}

\section{Eingeschobene Fußnoten}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Zunächst zitieren wir AA.\cite{AA}

Es folgt nun eine Fußnote, von der Bib\LaTeX{} ja nicht wissen kann, ob es eindeutig ist, sich danach noch auf das vorhergehende Zitat zu beziehen und es daher besser unterlassen sollte.\footnote{Einer ähnlichen Argumentation folgte auch Betamann, von dem gleich die Rede sein wird, bereits in seiner unveröffentlichten Habilitationsschrift.}

Jetzt sollte AA mit Namensangabe kurz zitiert werden, denn ein Rückverweis mit „Ebd.“ könnte Betamanns Habilitationsschrift meinen, ein Rückverweis mit „Ders.“ Betamann statt Alphamann.\cite{AA}

\section{Nicht-Ambiguität bei Mehrfach-Zitaten}

\subsection{Verschiedene Autoren, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun zwei Bücher gleichzeitig zitiert, ist nicht eindeutig, welches anschließend referenziert wird.\cites[Vor allem][23\psq]{AA}[vgl. auch][60–80]{BA} Denn: Man könnte sowohl meinen, dass es das erste der beiden ist, weil darauf ja der Schwerpunkt der Fußnote lag, als auch meinen (wie es Bib\LaTeX{} interpretiert), dass es eben die zuletzt genannte ist, obwohl die eher nebensächlich war.

Es sollte also nun ein Kurzzitat von BA ohne „Ebd.“ und ohne „Ders.“ erscheinen.\cite{BA}

\newpage\subsection{Verschiedene Autoren, letzter Autor, aber nicht Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden nun Bücher verschiedener Autoren gleichzeitig zitiert, ist nicht eindeutig, auf welchen der Autoren anschließend referenziert wird.\cites[Vor allem][23\psq]{AA}[vgl. auch][60–80]{BA} Denn: Entweder man muss dan ins Literaturverzeichnis schauen, um herauszufinden, welcher Autor die nächste Referenz verfasst hat, oder es ist sogar überhaupt nicht zu erkennen, wenn die Bücher den gleichen Titel haben sollten. (Siehe auch oben.)

Es sollte also nun ein Zitat von BB ohne „Ders.“ erscheinen.\cite{BB}

\subsection{Gleicher Autor, letztes Buch gleich}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Auch wenn zwei Bücher desselben Autors gleichzeitig zitiert werden, ist nicht eindeutig, welches anschließend referenziert wird.\cites[35]{AA}[vgl. auch][]{AB} (Siehe oben.)

Es sollte also nun ein Kurzzitat von AB ohne „Ebd.“ erfolgen, wobei der Autor durch „Ders.“ ersetzt werden darf.\cite{AB}

\subsection{Gleicher Autor, anderes Buch}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Werden zwei Bücher desselben Autors zitiert, kann danach auf den Autor zurückverwiesen werden.\cites[35]{AA}[vgl. auch][]{AB}

Beim Zitat von AC sollte daher nun der Autor durch „Ders.“ ersetzt werden.\cite{AC}

\newpage\section{Nicht-Ambiguität bei Mehrfach-Autoren}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nun wird zuerst ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun der Name erscheinen.\cite{AA}

Jetzt dürfte der erste Autor durch „Ders.“ ersetzt werden.\cite{ABA} \textit{Das tut er nicht, aber okay.}

Rücksetzung durch völlig anderes Zitat.\cite{C}

Nochmals wird ein gemeinsames Buch von A und B zitiert.\cite{ABA}

Es muss nun wieder der Name erscheinen.\cite{BA}

Und wieder müssen die Namen erscheinen.\cite{ABA}

\end{document}

@moewew
Copy link
Collaborator

moewew commented Aug 4, 2020

Thanks for the feedback.

Anyhow, the attempt needs thorough testing, so it would be appreciated if you could give it a spin.

My test document shows no errors, it works as expected. You’ll find it below. — Is this what you expected me to do?

I was thinking you might want to try the new code in some 'real world' example documents. I've only dealt with artificial examples so far and it is always good to get feedback if things still look OK in longer, more complex documents. I wasn't hoping for even more examples, unless you found a bug or another issue with the implementation during your 'real world' tests - then an MWE that reproduces the issue would be great.

I’m not sure how BibLaTeX considers different authors with the same primary name … There might be a married couple writing different articles, for example, or consider Reinhard Cardinal Marx’s „Das Kapital“ and Karl Marx’s work with the same title. You might not want to confuse them when writing about social theory …

For biblatex Reinhard Cardinal Marx and Karl Marx are different people. Indeed with the standard uniquename settings the authoryear styles will disambiguate the two by adding initials (probably not the best choice for Cardinal Marx, but really I'd probably drop the 'Cardinal' when citing him).

Currently I can't think of a situation where we would run into trouble with 'idem' with similar names, but if you can reproduce an ambiguous or infelicitous situation with either the current 'idem' or the suggested new 'idem' implementation that goes beyond what we have seen so far, I'd love to hear about it.

I don’t know anything about the Russian citation package you mentioned, sorry.

Oh sorry for the confusion. That comment about biblatex-gost wasn't a suggestion that you do something about the style or investigate it. It was just a short reminder for everyone who is interested in the implementation that the change as it is now is not as unproblematic as it should be. Plus it serves as a reminder for me that if we go through with it as it is now, I need to contact the maintainer of biblatex-gost before the release.

Since we have complete documents that also means that the .log-based comparison uses quite large .log files

It might be possible to single out specific sections with regular expressions or by characteristic lines above and below (that might be included in the test documents, some random characters just before and after the important part)?

Actually, that's what l3build already does to some degree (certain lines are 'normalised' and we can control what exactly goes to the log at least in many contexts), but the output is still quite something. You can see an example at https://github.com/moewew/biblatex-ext/blob/dev/testfiles/style-ext-authoryear.tlg. A simple output in the PDF like

Sigfridsson and Ryde 1998

becomes

.\T1/lmr/m/n/10 S
.\T1/lmr/m/n/10 i
.\T1/lmr/m/n/10 g
.\T1/lmr/m/n/10 f
.\T1/lmr/m/n/10 r
.\T1/lmr/m/n/10 i
.\T1/lmr/m/n/10 d
.\T1/lmr/m/n/10 s
.\T1/lmr/m/n/10 s
.\T1/lmr/m/n/10 o
.\T1/lmr/m/n/10 n
.\glue 3.33333 plus 1.66666 minus 1.11111
.\T1/lmr/m/n/10 a
.\T1/lmr/m/n/10 n
.\T1/lmr/m/n/10 d
.\glue 3.33333 plus 1.66666 minus 1.11111
.\T1/lmr/m/n/10 R
.\kern-0.27779
.\T1/lmr/m/n/10 y
.\T1/lmr/m/n/10 d
.\T1/lmr/m/n/10 e
.\glue 3.33333 plus 1.66666 minus 1.11111
.\T1/lmr/m/n/10 1
.\T1/lmr/m/n/10 9
.\T1/lmr/m/n/10 9
.\T1/lmr/m/n/10 8

depending on the exact context one is interested in, one could of course normalise away more stuff here and try to make things shorter, but I'm not particularly keen on overloading l3build or doing heavy post-processing.

I guess with where we are now the problem with automatic test-driven development (as I understand it, I have no idea about software development in general) in LaTeX is that you'd have to manually produce a document with the desired behaviour to use for either log or PDF comparison, which to me just seems like more of a hassle than looking at the output.

In the example at hand, it was possible to produce the desired output with \mancite commands, wouldn’t this be suitable as a document specing the desired behaviour? And when developing new styles, couldn’t you still use normal font change commands to mock up the desired output?

Yeah, that would be possible. But of course that also takes time and at least for most things that I have worked on so far I'd say that the simple approach of me checking the output visually worked OK-ish. In the \mancite case you have a point that one could get the expected/reference result rather quickly, but that's not always so easy - and I'd rather spend my time implementing a feature and looking at the output directly than first having to devise clever workarounds to produce the desired output and then implementing the feature properly.

It would be a great option if we could “fold” the code snippets and only show them when needed. Even though this seems not to be possible, I consider it clearer to include the code I used for testing and not just describing the differences:

GitHub has some support for hiding bits of a post.

<details>
<summary>Short summary</summary>
Longer text
</details>
Short summary Longer text

I edited two of your posts above to fold some of the code examples that I felt were a bit redundant to make things a bit shorter. At least in my attempts HTML and markdown didn't always mix particularly well, so some things got a bit less pretty on the markup side.

@pripple
Copy link
Contributor Author

pripple commented Aug 4, 2020

I was thinking you might want to try the new code in some 'real world' example documents. I've only dealt with artificial examples so far and it is always good to get feedback if things still look OK in longer, more complex documents. I wasn't hoping for even more examples, unless you found a bug or another issue with the implementation during your 'real world' tests - then an MWE that reproduces the issue would be great.

I have a paper and a thesis ahead and I will tell you if I run into any issues concerning this functionality. Thank you so much!

For biblatex Reinhard Cardinal Marx and Karl Marx are different people. Indeed with the standard uniquename settings the authoryear styles will disambiguate the two by adding initials (probably not the best choice for Cardinal Marx, but really I'd probably drop the 'Cardinal' when citing him).

Currently I can't think of a situation where we would run into trouble with 'idem' with similar names, but if you can reproduce an ambiguous or infelicitous situation with either the current 'idem' or the suggested new 'idem' implementation that goes beyond what we have seen so far, I'd love to hear about it.

I was just unsure because you wrote about checking the “primary name”. This might have been just the surname in my understanding, that’s why I asked. I added the Cardinal title just for the sake of clarity concerning whom I was talking about, that wasn’t the point of my inquiry.

I understand your other points and appreciate the folding technique you showcased. Thank you!

@moewew
Copy link
Collaborator

moewew commented Aug 5, 2020

Ah, sorry about the confusion with 'primary name'. That's the phrase the manual sometimes uses to describe labelname or just the name list that comes first in the bibliography entry (usually the author field, but sometimes also editor or translator). When I talk about the surname I usually use the biblatex terminology family name or the BibTeX phrase last name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants