I want to unify the creation of a macro and the addition of a new entry to the glossary in a single command using the glossaries
package. A call to the command would ideally look like
\mycommand{powerset}{\operatorname{Pow}(#1)}{A}{Power set of A}
The first argument specifies the name of the new macro: \powerset
, the second is the definition of this macro. In this case, \powerset
expects one argument and produces as result \operatorname{Pow}(#1)
.
The last two arguments are related with the glossary entry. The first argument is the default parameter for the newly created macro. The name of the glossary entry should be the macro called with the default parameter - in math mode. In this case, \powerset{A}
. Finally, the last argument is the description of the glossary entry. In this example, the glossary entry should look like
\newglossaryentry{powerset}
{
name=\ensuremath{\operatorname{Pow}(A)},
description=Power set of A
}
Any ideas? Also, how hard is to extend this process to include a specified amount of parameters like
\mycommand{complement}{2}{#1 \setminus #2}{A}{B}{The complement of B in A}?
The motivation under the question is to provide the ability to define macros that will be added to the glossary after first use with the proper link to the page where they have been first used.
\powerset
for which purpose? – user31729 Aug 28 '17 at 22:59