20

In this example, the shorthandintro "henceforth cited as ..." is written, even when there is no more citation. I would prefer it if only those references that actually are repeated get the "henceforth" and are included in the list of shorthands.

\documentclass{article}
\usepackage[style=verbose]{biblatex}
\addbibresource{biblatex-examples.bib}
\addbibresource{blref.bib}

\begin{document}
Foo.\autocite{kant:kpv}
Bar.\autocite{kant:ku}

Baz.\autocite{kant:kpv}

\printshorthands
\printbibliography
\end{document}

So with this example I get

pdf

I would prefer to only get the henceforth info for KpV and to not have KU appear in the list of abbreviations.

10
+100

The first problem (no "henceforth cited as..." for items cited only one time) was already solved here.

The second problem (no items cited only one time listed in Abbreviations) was already treated here (might this question be considered a duplicate of it?).

EDIT: Based on those, my solution follows (as suggested by moewe, I've changed my previous one to make it more elegant):

\documentclass{article}

\usepackage[style=verbose,backend=biber,citecounter=true]{biblatex} % option citecounter=true added
\addbibresource{biblatex-examples.bib}
\addbibresource{blref.bib}

% Set threshold to 1
\newcommand{\SHthreshold}{1}

% Redefinition of shorthandintro
\savebibmacro{shorthandintro}
\renewbibmacro*{shorthandintro}{%
  \ifnumgreater{\value{citecounter}}{\SHthreshold}%
    {\restorebibmacro{shorthandintro}%
     \usebibmacro{shorthandintro}}%
    {}}

% Consider only items cited more than threshold-value times for Abbreviations list
\defbibcheck{shorthand}{%
  \iffieldundef{shorthand}%
    {\skipentry}%
    {\ifnumgreater{\value{citecounter}}{\SHthreshold}%
       {}%
       {\skipentry}}}

\begin{document}
Foo.\autocite{kant:kpv}
Bar.\autocite{kant:ku}

Baz.\autocite{kant:kpv}

\printshorthands
\printbibliography
\end{document}

I leave also my previous solution for completeness:

\documentclass{article}
\usepackage[style=verbose,citecounter=true]{biblatex} % option citecounter=true added
\addbibresource{biblatex-examples.bib}
\addbibresource{blref.bib}

% Set threshold to 1
\newcommand{\SHthreshold}{1}

\renewbibmacro*{cite:full}{%
    \usebibmacro{cite:full:citepages}%
    \printtext[bibhypertarget]{%
        \usedriver
        {\DeclareNameAlias{sortname}{default}}
        {\thefield{entrytype}}}%
    %   \usebibmacro{shorthandintro}}% DELETED
    \ifnumgreater{\value{citecounter}}{\SHthreshold}{% NEW
        \usebibmacro{shorthandintro}% NEW
    }{% NEW
}% NEW
}% NEW

% Category with citecounter > 1 
\DeclareBibliographyCategory{allowshorthand}
\AtEveryCitekey{%
    \ifnumgreater{\value{citecounter}}{\SHthreshold}{%
        \addtocategory{allowshorthand}{\thefield{entrykey}}%
    }{%
}%
}

\begin{document}
Foo.\autocite{kant:kpv}
Bar.\autocite{kant:ku}

Baz.\autocite{kant:kpv}

\printshorthands[category=allowshorthand] % option category=allowshorthand added
\printbibliography
\end{document}

enter image description here

  • 1
    Thank you very much. It seems indeed that this question is pretty much a duplicate, I should have done some more research.... Would you mind using a \defbibcheck-approach to the \printshorthands thingy instead of a bibliography category? \defbibcheck{shorthand}{% \iffieldundef{shorthand} {\skipentry} {\ifnumgreater{\value{citecounter}}{1} {} {\skipentry}}} should more or less be enough and we can get rid of the category. That would make things even more elegant. And it would add value over the other answer. – moewe Aug 25 '16 at 7:20
  • 1
    If you wanted to make your answer even more different you could move the citecount check to the shorthandintro macro making sure that the code works out of the box for almost all standard styles without modification. – moewe Aug 25 '16 at 7:21
  • 1
    Great! I'm sorry I didn't find those earlier questions. With the changes moewe suggested (and a slightly different name for the threshold) this would be a good change for biblatex I think (with the threshold being 1 by default). – pst Aug 25 '16 at 8:13
  • 1
    I have taken the liberty of adding a few spaces to make the code more readable. – moewe Aug 25 '16 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.