TeX - LaTeX Asked by eDeviser on August 27, 2021
I’m using the acronym package. Normally, if I enter an acronym like this:
This is a system with ac{LTI} propertiesSystem. It can be ...
The pdf shows something like this:
This is a system with linear, time invariant (LTI) properties. It can be …
But I would like to have something like this:
This is a system with LTI (linear, time invariant) properties. It can be …
How can I set up the acronym package to put the brackets around the description and not around the acronym?
edit:
I tried now using this self defined command:
newcommand{A}[1]{acs{#1} (aclu{#1})}
It shows the acronym first and the long version in brackets. But if I use the same acronym later, the full description ist shown again and again. I would prefer, that it is shown just the first time…
In order to generally swap acronym and description one can redefine @acf
and acfa
for singular forms and @acfp
and acfpa
for plural forms. Their definitions are
newcommand*{acfa}[1]{%
texorpdfstring{protect@acf{#1}}{AC@acl{#1} (#1)}}
newcommand*{@acf}[1]{%
ifAC@footnote
acsfont{AC@acs{#1}}%
footnote{AC@placelabel{#1}AC@acl{#1}{}}%
else
acffont{%
AC@placelabel{#1}AC@acl{#1}%
nolinebreak[3] %
acfsfont{(acsfont{AC@acs{#1}})}%
}%
fi
ifAC@starredelseAC@logged{#1}fi}
and
newcommand*{acfpa}[1]{%
texorpdfstring{protect@acfp{#1}}{AC@aclp{#1} (AC@acsp{#1})}}
newcommand*{@acfp}[1]{%
ifAC@footnote
acsfont{AC@acsp{#1}}%
footnote{AC@placelabel{#1}AC@aclp{#1}{}}%
else
acffont{%
AC@placelabel{#1}AC@aclp{#1}%
nolinebreak[3] %
acfsfont{(acsfont{AC@acsp{#1}})}%
}%
fi
ifAC@starredelseAC@logged{#1}fi}
The change is rather trivial – exchange short (AC@acs{#1}
) and long (AC@acl{#1}
) forms and surround the long form with parentheses rather than the short form:
documentclass{article}
usepackage{acronym}
newacro{CSS}{Cascading Style Sheets}
newacro{CD}{Compact Disc}
makeatletter
% singular:
renewcommand*{acfa}[1]{%
texorpdfstring{protect@acf{#1}}{#1 (AC@acl{#1})}%
}
renewcommand*{@acf}[1]{%
ifAC@footnote
acsfont{AC@acs{#1}}%
footnote{AC@placelabel{#1}AC@acl{#1}{}}%
else
acffont{%
AC@placelabel{#1}%
acfsfont{acsfont{AC@acs{#1}}}%
nolinebreak[3] %
(AC@acl{#1})%
}%
fi
ifAC@starredelseAC@logged{#1}fi
}
% plural:
renewcommand*{acfpa}[1]{%
texorpdfstring{protect@acfp{#1}}{AC@acsp{#1} (AC@aclp{#1})}
}
renewcommand*{@acfp}[1]{%
ifAC@footnote
acsfont{AC@acsp{#1}}%
footnote{AC@placelabel{#1}AC@aclp{#1}{}}%
else
acffont{%
AC@placelabel{#1}%
acfsfont{acsfont{AC@acsp{#1}}}%
nolinebreak[3] %
(AC@aclp{#1})%
}%
fi
ifAC@starredelseAC@logged{#1}fi
}
makeatother
begin{document}
ac{CSS}
acp{CD}
end{document}
Correct answer by cgnieder on August 27, 2021
Update for acronym package v1.47 (2020/04/17)
makeatletter
%% singular:
renewcommand*{acfa}[2][AC@linebreakpenalty]{%
texorpdfstring{protect@acf[#1]{#2}}{#2 (AC@acl{#2})}}
renewcommand*{@acf}[2][AC@linebreakpenalty]{%
ifAC@footnote
acsfont{AC@acs{#2}}%
footnote{AC@placelabel{#2}AC@acl{#2}{}}%
else
acffont{%
AC@placelabel{#2}%
acfsfont{acsfont{AC@acs{#2}}}%
nolinebreak[#1] %
(AC@acl{#2})%
}%
fi
ifAC@starredelseAC@logged{#2}fi}
makeatother
also as own command acr
for using both (normal ac
and the reverse one):
makeatletter
newcommand*{acr}{AC@starredfalseprotect@acr}%
newcommand{@acr}[2][AC@linebreakpenalty]{%
ifAC@dua
ifAC@starredacl*{#2}elseacl{#2}fi%
else
expandafterifxcsname AC@AC@prefix#2endcsnameAC@used%
ifAC@starredacs*{#2}elseacs{#2}fi%
else
acs{#2} (aclu{#2})%
fi
fi}
makeatother
Answered by acronymos on August 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP