single option breaks cite if the acronym is only used once

Issue #70 resolved
Daniel Bosk
created an issue

When the single option is used and an acronym is only used once, then the citation doesn't happen. However, if the acronym is used more than once (or single is not used) then the citation appears as expected. I expect the citation to always appear on the first use, even if I use it only once.

I suspect that the printing of the citation is connected to the printing of the acronym, and when the acronym doesn't happen the citation doesn't happen either.

Minimal working example:

\documentclass{article}

\usepackage[single]{acro}
\DeclareAcronym{TAG}{%
    short = {TAG},
    long = {the awesome group},
    cite = {TAG},
}

\usepackage[backend=bibtexu]{biblatex}
\addbibresource{\jobname.bib}

\begin{filecontents}{\jobname.bib}
@online{TAG,
    author = {The Awesome Group},
    title = {About us},
    URL = {https://foo.bar/}
}
\end{filecontents}

\begin{document}
    Testing \ac{TAG} \dots

    \printbibliography{}
\end{document}

It's tested against the master branch.

Comments (6)

  1. Clemens Niederberger repo owner

    Maybe it isn't clear enough from the manual: a single appearance is not the same as the first appearance. Since the default setting is cite = first a single appearance gets no citation. The citation is there with cite = all.

    \documentclass{article}
    
    \usepackage{acro}
    \acsetup{
      single ,
      cite = all
    }
    
    \DeclareAcronym{TAG}{
      short = {TAG},
      long = {the awesome group},
      cite = {knuth:ct}
    }
    
    \usepackage{biblatex}
    \addbibresource{biblatex-examples.bib}
    
    \begin{document}
    
    Testing \ac{TAG}
    
    \printbibliography
    
    \end{document}
    

    If you don't want to switch to cite = all you can redefine \acro_single:n:

    \documentclass{article}
    
    \usepackage{acro}
    \acsetup{
      single ,
      cite = first
    }
    
    \DeclareAcronym{TAG}{
      short = {TAG},
      long = {the awesome group},
      cite = {knuth:ct}
    }
    
    \usepackage{biblatex}
    \addbibresource{biblatex-examples.bib}
    
    \ExplSyntaxOn
    \cs_set_protected:Npn \acro_single:n #1
      {
        \acro_cite: % <<<< this is added
        \acro_single_form:nV {#1} \l__acro_single_form_tl
        \acro_after:n {#1}
      }
    \ExplSyntaxOff
    
    \begin{document}
    
    Testing \ac{TAG}
    
    \printbibliography
    
    \end{document}
    

    One might argue, though, that a single appearance should be the same as a first appearance with respect to citations. I might change the behaviour…

  2. Log in to comment