3

I'm trying to use the acronym environment from the acronym package to typeset a list of acronyms in my document. I want to specify a non-standard plural form for an acronym using \acroplural (which, according to the package documentation, "is meant to be used in the acronym environment"), but doing so is giving me an error message.

MWE

Document

\documentclass{article}

\usepackage{acronym,hyperref}

\begin{document}

\begin{acronym} \acro{POI}{point of interest} \acroplural{POI}{POIs}{points of interest} \end{acronym}

\end{document}

Error Messages

LaTeX Warning: Hyper reference `acro:POI' on page 1 undefined on input line 8.

LaTeX Warning: Hyper reference `acro:POI' on page 1 undefined on input line 8.

document.tex:8: Undefined control sequence. \hyper@@link ->\let \Hy@reserved@a \relax @ifnextchar [{\hyper@link@ }{\hyp... l.8 ...}{point of interest} \acroplural{POI}{POIs} {points of interest} document.tex:8: Argument of \AC@acroplurali has an extra }. <inserted text> \par l.8 ...}{point of interest} \acroplural{POI}{POIs} {points of interest} Runaway argument? {POI}{\hyper@link@ }\def \reserved@b {\hyper@link@ [link]}\futurelet \ETC. document.tex:8: Paragraph ended before \AC@acroplurali was complete. <to be read again> \par l.8 ...}{point of interest} \acroplural{POI}{POIs} {points of interest} [1] (./document.aux)

Related

How to pluralize an acronym which ends in 'S' correctly? is a similar question, but it asks about defining a non-standard plural form outside of the acronym environment.

1 Answers1

3

Omitting hyperref your code compiles but inserts a spurious points of interest, it would also lead \aclp{POI} to give POIs rather than points of interest.

This is because the second argument of \acroplural (the short-form plural) is an optional argument and if supplied should be supplied as \acroplural{POI}[POIs]{points of interest}. From the package documentation:
Page 6 of the acronym package documentation, with the square brackets around the "short plural" argument to \acroplural highlighted.
In this case it is not necessary to supply it as only the long-form plural is not given by appending an s. This issue is not specific to \acroplural or the acronym environment, it would also occur in \newacroplural and \acrodefplural which use the same syntax.

\documentclass{article}
\usepackage{acronym}

\begin{document} \begin{acronym} \acro{POI}{point of interest} \acroplural{POI}{points of interest} \end{acronym} \end{document}

However with hyperref there is a second issue if the optional argument is not supplied

\documentclass{article}
\usepackage{acronym}
\usepackage{hyperref}

\begin{document} \begin{acronym} \acro{POI}{point of interest} \acroplural{POI}{points of interest} \end{acronym} \end{document}

giving the error

! Undefined control sequence.
\hyper@@link ->\let \Hy@reserved@a 
                                   \relax \@ifnextchar [{\hyper@link@ }{\hyp...
l.8     \acroplural{POI}{points of interest}

This can be resolved as you noted in the comments by explicitly supplying the optional argument as \acroplural{POI}[POIs]{points of interest}. However the documentation of acronym seems quite clear that this should not be necessary which would make this a bug in the package.

As \acroplural{POI}{POIs}{points of interest} is parsed as giving POI and POIs as the acronym and acronym long-form plural, and then just having the group {points of interest} following it (this is not swallowed as an argument as you can see by omitting hyperref). You therefore end up seeing the more severe hyperref-related error even though the first mistake was in syntax of \acroplural.

Dai Bowen
  • 6,117
  • Thanks for pointing out that the second argument is optional, but can you please clarify your answer? I'm having a similar problem when I delete the second argument altogether, changing the line in the acronym environment to \acro{POI}{point of interest} \acroplural{POI}{points of interest}. I can get the document to compile by using \acro{POI}{point of interest} \acroplural{POI}[]{points of interest}, but then the short plural form doesn't show up at all. Do I have to do \acro{POI}{point of interest} \acroplural{POI}[POIs]{points of interest} (you said that was unnecessary)? – Ben Zelnick Jun 11 '23 at 21:21
  • 1
    \acroplural{POI}[]{points of interest} supplies an optional argument which is empty (and so the short plural is set to be nothing), \acroplural{POI}{points of interest} does not supply an optional argument and so the short plural defaults to POIs. This is how optional arguments typically work in LaTeX, \newcommand argument confusion may help further understanding. – Dai Bowen Jun 11 '23 at 21:31
  • I understand that [] is supplying a blank optional argument to the \acroplural command—sorry if I wasn't clear. My point in my previous comment was that if I omit the square brackets altogether (which, as you said, is "how optional arguments typically work in LaTeX"), then it still doesn't work. You can see this if you change the MWE to read \acro{POI}{point of interest} \acroplural{POI}{points of interest} and try to compile. – Ben Zelnick Jun 11 '23 at 22:20
  • 1
    Oop, sorry didn't read your comment carefully enough, and I must've removed hyperref in tracing the issue. If \acroplural{POI}[POIs]{points of interest} works it works, my reading of the documentation is definitely that \acroplural{POI}{points of interest} should work, so if it doesn't you should raise an issue (https://github.com/oetiker/acronym/issues). – Dai Bowen Jun 11 '23 at 23:02