2

I would like to have a command which capitalizes every word when I use an \acl command of the acro-package.

\DeclareAcronym{t}{short={t},long={this is a test}}
\capitalizingcommand{\acl{t}}

My desired output would be:

This Is A Test

as far as i know the acro-package only supports the capitalization of the first word via \Acl{t}.

So far I tried the \ecapitalisewords command from the mfirstuc-package, but the expansion seems not to work and latex tries to capitalise the shortcut which results in an error.

This is my working or rather not working example.

\documentclass{article}
\usepackage{mfirstuc}
\usepackage{acro}

\DeclareAcronym{t}{short={t},long={this is a test}}
\begin{document}

\acl{t}
%\ecapitalisewords{\acl{t}}

\end{document}

Thanks a lot in advance

1

You can't do this directly. However, you can define a macro which sets long-format to \capitalisewords in a group:

\documentclass{article}
\usepackage{mfirstuc}
\usepackage{acro}

\DeclareAcronym{t}{short={t},long={this is a test}}

\newcommand*\accapitalizelong[1]{%
  \begingroup
    \acsetup{long-format=\capitalisewords}%
    #1%
  \endgroup  
}

\begin{document}

\acl{t}

\accapitalizelong{\acl{t}}

\acl{t}

\end{document}

enter image description here

If you instead want to generally change the uppercasing behaviour of all the \Ac... macros you can set the option uc-cmd:

\documentclass{article}
\usepackage{mfirstuc}
\usepackage{acro}

\DeclareAcronym{t}{short={t},long={this is a test}}

\acsetup{uc-cmd=\capitalisewords}

\begin{document}

\acl{t}

\Acl{t}

\end{document}

Of course you can also define a similar command like in my first suggestion to locally change uppercasing. Or even define a \ACL:

\documentclass{article}
\usepackage{mfirstuc}
\usepackage{acro}

\DeclareAcronym{t}{short={t},long={this is a test}}

\NewDocumentCommand\ACL{sm}{%
  \begingroup
    \acsetup{uc-cmd=\capitalisewords}%
    \IfBooleanTF{#1}{\Acl*{#2}}{\Acl{#2}}%
  \endgroup
}


\begin{document}

\acl{t}

\Acl{t}

\ACL{t}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.