0

I need to curate the bibliographic strings for the \cite commands in footnotes.

What I am looking for is a solution that has a more precise taxonomy in the distinction between "op. ult. cit." (and I will be so happy if you can give me a solution that works also for "op. et loc. ult. cit.") and "op. cit.".

According to the conventions required of me, in a paper with a verbose bibliographic style (I can use either "trad1" or "trad2"):

  1. I use "N. SURNAME, Full title. Subtitle, other data" (e.g. for books or inbooks "in booktitle, editor, publisher, city yyyy, pp."; e.g. for articles "in “Journal string”, vol., num., yyyy, pp.") for the first citation;

  2. I use "Ibid." if I am referring to the same citation (and the same pages with respect to the source, when I have mentioned them) as the one in the immediately preceding footnote;

  3. I use "Ivi" if I am referring to the same citation immediately preceding, when I indicate a different page number (with respect to the one in the previous footnote or when I did not indicate the page or pages in the previous footnote);

  4. In footnotes not immediately following, I use

    a. "SURNAME, op. cit., pp." if this entry is the only one by SURNAME, among all my citations;

    b. alternatively, that is if I am using two or more entries with the same author, I use "SURNAME, op. ult. cit., pp." if I am citing the same work cited in the first footnote to go back (and I will use "SURNAME, op. et loc. ult. cit." when I am referring to the same page too); or "SURNAME, Title, cit., pp." if I am citing any other work (i.e. not the same as the last work cited).

This is a snippet of my code. I was not able to understand how to input op. et loc. ult. cit. and I failed when I gave op. ult. cit..

\usepackage[style=verbose-trad1,giveninits=true,sorting=nyt,citetracker=true,ibidtracker=context,idemtracker=context,loccittracker=context,opcittracker=true,singletitle=false,uniquetitle=true,uniquework=true,ibidpage=true,citepages=omit,strict=true,refsection=chapter,citereset=chapter,autocite=inline]{biblatex}
\usepackage{csquotes}
% \usepackage{biblatex-shortfields}

\NewBibliographyString{opcited,ultimacitata,ultimapaginacitata}
% Indicatori
\DefineBibliographyStrings{italian}{%
    opcited={\emph{\autocap{o}p\adddot\ cit\adddot}},
    ultimacitata={\emph{\autocap{O}p\adddot\ ult\adddot\ cit\adddot}},
    ultimapaginacitata={\emph{\autocap{O}p\adddot et loc\adddot\ ult\adddot\ cit\adddot}},
    idem={\textsc{\autocap{i}d}\adddot},
    idemsf={\textsc{\autocap{e}ad}\adddot},
    idempm={\textsc{\autocap{e}id}\adddot},
    idempf={\textsc{\autocap{e}aed}\adddot},
    idempp={\textsc{\autocap{e}id}\adddot},
}

\DefineBibliographyStrings{british}{%
    opcited={\emph{\autocap{o}p\adddot\ cit\adddot}},
    ultimacitata={\emph{\autocap{O}p\adddot\ ult\adddot\ cit\adddot}},
    ultimapaginacitata={\emph{\autocap{O}p\adddot et loc\adddot\ ult\adddot\ cit\adddot}},
    idem={\textsc{\autocap{i}d}\adddot},
    idemsf={\textsc{\autocap{e}ad}\adddot},
    idempm={\textsc{\autocap{e}id}\adddot},
    idempf={\textsc{\autocap{e}aed}\adddot},
    idempp={\textsc{\autocap{e}id}\adddot},
}

\renewbibmacro*{cite:ibid}%
    {\ifloccit%
        {\usebibmacro{cite:loccit}}%
        {\printtext{%
            \bibhyperlink{cite\csuse{cbx@lastcite@\thefield{entrykey}}}{\bibstring[\mkibid]{ibidem}}}%
        }}%


\renewbibmacro*{cite:title}{%
    \ifsingletitle%
        {\usebibmacro{cite:opcit}}%
        {\printtext[bibhyperlink]{\printfield[citetitle]{labeltitle}{\setunit{\addcomma\space}}}\bibstring{opcit}}%
    }

\renewbibmacro*{cite:opcit}{%
    \ifsingletitle%
        {\printtext[bibhyperlink]{\bibstring[\mkibid]{ultimacitata}}}%
        {\printtext[bibhyperlink]{\bibstring[\mkibid]{opcited}}}%
    }

I reiterate that I need a distinction between "loc. ult. cit." and "op. cit.", based on the fact that I use the first string only just to refer to the last work cited (among two or more) by the same author; while I use "op. cit." only just to refer to that one work cited by the same author. These two strings do not work when the work is the same as the immediately preceding footnote, when I use "Ibid." to cite the same work (and possibly the same page) with respect to the immediately preceding note, or "Ivi" to cite the same work, but on a different page than the one used in the immediately preceding note.


Update no. 1

Here you are a fully compilable example document. My comments underlined.

\documentclass[12pt]{article}
\usepackage{graphicx}

\usepackage{etoolbox}
\patchcmd{\frontmatter}{roman}{scroman}{}{}
\makeatletter
\DeclareRobustCommand{\doscroman}{\textsc}
\def\scroman#1{\expandafter\@scroman\csname{c@a#1}\endscname}
\def\@scroman#1{\expandafter\doscroman\expandafter{\romannumeral#1}}
\makeatother

%%%%%%%%%%%%%%%%%%
%% Bib settings %%
%%%%%%%%%%%%%%%%%%
\usepackage[style=verbose-trad1,giveninits=true,sorting=nyt,citetracker=true,ibidtracker=context,idemtracker=context,loccittracker=context,opcittracker=true,singletitle=false,uniquetitle=true,uniquework=true,idemtracker=true,ibidpage=true,citepages=omit,strict=true,refsection=section,citereset=section,autocite=inline]{biblatex}
\usepackage{csquotes}
% \usepackage{biblatex-shortfields}

\NewBibliographyString{ivi,opcited,opnoultcit}
% Indicatori
\DefineBibliographyStrings{italian}{%
    opcit={\autocap{c}it\adddot},
    opcited={\autocap{o}p\adddot\ ult\adddot\ cit\adddot},
    opnoultcit={\autocap{o}p\adddot\ cit\adddot},
    loccit={\autocap{o}p\adddot\ et loc\adddot\ ult\adddot\ cit\adddot},
    ivi={\autocap{i}vi},
    idem={\textsc{\autocap{i}d}\adddot},
    idemsf={\textsc{\autocap{e}ad}\adddot},
    idempm={\textsc{\autocap{e}id}\adddot},
    idempf={\textsc{\autocap{e}aed}\adddot},
    idempp={\textsc{\autocap{e}id}\adddot},
}

