How to define nested call in glossaries newcommand

222 Views Asked by At

Using the glossaries package, I'v implemented a combined glossary and acronym list as described here. This works fine:

\newcommand{\agls}[4]{
    \newglossaryentry{#1}{
        text={#2},
        long={#3},
        name={\glsentrylong{#1} (\glsentrytext{#1})},
        first={\glsentryname{#1}},
        firstplural={\glsentrylong{#1}\glspluralsuffix (\glsentryname{#1}\glspluralsuffix )},
        description={#4}
    }
}

\agls{a:bim}{BIM}{Building Information Modeling}{3D Something}

I soon noticed that most of my glossary descriptions end with See \cref{sec:myLabel}. That's why I tried to modify it like this:

\newcommand{\agls}[5][]{
    \newglossaryentry{#2}{
        text={#3},
        long={#4},
        name={\glsentrylong{#2} (\glsentrytext{#2})},
        first={\glsentryname{#2}},
        firstplural={\glsentrylong{#2}\glspluralsuffix (\glsentryname{#2}\glspluralsuffix )},
        description={#5. See \cref{#1}}
    }
}

\agls[subsec:bim]{a:bim}{BIM}{Building Information Modeling}{3D Something}

(Never mind the broken reference if the optional argument is omitted, I'll fix this later with \ifthenelse)

However, this leads to errors:

Argument of \@cref@stack@top has an extra }. \glsXpageXglsnumberformat{}{17}}}
Paragraph ended before \@cref@stack@top was complete. \glsXpageXglsnumberformat{}{17}}}

I appears Latex is confused by the several closing curly brackets. I already tried moving the call to a seperate command but it didn't change anything:

\newcommand{\lref}[1][]{See \cref{#1}}
... description={#5. \lref[#1]} ...

How can I fix this?

Update: I just noticed that I could just as well use

\newcommand{\see}[1]{Siehe \cref{#1}}
\agls{a:bim}{BIM}{Building Information Modeling}{3D Something \see{subsec:bim}}

...and that probably what I'll do for the time being. An easy fix would still be appreciated if it's available.

0

There are 0 best solutions below