[Tex/LaTex] Defining plural form for glossaries entries

glossaries

Based on the following answer, How shall I define plural form of glossaries?

Two separate acronym list using package glossaries

For example,

\newglossaryentry{LED}
{
  name={LED},
  description={light emitting diode},
  first={\glsentrydesc{LED} (\glsentrytext{LED})},
}

The first instance in plural form should print

light emitting diodes (LEDs).

Second instance of plural form should print

LEDs

3rd instance of singular form should print

LED

and so on …

.

Best Answer

The only way I know is to define the \newglossaryentry as:

\newglossaryentry{LED}
{
  name={LED},
  description={light emitting diode},
  first={\glsentrydesc{LED} (\glsentrytext{LED})},
  plural={LEDs},
  firstplural={\glsentrydesc{LED}s (\glsentryplural{LED})}
}

and then use \glspl{LED} when you want the plural form, \gls{LED} when you want the singular form.

EDIT

I've discovered the command \glsentrydescplural, which prints the contents of the descriptionplural field.

So the above can also be rewritten in a more consistent form as:

\newglossaryentry{LED}
{
  name={LED},
  description={light emitting diode},
  first={\glsentrydesc{LED} (\glsentrytext{LED})},
  plural={LEDs},
  descriptionplural={light emitting diodes},
  firstplural={\glsentrydescplural{LED} (\glsentryplural{LED})}
}