4

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...

8
  • 3
    Add another pair of braces: \DeclareAcronym{pvt}{PVT}{{process, voltage, temperature}}
    – cgnieder
    Jan 30, 2013 at 11:47
  • 2
    or put braces around the commas
    – cgnieder
    Jan 30, 2013 at 11:48
  • As well as what @cgnieder says, the input seems to be wrong as \DeclareAcronym only takes two arguments (according to the v1.0 documentation).
    – Joseph Wright
    Jan 30, 2013 at 11:49
  • 1
    @E_L I will but that'll have to wait a few hours until I'm home again
    – cgnieder
    Jan 30, 2013 at 12:52
  • 1
    @E_L It seems that you're using a version 0.x of the package. Consider upgrading, as version 1.0 is surely more powerful.
    – egreg
    Jan 30, 2013 at 12:53

1 Answer 1

4

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}}
2
  • I had the same trouble, but I simply enclosed in brackets the commas and it works \m/. So, in the acronym declaration I use (in the traditional way) in the long field: long = process{,} voltage{,} temperature, but I see the result is the same if I enclose all the field after the = symbol.
    – Aradnix
    Aug 6, 2015 at 0:59
  • 1
    @Aradnix the difference is that the braces in your example will stay around the commas while a pair of braces around the whole value will be removed when the value is saved.
    – cgnieder
    Aug 6, 2015 at 6:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .