TeX - LaTeX Asked by user36800 on August 2, 2021
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.
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.
Answered by user36800 on August 2, 2021
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
.
Answered by Dai Bowen on August 2, 2021
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}
Answered by cgnieder on August 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP