% This file is public domain. See the "Examples" chapter
% in the bib2gls user manual for a more detailed description
% of this file.

\documentclass[a4paper]{article}

\usepackage[T1]{fontenc}
\usepackage{amssymb}

\usepackage[colorlinks]{hyperref}
\usepackage[record,% using bib2gls
 nostyles,% don't load default styles
 postdot,% append a dot after descriptions
 stylemods={mcols},% load glossary-mcols.sty and patch
 style=mcolalttree]{glossaries-extra}

\GlsXtrLoadResources[
   src={no-interpret-preamble},
   interpret-preamble=false
]

\GlsXtrLoadResources[
  src={interpret-preamble,bigmathsymbols,mathsobjects},
  sort-field={category},
  identical-sort-action={description},
  field-aliases={identifier=category,format=user1},
  replicate-fields={category=group},
  set-widest,
  save-locations=false
]

\renewcommand{\GlsXtrFmtDefaultOptions}{}

% requires glossaries-extra.sty v1.23+
\newcommand{\set}[2][]{\glsxtrfmt*[#1]{set}{#2}}
\newcommand{\nlset}[1]{\glsxtrentryfmt{set}{#1}}
\newcommand*{\setcontents}[2][]{\glsxtrfmt*[#1]{setcontents}{#2}}
\newcommand*{\setmembership}[2]{\glsxtrfmt*{setmembership}{{#1}{#2}}}
\newcommand*{\setcard}[2][]{\glsxtrfmt*[#1]{setcard}{#2}}
\newcommand*{\nlsetcard}[1]{\glsxtrentryfmt{setcard}{#1}}
\newcommand*{\transpose}[2][]{\glsxtrfmt*[#1]{transpose}{#2}}
\newcommand*{\nltranspose}[1]{\glsxtrentryfmt{transpose}{#1}}
\newcommand*{\inv}[2][]{\glsxtrfmt*[#1]{inverse}{#2}}
\newcommand*{\nlinv}[1]{\glsxtrentryfmt{inverse}{#1}}
\newcommand*{\Vtr}[2][]{\glsxtrfmt[#1]{vector}{#2}}
\newcommand*{\nlVtr}[1]{\glsxtrentryfmt{vector}{#1}}
\newcommand*{\Mtx}[2][]{\glsxtrfmt[#1]{matrix}{#2}}
\newcommand*{\nlMtx}[1]{\glsxtrentryfmt{matrix}{#1}}

\begin{document}
\section{Sets}
The universal set ($\gls{universalset}$) contains everything.
The empty set ($\gls{emptyset}$) contains nothing.
Some assignments:
\[
 \set{B}[_1] = \setcontents{1, 3, 5, 7},\quad
 \set{B}[_2] = \setcontents{2, 4, 6, 8},\quad
 \set{B}[_3] = \setcontents{9, 10}
\]
Define:
\[\set{A} = \gls{bigcup}[_{i=1}^3] \set{B}[_i] 
= \setcontents{1, \ldots, 10} \]
The cardinality of a set \gls{set} is denoted \gls{setcard}
and is the number of elements in the set.
\[
 \setcard{\nlset{B}_1} = 4,\quad
 \setcard{\nlset{B}_2} = 4,\quad
 \setcard{\nlset{B}_3} = 2,\quad
 \setcard{\nlset{B}_1\cup\nlset{B}_2} = 8,\quad
 \nlsetcard{\gls{emptyset}} = 0
\]

\section{Spaces}
A number space (denoted $\gls{numberspace}$) is characterised
by a set of entities with a set of axioms. For example:
\begin{align*}
\gls{naturalnumbers} 
 &= \setmembership{x}{x\text{ is positive integer}}\\
\gls{integernumbers} 
 &= \setmembership{x}{x\text{ is an integer}}\\
\gls{realnumbers} 
 &= \setmembership{x}{x\text{ is a real number}}
\end{align*}

\section{Vectors and Matrices}

A matrix (denoted \gls{matrix}) is a rectangular array of values.
A vector (denoted \gls{vector}) is a column or row of values (that
is a one-dimensional matrix).
\[
  \gls{identitymatrix}\Vtr{x} = \Vtr{x},\quad
  \Mtx{A}\inv{\nlMtx{A}} = \gls{identitymatrix},\quad
  \inv{\nlVtr{x}}\gls{1vec} = \gls{sum}[_i] x_i
\]

\printunsrtglossaries
\end{document}
