[Tex/LaTex] Acro package: Commas in the acronym

acronyms

I'm using the acro package, and I want to use a comma in one of the acronyms. Unfortunately TeXnicCenter throws a wobbly:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "xparse/split-excess-tokens"
! 
! Too many ',' tokens when trying to split argument.
! 
! See the LaTeX3 documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.24 ...m{pvt}{PVT}{process, voltage, temperature}

|'''''''''''''''''''''''''''''''''''''''''''''''
| LaTeX was asked to split the input 'process, voltage, temperature' at each
| occurrence of the token ',', up to a maximum of 2 parts. There were too many
| ',' tokens.
|............................................... 

My code:

\documentclass{article}
\usepackage{acro}
\acsetup{list-long-format=\capitalisewords}
\usepackage{mfirstuc}% provides \capitalisewords

\DeclareAcronym{pvt}{PVT}{process, voltage, temperature}

\begin{document}
The environmental space is known as \ac{pvt} blah blah blah
\end{document}

Clearly in its current form the only way I am going to get it to work is to remove the commas, however I'd very much like to have my cake and eat it. So how do I get it written as:

The environmental space is known as process, variation, temperature (PVT) blah blah blah…

Best Answer

version 1.*

The syntax for declaring acronyms is as follows:

\DeclareAcronym{<id>}{
  short = <short> ,
  long  = <long> ,
  <other key value pairs>
}

Here it is more or less obvious that a comma delimits the single key/value pairs and hence a value must be written in braces if it should contain one or more commas.

\DeclareAcronym{pvt}{
  short = PVT ,
  long = {process, voltage, temperature}
}

version 0.*

With version 0.* the syntax of the command was different.

An acronym was declared by

\DeclareAcronym{<id>}{<short>}{<long>}

but this is only a little part of the truth. More accurate and the explanation for your issue is this:

\DeclareAcronym{<id>}{<short>,<plural ending>}{<long>,<plural ending>}

Both the <short> and the <long> argument are split by a possible comma where after the comma one can add a different plural ending than the default s. Your entry had two commas so acro saw the following:

\DeclareAcronym{pvt}{PVT}{process, voltage, temperature}
 - id:    pvt
 - short: PVT
 - long:  process
 - long plural ending: voltage (including a leading space)

and then it choked as it didn't expect a second comma. Workaround: hide the commas or the whole long entry in an extra pair of braces.

\DeclareAcronym{pvt}{PVT}{{process, voltage, temperature}}
Related Question