% This file is public domain
% If you want to use arara, you need the following directives:
% arara: pdflatex: { synctex: on }
% arara: makeglossaries
% arara: pdflatex: { synctex: on }
% arara: pdflatex: { synctex: on }
%
%http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sampleNtn
\documentclass{report}

% If you want to add babel to this document, you may have to
% replace the : character in the labels if you are using a 
% language setting (e.g. french) that makes : active.

\usepackage[plainpages=false,colorlinks]{hyperref}
\usepackage[toc]{glossaries}

% Define a new glossary type called notation
\newglossary[nlg]{notation}{not}{ntn}{Notation}

\makeglossaries

% Notation definitions

\newglossaryentry{not:set}{type=notation, % glossary type
name={\ensuremath{\mathcal{S}}},
description={A \gls{gls:set}},
sort={S}}

\newglossaryentry{not:U}{type=notation,
name={\ensuremath{\mathcal{U}}},
description={The universal \gls{gls:set}},
sort=U}

\newglossaryentry{not:card}{type=notation,
name={\ensuremath{\mid\mathcal{S}\mid}},
description={The \gls{gls:card} of $\mathcal{S}$},
sort=cardinality}

\newglossaryentry{not:fact}{type=notation,
name={\ensuremath{!}},
description={factorial},
sort=factorial}

% Main glossary definitions

\newglossaryentry{gls:set}{name=set,
description={A collection of distinct objects}}

\newglossaryentry{gls:card}{name=cardinality,
description={The number of elements in the specified set}}

\begin{document}
\title{Sample Document using the glossaries Package}
\author{Nicola Talbot}
\pagenumbering{alph}
\maketitle

\begin{abstract}
%stop hyperref complaining about duplicate page identifiers:
\pagenumbering{Alph}
This is a sample document illustrating the use of the
\textsf{glossaries} package.  In this example, a new glossary type
called \texttt{notation} is defined, so that the document can have a 
separate glossary of terms and index of notation.
\end{abstract}


\pagenumbering{roman}
\tableofcontents

\printglossaries

\chapter{Introduction}
\pagenumbering{arabic}

\Glspl{gls:set} are denoted by a calligraphic font 
e.g.\ \gls{not:set}.

Let \gls[format=hyperit]{not:U} denote the universal set.

The \gls{gls:card} of a set $\mathcal{S}$ is denoted 
\gls{not:card}.

\chapter{Another Chapter}

Another mention of the universal set \gls{not:U}.

The factorial symbol: \gls{not:fact}.

\end{document}
