3

Is there a convenient switch to make acro always use the long form for selected acronyms? I would like to be able to toggle that. Otherwise, I have to search and replace acro commands with (say) \acl, \aclp, etc. (and I'd lose track of where all my \acs's were).

AFTERNOTE: My current approach is to define the short form to be the same as the long form, then list the acronym under \acuse so that the first occurrence isn't treated specially. The fatal drawback is that the acronym still shows up in the list of acronyms at the end of the document.

4
  • So, if I understand correctly, you want to tell your readers, that a specific term (ST) has an acronym (AN), but then, instead of using that AN, always write out the long form of that specific term. Is that right?
    – thymaro
    Jan 23, 2018 at 6:03
  • If you're happy to change package this can be done quite easily with glossaries. (The shortcut package option provides the synonyms \ac, \acp, \acs, \acl etc that are shared by acro, acronym and glossaries for much the same purposes.) Jan 23, 2018 at 9:08
  • @thymaro: Temporarily, I don't want any indication that a short form is used at all.
    – user36800
    Jan 24, 2018 at 20:26
  • @Nicola: I moved to acro package years ago, for various reasons that I don't recall, so I'd prefer to stick with it.
    – user36800
    Jan 24, 2018 at 20:26

3 Answers 3

2

All acronyms can be set to give their long form by setting \acro_use:n which check the acronyms used status and then picks long/short/first form accordingly to instead always fetch the long form with \acro_long:n

\cs_set_eq:NN \acro_use:n \acro_long:n

This won't affect calls for the short or alt forms, they will still appear as the short/alt forms as internally they use \acro_short:n and \acro_alt:n but these can also be set to call the \acro_long:n form if so desired.

\ExplSyntaxOn
\cs_set_eq:NN \acro_use:n \acro_long:n
\cs_set_eq:NN \acro_short:n \acro_long:n
\cs_set_eq:NN \acro_alt:n \acro_long:n
\ExplSyntaxOff

should essentially turn off all \ac-type macros and make them expand to the long form only.

If looking to only disable it for a set of acronyms, say those identified with class = maybelongonly then one can modify the \acro_use:n to insert a check of the acronyms class and accordingly print it as normal (for acro) or print the long form only. To check the class \acro_get_property:nn is used, which was introduced in v2.7

\documentclass{article}
\usepackage{acro}

\DeclareAcronym{ecm}{
  short = ECM ,
  long  = Electro Chemical Machining,
  class = maybelongonly,
}
\DeclareAcronym{adc}{
  short = ADC ,
  long  = Analog-to-Digital-Converter
}

\ExplSyntaxOn
\tl_new:N \l__acro_longonly_tl
\tl_set:Nn \l__acro_longonly_tl { maybelongonly }

\cs_set_eq:NN \acro_useold:n \acro_use:n
\cs_set:Npn \acro_use:n #1 {
    \acro_get_property:nn { #1 } { class }
    \tl_if_eq:NNTF \l__acro_class_tl \l__acro_longonly_tl {
        \acro_long:n { #1 }
    }{
        \acro_useold:n { #1 }
    }
}
\ExplSyntaxOff

\begin{document}
\ac{ecm}

\ac{ecm}

\acp{adc}

\Ac{ecm}

\acp{ecm}

\Iac{adc}
\end{document}

this will ensure \acp{<key>} prints always printsthe long version with the appropriate plural for acronyms in the appropriate class. In order to catch any explicit calls for the short or alt versions (\acs, \aca etc.) then \acro_short:n and \acro_alt:n should be modified similarly to \acro_use:n.

These acronyms can be removed from the list by giving \printacronyms the key exclude-classes=maybelongonly.

4
  • Thanks, Dai. I may give this a spin in any future need to temporarily undefine acronyms. It's seems to be a bit more work than my (admittedly inelegant) solution.
    – user36800
    Jan 24, 2018 at 20:30
  • @user36800 it depends, for this answer all you need to do is add some code which creates a switch to ignore the acronym according to a property and then set the class of any acronyms to be ignored to be whatever that switch is looking for (the value given in \tl_set:Nn \l__acro_longonly_tl { <class> }). I think it's less effort than having to modify the short key as well and much easier to disable (change \l__acro_longonly_tl to a different string and suddenly the switch will never fire).
    – Dai Bowen
    Jan 24, 2018 at 22:08
  • If you're familiar with the extra code, I can see why it would be preferrable.
    – user36800
    Jan 25, 2018 at 23:13
  • 1
    This is a great solution. If you don't want to use classes, you could also define a new property with \acro_declare_simple_property:n { disabled } and use it to trigger this behaviour \acro_get_property:nnTF { #1 } { disabled } { \acro_long:n { #1 } } { \acro_useold:n { #1 } }. Now just add the disabled property to your acronym declaration, and you're good to go!
    – Peter
    Sep 10, 2018 at 13:56
2

Starting with v3.4 (and in analogy to the option and the property first-style) acro has the option subsequent-style which sets the style for all appearances after the first for all acronyms, to be set with \acsetup{} and initially set to short. It also has the property with the same name which sets the same for an individual acronym (and which of course takes precedence over the option):

\documentclass{article}
\usepackage{acro}[2020/12/25]% v3.4 or newer

\DeclareAcronym{aa}{
  short = a ,
  long = the letter a
}

\DeclareAcronym{bb}{
  short = b ,
  long = the letter b ,
  subsequent-style = long
}

\begin{document}

First: \texttt{aa}: \ac{aa}, \texttt{bb}:  \ac{bb} \par
Next: \texttt{aa}: \ac{aa}, \texttt{bb}:  \ac{bb}

\end{document}

enter image description here

2
  • Thanks, cgnieder. My package management is from Cygwin, and my latest update was approximately 1.5 months ago, plus/minus 0.5 months. Its version is Package: acro 2020/03/07 v2.11d. I will try your solution in my next report.
    – user36800
    Dec 29, 2020 at 1:47
  • +1. I think the OP's exact use case would set both first-style=long and subsequent-style=long
    – Dai Bowen
    Mar 3 at 1:02
0

The solution is to use my AFTERNOTE above together with the exclude-classes option to the printacronyms command. I have to include the field class = dummy in the acronym definition (any name for the class will do, it doesn't need to be dummy).

It's not elegant, but it works. Better solutions are welcome.

You must log in to answer this question.

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