cgnieder / acro

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

use acro in titles in camel case #214

Closed tautomer closed 2 years ago

tautomer commented 3 years ago

Thanks for this excellent package!

I'm having trouble to capitalize the first letter of all words, since I'm gonna use one acronym in the title. I tried many commands from the mfirstuc package, but none works as expected. Usually the file won't even be compiled. Here is M(N)WE.

\documentclass{article}
\usepackage{acro}
\usepackage{mfirstuc}
\DeclareAcronym{CD}{
    short = CD,
    long = compact disc 
}

\begin{document}
    \ecapitalisefmtwords{\acf{CD}}
\end{document}

I pasted the full log over here.

Currently my workaround is to type the long name in camel case myself, and then append a \acs{}, but I wonder if there is a better way doing this.

Of course, I can also define a camel case long name version of this acronym and only use \acl*{} for the camel part, so that it won't show up in the first list.

cgnieder commented 2 years ago

You can set the uppercasing command for acro:

\documentclass{article}
\usepackage{acro}
\usepackage{mfirstuc}
\DeclareAcronym{CD}{
    short = CD,
    long = compact disc 
}

\begin{document}

\Acf{CD}

\Acf[uppercase/cmd=\ecapitalisefmtwords]{CD}

\Acf{CD}

\acsetup{uppercase/cmd=\ecapitalisefmtwords}

\Acf{CD}

\end{document}

grafik