cgnieder / acro

acronyms for LaTeX
LaTeX Project Public License v1.3c
40 stars 9 forks source link

`acro` automatically capitalizes `<id>` when using `\acroupper` #261

Closed DaftDogeee closed 10 months ago

DaftDogeee commented 10 months ago

I want to use the nested ac item with self-defined listing style in the following MWE. However, the package will automatically capitalize <id> when using \acroupper.

\documentclass{IEEEtran}

\usepackage{acro}
\NewAcroTemplate[list]{enabrvdescription}{%
    \acroheading
    \acropreamble
    \begin{description}
        \acronymsmapF{%
            \item[\textbf{\acrowrite{short}\acroifT{alt}{/\acrowrite{alt}}}]
            \acroupper\acrowrite{long}%  Notice here!
            % \acrowrite{long}%
            \acroifanyT{foreign,extra}{\acspace(}%
            \acrowrite{foreign}%
            \acroifallT{foreign,extra}{,\acspace}%
            \acrowrite{extra}%
            \acroifanyT{foreign,extra}{)}%
            \acroifpagesT{%
                \acropagefill
                (\acropages
                    {\acrotranslate{page}\nobreakspace}
                    {\acrotranslate{pages}\nobreakspace})%
            }
        }{\item\AcroRerun}
    \end{description}
    \acropostamble
}

\acsetup{%
    list/template = enabrvdescription,
    % list/uppercase/first,
}

\acsetup{%
    pages/display=all,%
    pages/seq/use=false,%
    pages/name=true,%
    pages/fill={\quad},%
    make-links=true%
    % make-links=false%
}

\DeclareAcronym{rfid}{
    short = RFID,
    long = \acs*{rf} identification}
\DeclareAcronym{rf}{
    short = RF,
    long = radio frequency}

\begin{document}

\ac{rfid}

\ac{rf}

\printacronyms

\end{document}

截屏2023-08-29 12 16 30

cgnieder commented 10 months ago

You have two options:

  1. If you never have the same ID in upper and lower case for different acronyms you cane set the option \acsetup{case-sensitive=false}.
  2. you can add the following code which makes the uppercasing function ignore \acsand its argument:
    \ExplSyntaxOn
    \tl_put_right:Nn \l_text_case_exclude_arg_tl {\acs}
    \ExplSyntaxOff
DaftDogeee commented 10 months ago

You have two options:

  1. If you never have the same ID in upper and lower case for different acronyms you cane set the option \acsetup{case-sensitive=false}.
  2. you can add the following code which makes the uppercasing function ignore \acsand its argument:
\ExplSyntaxOn
\tl_put_right:Nn \l_text_case_exclude_arg_tl {\acs}
\ExplSyntaxOff

Many thanks for your timely reply~