\DefineBibliographyStrings{english}{%
    opcit={\autocap{c}it\adddot},
    opcited={\autocap{o}p\adddot\ ult\adddot\ cit\adddot},
    opnoultcit={\autocap{o}p\adddot\ cit\adddot},
    loccit={\autocap{o}p\adddot\ et loc\adddot\ ult\adddot\ cit\adddot},
    ivi={\autocap{i}vi},
    idem={\textsc{\autocap{i}d}\adddot},
    idemsf={\textsc{\autocap{e}ad}\adddot},
    idempm={\textsc{\autocap{e}id}\adddot},
    idempf={\textsc{\autocap{e}aed}\adddot},
    idempp={\textsc{\autocap{e}id}\adddot},
}

\renewbibmacro*{cite:ibid}{%
    \ifloccit%
        {\printtext{%
            \bibhyperlink{cite\csuse{cbx@lastcite@\thefield{entrykey}}}{\bibstring[\mkbibemph]{ibidem}}}\global\toggletrue{cbx:loccit}%
        }%
        {\printtext[bibhyperlink]{\bibstring{ivi}}}%
}

% \renewbibmacro*{cite:title}{%
%     {\printtext[bibhyperlink]{\printfield[citetitle]{labeltitle}{\setunit{\addcomma\space}}}\bibstring{opcit}}%
% }

\renewbibmacro*{cite:title}{%
    \printtext[bibhyperlink]{\printfield[citetitle]{labeltitle}\setunit{\addcomma\space}\bibstring{opcit}}%
}

\renewbibmacro*{cite:opcit}{%
    \printtext[bibhyperlink]{\bibstring[\mkbibemph]{opcited}}%
}
    
\renewbibmacro*{cite:loccit}{%
    {\printtext[bibhyperlink]%
    {\bibstring[\mkbibemph]{loccit}}}%
    \global\toggletrue{cbx:loccit}%
}

% Ometti l'autore
\makeatletter
\newcommand{\int@suppauth}{%
  \def\ifciteibid{\@secondoftwo}%
  \renewbibmacro*{cite:name}{}%
  \renewbibmacro*{cite:idem}{}%
  \renewbibmacro*{author}{}%
  \renewbibmacro*{editor+others}{}%
  \renewbibmacro*{translator+others}{}}

\newcommand{\suppauth}{\AtNextCite{\int@suppauth}}

