Add plural to newdualentry from LaTeX/Glossary
This works for me (However, a 7-arg command is difficult to remember!):
\documentclass{article}
\usepackage{xparse}
\usepackage[acronym]{glossaries}
\DeclareDocumentCommand{\newdualentry}{O{}D<>{}m m m m m } {
\newglossaryentry{gls-#3}{
name={#5},
text={#5\glsadd{gls-#3}},
description={#6},
plural={#7},
#1
}
\newacronym[see={[Glossary:]{gls-#3}},#2]{#3}{#4}{#5\glsadd{gls-#3}}
}
\makeglossaries
\newdualentry{LED}{LED}{LED}{Light emitting diode}{LEDiodes}
\newdualentry{Ox}{Ox}{Ox}{male cow}{Oxen}
\begin{document}
Here is an entry: \gls{gls-LED} \glspl{gls-LED}
An some biology here: \gls{gls-Ox} \glspl{gls-Ox}
\printglossary[type=main]
\printglossary[type=acronym]
\end{document}
Edit Some notes on the design of the command about the optional arguments:
Say,you've got a small document like this
\documentclass{article}
\usepackage{xparse}
\DeclareDocumentCommand{\somecmd}{O{}O{}m}{%
Optional 1: #1
Optional 2: #2
mandatory: #3
}
\begin{document}
\somecmd[A][B]{C}
\somecmd[A]{C}
\somecmd[][B]{C}
\end{document}
- The first call will assign A, B and C correctly to the relevant slots
- The second call will use A for the 1st, C for the 3rd one --> the 2nd one is empty --> Is this correct? Yes and no, since it's not clear that A is meant for the 1st or the 2nd optional argument.
- This call will explicitly leave the 1st one empty, the others are 'correct'
It's better to replace the 2nd optional argument style with D<>{}
or similar tokens to make some difference. Or append the 2nd optional argument to the end of the list, being the 3rd argument here.