How to create glossary entries for custom notation with arguments?

I'm using the latex glossaries package, and trying to make it do something which it doesn't seem to want to do. Maybe I'm doing it all wrong???

In my thesis I'm defining lots of math notation which I'm using throughout the paper. I'd like the glossary at the end of my paper to list all the notation I've defined, with definition and page and section reference to where it is defined in the paper. If I create a glossary entry, then I have to do so before the \begin{document} and use \gls at the definition site. However the \gls, which is intended for words, doesn't work so with with notation such as the following example.

\newcommand{\powerset}[1]{\mathbb{P}(#1)}


In the document I have a

\begin{definition}
...
\end{definition}


or

\begin{notation}
...
\end{notation}


Where I define this notation in terms of how it is used.

\begin{notation}
By $\powerset{U}$ we denote the power set of $U$, \ie the set of subsets of
$U$.  Consequently we may take $V\subseteq \powerset{U}$ to mean that $V$ is a set
of subsets, each begin a subset of $U$.
\end{notation}


How should I be doing this to be glossary compatible? What should the content (and name) of the newglossaryentry be? And how should I use \gls at the usage site? Or should I be using glossaries at all?

It seems what I'd really like to have is sort of a \footnote{...} capability, which rather than putting its content at the bottom of the page, instead puts its content into the glossary, and includes the page and section number. That way the text of the glossary entry would be right next to the definition in the body of the document and I could more easily keep them sync if one needs to change.

• The nomencl package is also a way of making a glossary, but in the \footnote{} style that you want. I'm not sure if it will work with references like you want, but it's worth checking out. Here's a tutorial and example of how to use the package – Flexo013 Jul 12 '18 at 10:07
• This nomencl package looks interesting. I'll check it out. It looks like with it I can also define my own definition and notation macros which both create a \begin{notation}...\end{notation} in the document as well as a nomenclature entry including referencing. Thanks. – Jim Newton Jul 12 '18 at 10:11
• The glossaries package is not just designed for words. It can be used with symbols as well. If you're interested in a function style of glossary entry, then try Method 4 in this answer – Nicola Talbot Jul 12 '18 at 10:18
• Is there some unix program that I need to run to use nomencl similar to the makeglossaries program associated with the glossaries package? It does not seem to me mentioned in the tutorial: sharelatex.com/learn/Nomenclatures – Jim Newton Jul 12 '18 at 11:34
• But when I compile the document, I get a message: Writing nomenclature file thesis.nlo And later the message: No file thesis.nls. This seems to indicate there is a similar flow to how glossaries work. – Jim Newton Jul 12 '18 at 11:40

If you always want the symbol displayed as \powerset{U} then you can use:

\documentclass{article}

\usepackage{amsfonts}
\usepackage{glossaries-extra}

\newcommand{\powerset}[1]{\mathbb{P}(#1)}

\newglossaryentry{powset}% label
{
name={\ensuremath{\powerset{U}}},% default display
description={power set},% description
category=symbol% category label
}

\begin{document}
By $\gls{powset}$ we denote the power set of $U$, i.e.\ the set of subsets of
$U$.  Consequently we may take $V\subseteq \gls{powset}$ to mean that $V$ is a set
of subsets, each begin a subset of $U$.

\printunsrtglossary[title={Symbols}]
\end{document}


This produces:

If you want hyperlinks then just include hyperref before glossaries (or glossaries-extra in this case).

\documentclass{article}

\usepackage{amsfonts}
\usepackage{hyperref}
\usepackage{glossaries-extra}

\newcommand{\powerset}[1]{\mathbb{P}(#1)}

\newglossaryentry{powset}% label
{
name={\ensuremath{\powerset{U}}},% default display
description={power set},% description
category=symbol% category label
}

\begin{document}
By $\gls{powset}$ we denote the power set of $U$, i.e.\ the set of subsets of
$U$.  Consequently we may take $V\subseteq \gls{powset}$ to mean that $V$ is a set
of subsets, each begin a subset of $U$.

\printunsrtglossary[title={Symbols}]
\end{document}


This method doesn't include a location (page or section). You need an external tool for that. See How to effectively use List of Symbols for a thesis? (and remove the nonumberlist option).

If you're interested in an entry that may take an argument (to replace U with some other symbol) then see Symbols with optional parameter in glossaries with \newglossary.

• I don't think the OP asked for footnotes, but used \footnote just by way of example. Footnoting mathematical symbols should be avoided, because the marker will be surely mistaken for an exponent. – egreg Jul 12 '18 at 11:03
• And in the case that you do want to use footnotes with mathematical symbols then use different markers like † and ‡, which can be done by \renewcommand{\thefootnote}{\fnsymbol{footnote}} – Flexo013 Jul 12 '18 at 11:29
• Sorry I misread the question (trying to do to many things at the same time!) – Nicola Talbot Jul 12 '18 at 12:18