\DeclareCiteCommand*{\parencite}[\mkbibparens]
  {\int@suppauth
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand*{\cite}
  {\int@suppauth
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}
\makeatother

% Punteggiatura
\renewcommand*{\bibinitdelim}{}
\renewcommand*{\subtitlepunct}{\adddot\addspace}
\renewcommand*{\newunitpunct}{\addcomma\addspace}
\renewcommand*{\intitlepunct}{\addspace}
\DeclareAutoCiteCommand{autonote}[r]{\footcite}{\footcites}
\DeclareAutoCiteCommand{footnote}[r]{\footcite}{\footcites}
\DeclareAutoCiteCommand{textnote}[r]{\texttcite}{\textcites}

% Formato grafico dei campi
\DeclareFieldFormat{title}{\mkbibemph{#1}}
\DeclareFieldFormat{titleaddon}{\mkbibemph{#1}}
\DeclareFieldFormat[article]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[inproceedings]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[inreference]{title}{s.v.~\mkbibemph{#1}}
\DeclareFieldFormat[inbook]{title}{\mkbibemph{#1}}
% \DeclareFieldFormat[inbook,inproceedings]{booktitle}{in\space\mkbibemph{#1}}
\DeclareFieldFormat[suppbook]{title}{\mkbibemph{#1}\nopunct}
\DeclareFieldFormat[misc]{title}{#1}
\DeclareFieldFormat[oldcassazione]{title}{#1}
\DeclareFieldFormat[costituzione]{title}{#1}
\DeclareFieldFormat[eulaw]{title}{#1}
\DeclareFieldFormat[codicisoftlaw]{title}{#1}
\DeclareFieldFormat[costituzione]{citetitle}{#1}
\DeclareFieldFormat[eulaw]{citetitle}{#1}
\DeclareFieldFormat[codicisoftlaw]{citetitle}{#1}
\DeclareFieldFormat[thesis]{title}{\mkbibemph{#1}}
\DeclareFieldFormat{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat{citetitleaddon}{\mkbibemph{#1}}
\DeclareFieldFormat[article]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[inreference]{citetitle}{s.v.~\mkbibemph{#1}}
\DeclareFieldFormat[inbook]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[thesis]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[inproceedings]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[nparticle]{journaltitle}{‘{#1}’}
\DeclareFieldFormat{series}{\mkbibquote{#1}}
% \DeclareFieldFormat{journaltitle}{\mkbibquote{#1}}
% \DeclareFieldFormat{journaltitle}{%
%     \iffieldundef{shortjournal}%
%     {\em#1}%
%     {\mkbibquote{#1}}%
% }

\DeclareFieldFormat{edition}{\ifinteger{#1}{\bibstring{edition}~}\textsc{\doscroman{\romannumeral#1}}}
% \DeclareFieldFormat[inproceedings]{title}{\mkbibemph{#1}}
\DeclareFieldFormat{volume}{\bibstring{jourvol}\addnbspace\textsc{\doscroman{\romannumeral#1}}}

% Abbreviazione riviste
\renewbibmacro*{journal}{%
  \ifboolexpr{
    test {\iffieldundef{journaltitle}}
    and
    test {\iffieldundef{journalsubtitle}}
  }
    {}
    {\iffieldundef{shortjournal}%
       {\printtext[journaltitle]{%
          \printfield[titlecase]{journaltitle}%
          \setunit{\subtitlepunct}%
          \printfield[titlecase]{journalsubtitle}}}
       {\printfield[journaltitle]{shortjournal}}%
     \newunit}%
  \iffieldundef{journaltitleaddon}
    {}
    {\printfield{journaltitleaddon}}}

\DeclareBibliographyDriver{shortjournal}{%
  \printfield{journaltitle}}

\defbibcheck{shortjournal}{%
   \iffieldundef{shortjournal}
     {\skipentry}
     {\iffieldundef{journaltitle}
       {\skipentry}
       {\ifcsdef{sjcheck@\therefsection
          -\strfield{shortjournal}=\strfield{journaltitle}}
         {\skipentry}
         {\savefieldcs{journaltitle}{sjcheck@\therefsection
            -\strfield{shortjournal}=\strfield{journaltitle}}}}}}

\DeclareBibliographyDriver{shortjournal}{\printfield{journaltitle}}
% \DeclareBiblistFilter{shortjournal}{\filter[type=field,filter=shortjournal]}

\AtBeginBiblist{shortjournal}{\DeclareFieldFormat{journaltitle}{\em#1}\DeclareFieldFormat{shortjournal}{{#1}}}
\defbibenvironment{shortjournal}{%
    \list{}{%
    \labelsep\biblabelsep%
    \labelwidth=4cm%
    \leftmargin\labelwidth%
    \advance\leftmargin\labelsep%
    \itemsep\bibitemsep%
    \parsep\bibparsep%
    \let\makelabel\printshortjournal}}%
    {\endlist}%
    {\item}
\newcommand*{\printshortjournal}{\RaggedRight\printfield{shortjournal}}%


% Formato autore
% \AtBeginBibliography{
    \def\ifmknamesc{%
      \ifboolexpr{ test {\ifcurrentname{labelname}}
                   or test {\ifcurrentname{author}}
                   or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}
    \renewcommand*{\mkbibnameprefix}[1]{%
      \ifmknamesc{\textsc{#1}}{#1}}
    \renewcommand*{\mkbibnamefamily}[1]{%
      \ifmknamesc{\textsc{#1}}{#1}}
% }

\AtBeginBibliography{\DeclareNameFormat{sortname}{\ifgiveninits{\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}}{\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}\usebibmacro{name:andothers}}}

% Formato curatore
\DefineBibliographyStrings{italian}{%
    editor={a cura di},
    editors={a cura di}
}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

% Attivare funzione idem - previo idemtracker:true
\makeatletter
\newbibmacro{ifrepeatauthor}{\ifciteidem}
\newbibmacro{repeatedauthor}{%
    \bibstring[\mkibid]{idem\thefield{gender}}}%
    % \bibstring[\mkbibsc]{idem\thefield{gender}}}%
    % \iftoggle{cbx:scauthorscite}{\bibstring[\mkbibsc]{idem\thefield{gender}}}{}}%
    \AtBeginBibliography{%
        \renewbibmacro{ifrepeatauthor}{\usebibmacro{bbx:dashcheck}}%
        \renewbibmacro{repeatedauthor}{\bibnamedash}%
    }
    \renewbibmacro*{author}{%
        \ifboolexpr{
            test \ifuseauthor
            and
            not test {\ifnameundef{author}}
        }
        {\usebibmacro{ifrepeatauthor}
        {\usebibmacro{repeatedauthor}}
        {\printnames{author}%
        \setunit{\printdelim{authortypedelim}}%
        \usebibmacro{bbx:savehash}}%
        \usebibmacro{authorstrg}}
        {\global\undef\bbx@lasthash}}
    \renewbibmacro*{bbx:editor}[1]{%
        \ifboolexpr{
            test \ifuseeditor
            and
            not test {\ifnameundef{editor}}
        }
        {\usebibmacro{ifrepeatauthor}
        {\usebibmacro{repeatedauthor}}
        {\printnames{editor}%
        \setunit{\printdelim{editortypedelim}}%
        \usebibmacro{bbx:savehash}}%
        \usebibmacro{#1}%
        \clearname{editor}}
        {\global\undef\bbx@lasthash}}
    \renewbibmacro*{bbx:translator}[1]{%
        \ifboolexpr{
            test \ifusetranslator
            and
            not test {\ifnameundef{translator}}
        }
        {\usebibmacro{ifrepeatauthor}
        {\usebibmacro{repeatedauthor}}
        {\printnames{translator}%
        \setunit{\printdelim{translatortypedelim}}%
        \usebibmacro{bbx:savehash}}%
        \usebibmacro{#1}%
        \clearname{translator}}
        {\global\undef\bbx@lasthash}}
\makeatother

% Indicazione del riferimento in testo senza il nome dell'autore

% Citazione nel testo del nome dell'autore
    \makeatletter%
    \newrobustcmd*{\nextcitenotfullname}{%
        \AtNextCite{%
        \renewcommand*{\mkbibnamefamily}{}%
        \renewcommand*{\mkbibnameprefix}{}%
        }}%
    \newrobustcmd*{\nextcitefullname}{%
        \AtNextCite{\DeclareNameAlias{labelname}{given-family}%
        \renewcommand*{\mkbibnamefamily}{}%
        \renewcommand*{\mkbibnameprefix}{}%
        \togglefalse{abx@bool@giveninits}}}
    \newrobustcmd*{\citeauthorname}{\nextcitenotfullname\citeauthor}
    \newrobustcmd*{\citeauthorfullname}{\nextcitefullname\citeauthor}
    \makeatother

% Istruzioni per riviste
% \renewbibmacro*{issue+date}{%
    % \iffieldundef{number}{\setunit{\addcomma\space}\printfield{number}\usebibmacro{date}}{\setunit{/}\usebibmacro{date}}\newunit}
\renewbibmacro*{volume+number+eid}{%
    \setunit{\addcomma\addspace}%
    \iffieldundef{number}%
        {\printfield{volume}\newunit}%
        {\ifbibliography%
            {\printfield{volume}\newunit}%
        }%
    \newunit\newblock%
    \printfield{number}%
    \newunit\newblock%
    \printfield{eid}%
}

\renewbibmacro{issue+date}{%
    \setunit{\addcomma\space}%
    \iffieldundef{issue}%
        {\usebibmacro{date}\newunit}%
        {\ifbibliography%
            {\printfield{issue}\setunit{/}}%
        \usebibmacro{date}
        }%
    \newunit}

\newcommand*{\volnumdelim}{\addcomma\addspace}
\renewbibmacro*{volume+number+eid}{%
  \iffieldundef{volume}
  {}
  {\setunit{\addcomma\space}\bibstring{jourvol}\addnbspace\printfield{volume}%
  \setunit*{\volnumdelim}}%
  \iffieldundef{number}{}%
  {\setunit{\addcomma\space}\bibstring{number}\addnbspace\printfield{number}}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\DeclareFieldFormat[article]{volume}{\textsc{\romannumeral#1}}

% Istruzioni per collettanee
\usepackage{biblatex-opcit-booktitle}

% Libri: casa editrice, luogo, anno
\renewbibmacro*{publisher+location+date}{\printlist{publisher}\iflistundef{location}{\setunit*{\addcomma\space}}{\setunit*{\addcomma\space}}\printlist{location}\setunit*{~}\usebibmacro{date}\newunit}

% Citazione Url e DOI
\renewbibmacro*{doi+eprint+url}{%
    \ifbibliography{%
    \iftoggle{bbx:doi}%
    {\printfield{doi}}%
    {}%
    \iftoggle{bbx:eprint}%
    {\usebibmacro{eprint}}%
    {}%
    \iftoggle{bbx:url}%
    {\usebibmacro{url+urldate}}%
    {}}}{}

%%%%%%%%%%%%%%%%%%%%%%%%
% Nuovi tipi d'entrate %
%%%%%%%%%%%%%%%%%%%%%%%%

% Newspapers
\NewBibliographyString{innpaper}
\DefineBibliographyStrings{italian}{%
    innpaper={su}
}

\newbibmacro*{su:}{%
    \bibstring{innpaper}\addspace}
    % \printunit{\intitlepunct}}

\DeclareBibliographyDriver{nparticle}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/translator+others}%
    \setunit{\labelnamepunct}\newblock
    \usebibmacro{title}%
    \newunit
    \printlist{language}%
    \newunit\newblock
    \usebibmacro{byauthor}%
    \newunit\newblock
    \usebibmacro{bytranslator+others}%
    \newunit\newblock
    \printfield{version}%
    \newunit\newblock
    {\usebibmacro{su:}}%
    \usebibmacro{journal+issuetitle}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \usebibmacro{note+pages}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
    {\printfield{issn}}
    {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{pageref}%
    \usebibmacro{finentry}}

% Costituzione e leggi brevi
\DeclareBibliographyDriver{costituzione}%
    {%
    \printfield{title}%
    \ifbibliography{%
    \newunit\newblock%
    \printfield{note}\addspace\printdate%
    \newunit\newblock%
    \printfield{subtitle}%
    \newunit\newblock%
    \printfield{addendum}%
    }{}%
    \finentry}

% Related
\AtEveryCitekey{\togglefalse{bbx:related}}

% Ordine riferimenti bibliografici
\DeclareSortingTemplate{sortjournals}{
    \sort[direction=ascending]{\field{shortjournal}}
    \sort[direction=ascending]{\field{journaltitle}}
}

\DeclareSortingTemplate{iuris}{
        \sort[direction=ascending]{\field{year}}
        \sort[direction=ascending]{\field{month}}
        \sort[direction=ascending]{\field{day}}
        \sort[direction=ascending]{\field{number}}
        \sort{\field{author}}
    }

% Input finali
\renewcommand*{\bibfont}{\small}
\renewbibmacro*{citeindex}{\indexnames{labelname}{}}


\addbibresource{quoted.bib}

\begin{filecontents}{quoted.bib}
@article{secondauthor,
    author={Neri, Lucia},gender={sf},
    title={Mario Rossi and its nice book},
    subtitle={A new writing theory?},
    journal={Dream up},
    number={5},year={2021},
    pages={231--233}
}

@book{firstauthor,
    author={Rossi, Mario},gender={sm},
    title={My first book},
    subtitle={Writing skills},
    edition={3},
    editor={Muratore, Adriano},
    publisher={Happy Penguin Feet},
    address={Somewhere},
    year={2023}
}

@inbook{secondauthorbis,
    author={Neri, Lucia},gender={sf},
    title={A new rulebook},
    booktitle={Grammar for pigeons},
    editor={Graziani, Amedeo and Endrici, Rosalba},
    publisher={Animal School},
    address={Nowhere},
    year={2024},
    pages={75--92}
}
\end{filecontents}

\usepackage{hyperref}

\title{Test}
\author{Francesco Contini}
\date{}

\begin{document}

\maketitle
\section{Introduction}
Just an example\footnote{See \cite{firstauthor}.}. \citeauthorfullname{firstauthor} explains its modern theory\footnote{See \cite[25--75]{firstauthor}.} and gives us some exercises\footnote{See \cite[25--75]{firstauthor}.}. A recent review tells us it is something of new\footnote{See \cite[233]{secondauthor}. The author confirms its affirmation to the last edition of the book in \cite[90]{secondauthorbis}.}. But, if we read any of these entries, we discover that both are totally demented: there is no any book\footnote{I am referring to \cite{firstauthor}. \underline{Here I would like to have} \emph{op.\ cit.} instead, because I cite in the entire document only this entry by Mario Rossi.}. So that also reviews are totally crazy, especially the curatorship\footnote{\Cite[90]{secondauthorbis}. See also \cite{secondauthor}. \underline{It works.}}.

Finally, not only I totally dreamt up the book\footnote{\Cite{firstauthor}. \underline{Here I would like to have \emph{op.\ cit.} instead. Explanations \emph{supra}.}}, but also the reviews\footnote{So \cite{secondauthor}; \cite{secondauthorbis}. \underline{It works.}}.


\printbibliography[heading=bibintoc]

\end{document}

Update no. 2

Just change the entry @book{firstauthor} from the filecontents quoted.bib with:

@book{firstauthor,
    author={Rossi, Mario},gender={sm},
    title={My first book},
    subtitle={Writing skills},
    edition={3},
    editor={Muratore, Adriano},
    publisher={Happy Penguin Feet},
    address={Somewhere},
    year={2023},
    related={firstauthorformeredition},
    relatedtype={reprintof}
}

@book{firstauthorformeredition,
    author={Rossi, Mario},gender={sm},
    title={My first book},
    subtitle={Writing skills},
    publisher={Happy Penguin Feet},
    address={Somewhere},
    year={2021},
}
3

1 Answer 1

2

It should be enough to enable the \ifsingletitle test with the singletitle=true, option (for some reason the code has an explicit singletitle=false,...) and use that in cite:opcit like so

\renewbibmacro*{cite:opcit}{%
  \ifsingletitle
    {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opnoultcit}}}
    {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opultcit}}}%
}

(where I renamed the bibstrings slightly because I found the original names confusing).

\documentclass[12pt]{article}

\usepackage{etoolbox}
\patchcmd{\frontmatter}{roman}{scroman}{}{}
\makeatletter
\DeclareRobustCommand{\doscroman}{\textsc}
\def\scroman#1{\expandafter\@scroman\csname{c@a#1}\endscname}
\def\@scroman#1{\expandafter\doscroman\expandafter{\romannumeral#1}}
\makeatother

\usepackage[
  style=verbose-trad1,
  sorting=nyt,
  giveninits=true,
  citetracker=true,
  ibidtracker=context,
  idemtracker=context,
  loccittracker=context,
  opcittracker=true,
  singletitle=true,
  uniquework=true,
  idemtracker=true,
  ibidpage=true,
  citepages=omit,
  strict=true,
  refsection=section,
  citereset=section,
  autocite=inline,
]{biblatex}
\usepackage{csquotes}
% \usepackage{biblatex-shortfields}

\NewBibliographyString{ivi,opultcit,opnoultcit}
% Indicatori
\DefineBibliographyStrings{italian}{%
  opcit      = {cit\adddot},
  opultcit   = {op\adddot\ ult\adddot\ cit\adddot},
  opnoultcit = {op\adddot\ cit\adddot},
  loccit     = {op\adddot\ et loc\adddot\ ult\adddot\ cit\adddot},
  ivi        = {ivi},
  idem       = {\textsc{\autocap{i}d}\adddot},
  idemsf     = {\textsc{\autocap{e}ad}\adddot},
  idempm     = {\textsc{\autocap{e}id}\adddot},
  idempf     = {\textsc{\autocap{e}aed}\adddot},
  idempp     = {\textsc{\autocap{e}id}\adddot},
}

\DefineBibliographyStrings{english}{%
  opcit      = {cit\adddot},
  opultcit   = {op\adddot\ ult\adddot\ cit\adddot},
  opnoultcit = {op\adddot\ cit\adddot},
  loccit     = {op\adddot\ et loc\adddot\ ult\adddot\ cit\adddot},
  ivi        = {ivi},
  idem       = {\textsc{\autocap{i}d}\adddot},
  idemsf     = {\textsc{\autocap{e}ad}\adddot},
  idempm     = {\textsc{\autocap{e}id}\adddot},
  idempf     = {\textsc{\autocap{e}aed}\adddot},
  idempp     = {\textsc{\autocap{e}id}\adddot},
}

\renewbibmacro*{cite:ibid}{%
    \ifloccit%
        {\printtext{%
            \bibhyperlink{cite\csuse{cbx@lastcite@\thefield{entrykey}}}{\bibstring[\mkbibemph]{ibidem}}}\global\toggletrue{cbx:loccit}%
        }%
        {\printtext[bibhyperlink]{\bibstring{ivi}}}%
}

% \renewbibmacro*{cite:title}{%
%     {\printtext[bibhyperlink]{\printfield[citetitle]{labeltitle}{\setunit{\addcomma\space}}}\bibstring{opcit}}%
% }

\renewbibmacro*{cite:title}{%
    \printtext[bibhyperlink]{\printfield[citetitle]{labeltitle}\setunit{\addcomma\space}\bibstring{opcit}}%
}

\renewbibmacro*{cite:opcit}{%
  \ifsingletitle
    {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opnoultcit}}}
    {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opultcit}}}%
}

\renewbibmacro*{cite:loccit}{%
    {\printtext[bibhyperlink]%
    {\bibstring[\mkbibemph]{loccit}}}%
    \global\toggletrue{cbx:loccit}%
}

% Ometti l'autore
\makeatletter
\newcommand{\int@suppauth}{%
  \def\ifciteibid{\@secondoftwo}%
  \renewbibmacro*{cite:name}{}%
  \renewbibmacro*{cite:idem}{}%
  \renewbibmacro*{author}{}%
  \renewbibmacro*{editor+others}{}%
  \renewbibmacro*{translator+others}{}}

\newcommand{\suppauth}{\AtNextCite{\int@suppauth}}

\DeclareCiteCommand*{\parencite}[\mkbibparens]
  {\int@suppauth
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand*{\cite}
  {\int@suppauth
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}
\makeatother

% Punteggiatura
\renewcommand*{\bibinitdelim}{}
\renewcommand*{\subtitlepunct}{\adddot\addspace}
\renewcommand*{\newunitpunct}{\addcomma\addspace}
\renewcommand*{\intitlepunct}{\addspace}
\DeclareAutoCiteCommand{autonote}[r]{\footcite}{\footcites}
\DeclareAutoCiteCommand{footnote}[r]{\footcite}{\footcites}
\DeclareAutoCiteCommand{textnote}[r]{\texttcite}{\textcites}

% Formato grafico dei campi
\DeclareFieldFormat{title}{\mkbibemph{#1}}
\DeclareFieldFormat{titleaddon}{\mkbibemph{#1}}
\DeclareFieldFormat[article]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[inproceedings]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection]{title}{\mkbibemph{#1}}
\DeclareFieldFormat[inreference]{title}{s.v.~\mkbibemph{#1}}
\DeclareFieldFormat[inbook]{title}{\mkbibemph{#1}}
% \DeclareFieldFormat[inbook,inproceedings]{booktitle}{in\space\mkbibemph{#1}}
\DeclareFieldFormat[suppbook]{title}{\mkbibemph{#1}\nopunct}
\DeclareFieldFormat[misc]{title}{#1}
\DeclareFieldFormat[oldcassazione]{title}{#1}
\DeclareFieldFormat[costituzione]{title}{#1}
\DeclareFieldFormat[eulaw]{title}{#1}
\DeclareFieldFormat[codicisoftlaw]{title}{#1}
\DeclareFieldFormat[costituzione]{citetitle}{#1}
\DeclareFieldFormat[eulaw]{citetitle}{#1}
\DeclareFieldFormat[codicisoftlaw]{citetitle}{#1}
\DeclareFieldFormat[thesis]{title}{\mkbibemph{#1}}
\DeclareFieldFormat{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat{citetitleaddon}{\mkbibemph{#1}}
\DeclareFieldFormat[article]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[incollection]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[inreference]{citetitle}{s.v.~\mkbibemph{#1}}
\DeclareFieldFormat[inbook]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[thesis]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[inproceedings]{citetitle}{\mkbibemph{#1}}
\DeclareFieldFormat[nparticle]{journaltitle}{‘{#1}’}
\DeclareFieldFormat{series}{\mkbibquote{#1}}
% \DeclareFieldFormat{journaltitle}{\mkbibquote{#1}}
% \DeclareFieldFormat{journaltitle}{%
%     \iffieldundef{shortjournal}%
%     {\em#1}%
%     {\mkbibquote{#1}}%
% }

\DeclareFieldFormat{edition}{\ifinteger{#1}{\bibstring{edition}~}\textsc{\doscroman{\romannumeral#1}}}
% \DeclareFieldFormat[inproceedings]{title}{\mkbibemph{#1}}
\DeclareFieldFormat{volume}{\bibstring{jourvol}\addnbspace\textsc{\doscroman{\romannumeral#1}}}

% Abbreviazione riviste
\renewbibmacro*{journal}{%
  \ifboolexpr{
    test {\iffieldundef{journaltitle}}
    and
    test {\iffieldundef{journalsubtitle}}
  }
    {}
    {\iffieldundef{shortjournal}%
       {\printtext[journaltitle]{%
          \printfield[titlecase]{journaltitle}%
          \setunit{\subtitlepunct}%
          \printfield[titlecase]{journalsubtitle}}}
       {\printfield[journaltitle]{shortjournal}}%
     \newunit}%
  \iffieldundef{journaltitleaddon}
    {}
    {\printfield{journaltitleaddon}}}

\DeclareBibliographyDriver{shortjournal}{%
  \printfield{journaltitle}}

\defbibcheck{shortjournal}{%
   \iffieldundef{shortjournal}
     {\skipentry}
     {\iffieldundef{journaltitle}
       {\skipentry}
       {\ifcsdef{sjcheck@\therefsection
          -\strfield{shortjournal}=\strfield{journaltitle}}
         {\skipentry}
         {\savefieldcs{journaltitle}{sjcheck@\therefsection
            -\strfield{shortjournal}=\strfield{journaltitle}}}}}}

\DeclareBibliographyDriver{shortjournal}{\printfield{journaltitle}}
% \DeclareBiblistFilter{shortjournal}{\filter[type=field,filter=shortjournal]}

\AtBeginBiblist{shortjournal}{\DeclareFieldFormat{journaltitle}{\em#1}\DeclareFieldFormat{shortjournal}{{#1}}}
\defbibenvironment{shortjournal}{%
    \list{}{%
    \labelsep\biblabelsep%
    \labelwidth=4cm%
    \leftmargin\labelwidth%
    \advance\leftmargin\labelsep%
    \itemsep\bibitemsep%
    \parsep\bibparsep%
    \let\makelabel\printshortjournal}}%
    {\endlist}%
    {\item}
\newcommand*{\printshortjournal}{\RaggedRight\printfield{shortjournal}}%


% Formato autore
% \AtBeginBibliography{
    \def\ifmknamesc{%
      \ifboolexpr{ test {\ifcurrentname{labelname}}
                   or test {\ifcurrentname{author}}
                   or ( test {\ifnameundef{author}} and test {\ifcurrentname{editor}} ) }}
    \renewcommand*{\mkbibnameprefix}[1]{%
      \ifmknamesc{\textsc{#1}}{#1}}
    \renewcommand*{\mkbibnamefamily}[1]{%
      \ifmknamesc{\textsc{#1}}{#1}}
% }

\AtBeginBibliography{\DeclareNameFormat{sortname}{\ifgiveninits{\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}}{\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}\usebibmacro{name:andothers}}}

% Formato curatore
\DefineBibliographyStrings{italian}{%
    editor={a cura di},
    editors={a cura di}
}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

% Attivare funzione idem - previo idemtracker:true
\makeatletter
\newbibmacro{ifrepeatauthor}{\ifciteidem}
\newbibmacro{repeatedauthor}{%
    \bibstring[\mkibid]{idem\thefield{gender}}}%
    % \bibstring[\mkbibsc]{idem\thefield{gender}}}%
    % \iftoggle{cbx:scauthorscite}{\bibstring[\mkbibsc]{idem\thefield{gender}}}{}}%
    \AtBeginBibliography{%
        \renewbibmacro{ifrepeatauthor}{\usebibmacro{bbx:dashcheck}}%
        \renewbibmacro{repeatedauthor}{\bibnamedash}%
    }
    \renewbibmacro*{author}{%
        \ifboolexpr{
            test \ifuseauthor
            and
            not test {\ifnameundef{author}}
        }
        {\usebibmacro{ifrepeatauthor}
        {\usebibmacro{repeatedauthor}}
        {\printnames{author}%
        \setunit{\printdelim{authortypedelim}}%
        \usebibmacro{bbx:savehash}}%
        \usebibmacro{authorstrg}}
        {\global\undef\bbx@lasthash}}
    \renewbibmacro*{bbx:editor}[1]{%
        \ifboolexpr{
            test \ifuseeditor
            and
            not test {\ifnameundef{editor}}
        }
        {\usebibmacro{ifrepeatauthor}
        {\usebibmacro{repeatedauthor}}
        {\printnames{editor}%
        \setunit{\printdelim{editortypedelim}}%
        \usebibmacro{bbx:savehash}}%
        \usebibmacro{#1}%
        \clearname{editor}}
        {\global\undef\bbx@lasthash}}
    \renewbibmacro*{bbx:translator}[1]{%
        \ifboolexpr{
            test \ifusetranslator
            and
            not test {\ifnameundef{translator}}
        }
        {\usebibmacro{ifrepeatauthor}
        {\usebibmacro{repeatedauthor}}
        {\printnames{translator}%
        \setunit{\printdelim{translatortypedelim}}%
        \usebibmacro{bbx:savehash}}%
        \usebibmacro{#1}%
        \clearname{translator}}
        {\global\undef\bbx@lasthash}}
\makeatother

% Indicazione del riferimento in testo senza il nome dell'autore

% Citazione nel testo del nome dell'autore
    \makeatletter%
    \newrobustcmd*{\nextcitenotfullname}{%
        \AtNextCite{%
        \renewcommand*{\mkbibnamefamily}{}%
        \renewcommand*{\mkbibnameprefix}{}%
        }}%
    \newrobustcmd*{\nextcitefullname}{%
        \AtNextCite{\DeclareNameAlias{labelname}{given-family}%
        \renewcommand*{\mkbibnamefamily}{}%
        \renewcommand*{\mkbibnameprefix}{}%
        \togglefalse{abx@bool@giveninits}}}
    \newrobustcmd*{\citeauthorname}{\nextcitenotfullname\citeauthor}
    \newrobustcmd*{\citeauthorfullname}{\nextcitefullname\citeauthor}
    \makeatother

% Istruzioni per riviste
% \renewbibmacro*{issue+date}{%
    % \iffieldundef{number}{\setunit{\addcomma\space}\printfield{number}\usebibmacro{date}}{\setunit{/}\usebibmacro{date}}\newunit}
\renewbibmacro*{volume+number+eid}{%
    \setunit{\addcomma\addspace}%
    \iffieldundef{number}%
        {\printfield{volume}\newunit}%
        {\ifbibliography%
            {\printfield{volume}\newunit}%
        }%
    \newunit\newblock%
    \printfield{number}%
    \newunit\newblock%
    \printfield{eid}%
}

\renewbibmacro{issue+date}{%
    \setunit{\addcomma\space}%
    \iffieldundef{issue}%
        {\usebibmacro{date}\newunit}%
        {\ifbibliography%
            {\printfield{issue}\setunit{/}}%
        \usebibmacro{date}
        }%
    \newunit}

\newcommand*{\volnumdelim}{\addcomma\addspace}
\renewbibmacro*{volume+number+eid}{%
  \iffieldundef{volume}
  {}
  {\setunit{\addcomma\space}\bibstring{jourvol}\addnbspace\printfield{volume}%
  \setunit*{\volnumdelim}}%
  \iffieldundef{number}{}%
  {\setunit{\addcomma\space}\bibstring{number}\addnbspace\printfield{number}}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\DeclareFieldFormat[article]{volume}{\textsc{\romannumeral#1}}

% Istruzioni per collettanee
\usepackage{biblatex-opcit-booktitle}

% Libri: casa editrice, luogo, anno
\renewbibmacro*{publisher+location+date}{\printlist{publisher}\iflistundef{location}{\setunit*{\addcomma\space}}{\setunit*{\addcomma\space}}\printlist{location}\setunit*{~}\usebibmacro{date}\newunit}

% Citazione Url e DOI
\renewbibmacro*{doi+eprint+url}{%
    \ifbibliography{%
    \iftoggle{bbx:doi}%
    {\printfield{doi}}%
    {}%
    \iftoggle{bbx:eprint}%
    {\usebibmacro{eprint}}%
    {}%
    \iftoggle{bbx:url}%
    {\usebibmacro{url+urldate}}%
    {}}}{}

%%%%%%%%%%%%%%%%%%%%%%%%
% Nuovi tipi d'entrate %
%%%%%%%%%%%%%%%%%%%%%%%%

% Newspapers
\NewBibliographyString{innpaper}
\DefineBibliographyStrings{italian}{%
    innpaper={su}
}

\newbibmacro*{su:}{%
    \bibstring{innpaper}\addspace}
    % \printunit{\intitlepunct}}

\DeclareBibliographyDriver{nparticle}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/translator+others}%
    \setunit{\labelnamepunct}\newblock
    \usebibmacro{title}%
    \newunit
    \printlist{language}%
    \newunit\newblock
    \usebibmacro{byauthor}%
    \newunit\newblock
    \usebibmacro{bytranslator+others}%
    \newunit\newblock
    \printfield{version}%
    \newunit\newblock
    {\usebibmacro{su:}}%
    \usebibmacro{journal+issuetitle}%
    \newunit\newblock
    \usebibmacro{byeditor+others}%
    \newunit\newblock
    \usebibmacro{note+pages}%
    \newunit\newblock
    \iftoggle{bbx:isbn}
    {\printfield{issn}}
    {}%
    \newunit\newblock
    \usebibmacro{doi+eprint+url}%
    \newunit\newblock
    \usebibmacro{pageref}%
    \usebibmacro{finentry}}

% Costituzione e leggi brevi
\DeclareBibliographyDriver{costituzione}%
    {%
    \printfield{title}%
    \ifbibliography{%
    \newunit\newblock%
    \printfield{note}\addspace\printdate%
    \newunit\newblock%
    \printfield{subtitle}%
    \newunit\newblock%
    \printfield{addendum}%
    }{}%
    \finentry}

% Related
\AtEveryCitekey{\togglefalse{bbx:related}}

% Ordine riferimenti bibliografici
\DeclareSortingTemplate{sortjournals}{
    \sort[direction=ascending]{\field{shortjournal}}
    \sort[direction=ascending]{\field{journaltitle}}
}

\DeclareSortingTemplate{iuris}{
        \sort[direction=ascending]{\field{year}}
        \sort[direction=ascending]{\field{month}}
        \sort[direction=ascending]{\field{day}}
        \sort[direction=ascending]{\field{number}}
        \sort{\field{author}}
    }

% Input finali
\renewcommand*{\bibfont}{\small}
\renewbibmacro*{citeindex}{\indexnames{labelname}{}}


\addbibresource{\jobname.bib}

\begin{filecontents}{\jobname.bib}
@article{secondauthor,
    author={Neri, Lucia},gender={sf},
    title={Mario Rossi and its nice book},
    subtitle={A new writing theory?},
    journal={Dream up},
    number={5},year={2021},
    pages={231--233}
}

@book{firstauthor,
    author={Rossi, Mario},gender={sm},
    title={My first book},
    subtitle={Writing skills},
    edition={3},
    editor={Muratore, Adriano},
    publisher={Happy Penguin Feet},
    address={Somewhere},
    year={2023}
}

@inbook{secondauthorbis,
    author={Neri, Lucia},gender={sf},
    title={A new rulebook},
    booktitle={Grammar for pigeons},
    editor={Graziani, Amedeo and Endrici, Rosalba},
    publisher={Animal School},
    address={Nowhere},
    year={2024},
    pages={75--92}
}
\end{filecontents}

\usepackage{hyperref}

\title{Test}
\author{Francesco Contini}
\date{}

\begin{document}
\section{Introduction}
Just an example\footnote{See \cite{firstauthor}.}.
\citeauthor{firstauthor} explains its modern theory%
\footnote{See \cite[25--75]{firstauthor}.}
and gives us some exercises\footnote{See \cite[25--75]{firstauthor}.}.
A recent review tells us it is something of new%
\footnote{See \cite[233]{secondauthor}.
The author confirms its affirmation to the last edition of the book in
\cite[90]{secondauthorbis}.}.
But, if we read any of these entries, we discover that both are totally demented:
there is no any book\footnote{I am referring to \cite{firstauthor}.
\underline{Here I would like to have} \emph{op.\ cit.} instead,
because I cite in the entire document only this entry by Mario Rossi.}.
So that also reviews are totally crazy, especially the curatorship%
\footnote{\Cite[90]{secondauthorbis}.
See also \cite{secondauthor}. \underline{It works.}}.

Finally, not only I totally dreamt up the book%
\footnote{\Cite{firstauthor}.
\underline{Here I would like to have \emph{op.\ cit.} instead.
Explanations \emph{supra}.}},
but also the reviews\footnote{So \cite{secondauthor};
\cite{secondauthorbis}. \underline{It works.}}.


\printbibliography[heading=bibintoc]
\end{document}

5 I am referring to Rossi, op. cit.
6 Neri, op. et loc. ult. cit. See also ead., Mario Rossi and its nice book, cit.
7 Rossi, op. cit.
8 So Neri, op. ult. cit.; ead., A new rulebook, cit.


Here is a LaTeX-side reimplementation of \ifsingletitle called \ifcitesingletitle that only takes into account works cited for the single title test. This should avoid issues with related entries and the like.

\documentclass[12pt]{article}


\usepackage[
  style=verbose-trad1,
  sorting=nyt,
  giveninits=true,
  citetracker=true,
  ibidtracker=context,
  idemtracker=context,
  loccittracker=context,
  opcittracker=true,
  singletitle=true,
  uniquework=true,
  idemtracker=true,
  ibidpage=true,
  citepages=omit,
  strict=true,
  refsection=section,
  citereset=section,
  autocite=inline,
]{biblatex}
\usepackage{csquotes}
% \usepackage{biblatex-shortfields}

\NewBibliographyString{ivi,opultcit,opnoultcit}
% Indicatori
\DefineBibliographyStrings{italian}{%
  opcit      = {cit\adddot},
  opultcit   = {op\adddot\ ult\adddot\ cit\adddot},
  opnoultcit = {op\adddot\ cit\adddot},
  loccit     = {op\adddot\ et loc\adddot\ ult\adddot\ cit\adddot},
  ivi        = {ivi},
  idem       = {\textsc{\autocap{i}d}\adddot},
  idemsf     = {\textsc{\autocap{e}ad}\adddot},
  idempm     = {\textsc{\autocap{e}id}\adddot},
  idempf     = {\textsc{\autocap{e}aed}\adddot},
  idempp     = {\textsc{\autocap{e}id}\adddot},
}

\DefineBibliographyStrings{english}{%
  opcit      = {cit\adddot},
  opultcit   = {op\adddot\ ult\adddot\ cit\adddot},
  opnoultcit = {op\adddot\ cit\adddot},
  loccit     = {op\adddot\ et loc\adddot\ ult\adddot\ cit\adddot},
  ivi        = {ivi},
  idem       = {\textsc{\autocap{i}d}\adddot},
  idemsf     = {\textsc{\autocap{e}ad}\adddot},
  idempm     = {\textsc{\autocap{e}id}\adddot},
  idempf     = {\textsc{\autocap{e}aed}\adddot},
  idempp     = {\textsc{\autocap{e}id}\adddot},
}

\makeatletter
\def\abx@aux@citesingletitlecount#1#2{%
  \csnumgdef{blx@citesingletitle@counter@#1}{#2}}

\def\ifcitesingletitle{%
  \ifcsundef{blx@citesingletitle@counter@\thefield{namehash}}
    {\@secondoftwo}
    {\ifnumless{\csuse{blx@citesingletitle@counter@\thefield{namehash}}}{2}}}

\let\blx@citesingletitle@namelist\empty

\AtEveryCitekey{%
  \xifinlist{\thefield{namehash}}{\blx@citesingletitle@namelist}
    {}
    {\listxadd{\blx@citesingletitle@namelist}{\thefield{namehash}}}%
  \xifinlistcs{\thefield{entrykey}}{blx@citesingletitle@\thefield{namehash}}
    {}
    {\listcsxadd{blx@citesingletitle@\thefield{namehash}}{\thefield{entrykey}}}%
}

\blx@AtEndDocument{%
  \def\do#1{%
    \begingroup
      \blx@tempcnta\z@
      \def\do##1{%
        \advance\blx@tempcnta\@ne
      }
      \dolistcsloop{blx@citesingletitle@#1}%
      \blx@auxwrite\@mainaux{}{%
        \string\abx@aux@citesingletitlecount{#1}{\the\blx@tempcnta}}%
      \ifnumequal{0\csuse{blx@citesingletitle@counter@#1}}{\blx@tempcnta}
        {}
        {\blx@rerun@latex}%
    \endgroup
  }
  \dolistloop{\blx@citesingletitle@namelist}%
}
\makeatother


\renewbibmacro*{cite:ibid}{%
  \ifloccit%
    {\printtext{%
       \bibhyperlink{cite\csuse{cbx@lastcite@\thefield{entrykey}}}{%
         \bibstring[\mkbibemph]{ibidem}}}%
     \global\toggletrue{cbx:loccit}}%
    {\printtext[bibhyperlink]{\bibstring{ivi}}}}

\renewbibmacro*{cite:title}{%
  \printtext[bibhyperlink]{%
    \printfield[citetitle]{labeltitle}%
    \setunit{\addcomma\space}%
    \bibstring{opcit}}%
}

\renewbibmacro*{cite:opcit}{%
  \ifcitesingletitle
    {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opnoultcit}}}
    {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opultcit}}}%
}

\renewbibmacro*{cite:loccit}{%
  \printtext[bibhyperlink]{%
    \bibstring[\mkbibemph]{loccit}}%
  \global\toggletrue{cbx:loccit}%
}


\begin{filecontents}{\jobname.bib}
@article{secondauthor,
    author={Neri, Lucia},gender={sf},
    title={Mario Rossi and its nice book},
    subtitle={A new writing theory?},
    journal={Dream up},
    number={5},year={2021},
    pages={231--233}
}
@book{firstauthor,
    author={Rossi, Mario},gender={sm},
    title={My first book},
    subtitle={Writing skills},
    edition={3},
    editor={Muratore, Adriano},
    publisher={Happy Penguin Feet},
    address={Somewhere},
    year={2023},
    related={firstauthorformeredition},
    relatedtype={reprintof}
}
@book{firstauthorformeredition,
    author={Rossi, Mario},gender={sm},
    title={My first book},
    subtitle={Writing skills},
    publisher={Happy Penguin Feet},
    address={Somewhere},
    year={2021},
}
@inbook{secondauthorbis,
    author={Neri, Lucia},gender={sf},
    title={A new rulebook},
    booktitle={Grammar for pigeons},
    editor={Graziani, Amedeo and Endrici, Rosalba},
    publisher={Animal School},
    address={Nowhere},
    year={2024},
    pages={75--92}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\usepackage{hyperref}

\begin{document}
\section{Introduction}
Just an example\footnote{See \cite{firstauthor}.}.
\citeauthor{firstauthor} explains its modern theory%
\footnote{See \cite[25--75]{firstauthor}.}
and gives us some exercises\footnote{See \cite[25--75]{firstauthor}.}.
A recent review tells us it is something of new%
\footnote{See \cite[233]{secondauthor}.
The author confirms its affirmation to the last edition of the book in
\cite[90]{secondauthorbis}.}.
But, if we read any of these entries, we discover that both are totally demented:
there is no any book\footnote{I am referring to \cite{firstauthor}.
\underline{Here I would like to have} \emph{op.\ cit.} instead,
because I cite in the entire document only this entry by Mario Rossi.}.
So that also reviews are totally crazy, especially the curatorship%
\footnote{\Cite[90]{secondauthorbis}.
See also \cite{secondauthor}. \underline{It works.}}.

Finally, not only I totally dreamt up the book%
\footnote{\Cite{firstauthor}.
\underline{Here I would like to have \emph{op.\ cit.} instead.
Explanations \emph{supra}.}},
but also the reviews\footnote{So \cite{secondauthor};
\cite{secondauthorbis}. \underline{It works.}}.


\printbibliography[heading=bibintoc]
\end{document}
7
  • Well done, even though, in truth, there is one problem. It is my fault, because I did not express it before and I hope not to have to ask a new question. The problem refers to that unique work of an author (to be clear, the one for which I asked to force "op. cit." and for which you highlighted the option singletitle=false). What happens if I add a related entry to this work in the .bib source? For example, the reprint or the original version? For an example, see my second update at the bottom. Mar 3 at 16:03
  • Just modified my question with the second update. So, your solution gives me “op. ult. cit.” at the output, which would also have its own logic. However, as you may have noticed from reading my code, I only want the related entry information in the bibliography and not in the citations. So I ask you what step I need to add in order to have “op. cit.” also in this case, no matter if (and even if) the cited entry has got related. Mar 3 at 16:09
  • What about as follows? \renewbibmacro*{cite:opcit}{% \ifsingletitle {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opnoultcit}}}% {\iffieldundef{related}% {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opultcit}}}% {\printtext[bibhyperlink]{\bibstring[\mkbibemph]{opnoultcit}}}}% } Mar 3 at 17:09
  • Not. It does not work. Here is the link to a previous question of mine, which you yourself answered, in which you gave me the command \AtEveryCitekey{\togglefalse{bbx:related}} tex.stackexchange.com/questions/705905/… Mar 4 at 8:46
  • @cicciocontini The singletitle value is calculated on the Biber side. As soon as you have another work by the same author it will be false giving you the undesirable outcome in this case. I think this requires a new Biber feature, but I don't yet have a good notion of how it should work.
    – moewe
    Mar 5 at 7:07

You must log in to answer this question.

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