 % This file is public domain
 %
 % To ensure that the page numbers are up-to-date:
 %
 % latex sampleEqPg
 % makeglossaries sampleEqPg
 % latex sampleEqPg
 % makeglossaries sampleEqPg
 % latex sampleEqPg
 %
 % The extra makeglossaries run is required because adding the
 % glossary in the second LaTeX run shifts the page numbers on
 % which means that the glossary needs to be updated again.
 % (Note that this problem is avoided if the page numbering is
 % reset after the glossary. For example, if the glossary has
 % roman numbering and the subsequent pages have arabic numbering)
 %
 % If you want to use arara, you need the following directives:
 % arara: pdflatex: { synctex: on }
 % arara: makeglossaries
 % arara: pdflatex: { synctex: on }
 % arara: makeglossaries
 % arara: pdflatex: { synctex: on }
\documentclass[a4paper,12pt]{report}

\usepackage{amsmath}
\usepackage[colorlinks]{hyperref}
\usepackage[style=long3colheader,toc,
            counter=equation]{glossaries}

\newcommand{\erf}{\operatorname{erf}}
\newcommand{\erfc}{\operatorname{erfc}}

 % redefine the way hyperref creates the target for equations
 % so that the glossary links to equation numbers work

\renewcommand*\theHequation{\thechapter.\arabic{equation}}

\renewcommand{\glossaryname}{Index of Special Functions and Notations}

\renewcommand{\glossarypreamble}{Numbers in italic indicate the equation number,
numbers in bold indicate page numbers where the main definition occurs.\par}

 % set the glossary number style to italic
 % hyperit is used instead of textit because
 % the hyperref package is being used.
\renewcommand{\glsnumberformat}[1]{\hyperit{#1}}

 % 1st column heading
\renewcommand{\entryname}{Notation}

 % 2nd column heading
\renewcommand{\descriptionname}{Function Name}

 % 3rd column heading
\renewcommand{\pagelistname}{}

 % Redefine header row so that it
 % adds a blank row after the title row
\renewcommand{\glossaryheader}{\bfseries\entryname &
\bfseries\descriptionname&\bfseries\pagelistname\\
& & \\\endhead}

 % Define glossary entries

\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)},
description=Gamma function,sort=Gamma}

\newglossaryentry{gamma}{name=\ensuremath{\gamma(\alpha,x)},
description=Incomplete gamma function,sort=gamma}

\newglossaryentry{iGamma}{name=\ensuremath{\Gamma(\alpha,x)},
description=Incomplete gamma function,sort=Gamma}

\newglossaryentry{psi}{name=\ensuremath{\psi(x)},
description=Psi function,sort=psi}

\newglossaryentry{erf}{name=\ensuremath{\erf(x)},
description=Error function,sort=erf}

\newglossaryentry{erfc}{name=\ensuremath{\erfc(x)},
description=Complementary error function,sort=erfc}

\newglossaryentry{beta}{name=\ensuremath{B(x,y)},
description=Beta function,sort=B}

\newglossaryentry{Bx}{name=\ensuremath{B_x(p,q)},
description=Incomplete beta function,sort=Bx}

\newglossaryentry{Tn}{name=\ensuremath{T_n(x)},
description=Chebyshev's polynomials of the first kind,
sort=Tn}

\newglossaryentry{Un}{name=\ensuremath{U_n(x)},
description=Chebyshev's polynomials of the second kind,
sort=Un}

\newglossaryentry{Hn}{name=\ensuremath{H_n(x)},
description=Hermite polynomials,sort=Hn}

\newglossaryentry{Lna}{name=\ensuremath{L_n^\alpha(x)},
description=Laguerre polynomials,sort=Lna}

\newglossaryentry{Znu}{name=\ensuremath{Z_\nu(z)},
description=Bessel functions,sort=Z}

\newglossaryentry{Pagz}{name=\ensuremath{\Phi(\alpha,\gamma;z)},
description=confluent hypergeometric function,sort=Pagz}

\newglossaryentry{kv}{name=\ensuremath{k_\nu(x)},
description=Bateman's function,sort=kv}

\newglossaryentry{Dp}{name=\ensuremath{D_p(z)},
description=Parabolic cylinder functions,sort=Dp}

\newglossaryentry{Fpk}{name=\ensuremath{F(\phi,k)},
description=Elliptical integral of the first kind,sort=Fpk}

\newglossaryentry{C}{name=\ensuremath{C},
description=Euler's constant,sort=C}

\newglossaryentry{G}{name=\ensuremath{G},
description=Catalan's constant,sort=G}

\makeglossaries

\pagestyle{headings}

\begin{document}

\title{Sample Document Using Interchangable Numbering}
\author{Nicola Talbot}
\maketitle

\begin{abstract}
This is a sample document illustrating the use of the \textsf{glossaries}
package.  The functions here have been taken from ``Tables of
Integrals, Series, and Products'' by I.S.~Gradshteyn and I.M~Ryzhik.

The glossary lists both page numbers and equation numbers.
Since the majority of the entries use the equation number,
\texttt{counter=equation} was used as a package option.
Note that this example will only work where the
page number and equation number compositor is the same. So
it won't work if, say, the page numbers are of the form
2-4 and the equation numbers are of the form 4.6.
As most of the glossary entries should have an italic
format, it is easiest to set the default format to
italic.

\end{abstract}

\tableofcontents

\printglossary[toctitle={Special Functions}]

\chapter{Gamma Functions}

The \glslink[format=hyperbf,counter=page]{Gamma}{gamma function} is
defined as
\begin{equation}
\gls{Gamma} = \int_{0}^{\infty}e^{-t}t^{z-1}\,dt
\end{equation}

\begin{equation}
\glslink{Gamma}{\ensuremath{\Gamma(x+1)}} = x\Gamma(x)
\end{equation}

\begin{equation}
\gls{gamma} = \int_0^x e^{-t}t^{\alpha-1}\,dt
\end{equation}

\begin{equation}
\gls{iGamma} = \int_x^\infty e^{-t}t^{\alpha-1}\,dt
\end{equation}

\newpage

\begin{equation}
\glslink{Gamma}{\ensuremath{\Gamma(\alpha)}} =
\Gamma(\alpha, x) + \gamma(\alpha, x)
\end{equation}

\begin{equation}
\gls{psi} = \frac{d}{dx}\ln\Gamma(x)
\end{equation}

\chapter{Error Functions}

The \glslink[format=hyperbf,counter=page]{erf}{error function} is defined as:
\begin{equation}
\gls{erf} = \frac{2}{\surd\pi}\int_0^x e^{-t^2}\,dt
\end{equation}

\begin{equation}
\gls{erfc} = 1 - \erf(x)
\end{equation}

\chapter{Beta Function}

\begin{equation}
\gls{beta} = 2\int_0^1 t^{x-1}(1-t^2)^{y-1}\,dt
\end{equation}
Alternatively:
\begin{equation}
\gls{beta} = 2\int_0^{\frac\pi2}\sin^{2x-1}\phi\cos^{2y-1}\phi\,d\phi
\end{equation}

\begin{equation}
\gls{beta} = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)} = B(y,x)
\end{equation}

\begin{equation}
\gls{Bx} = \int_0^x t^{p-1}(1-t)^{q-1}\,dt
\end{equation}

\chapter{Chebyshev's polynomials}

\begin{equation}
\gls{Tn} = \cos(n\arccos x)
\end{equation}

\begin{equation}
\gls{Un} = \frac{\sin[(n+1)\arccos x]}{\sin[\arccos x]}
\end{equation}

\chapter{Hermite polynomials}

\begin{equation}
\gls{Hn} = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2})
\end{equation}

\chapter{Laguerre polynomials}

\begin{equation}
\gls{Lna} = \frac{1}{n!}e^x x^{-\alpha}
\frac{d^n}{dx^n}(e^{-x}x^{n+\alpha})
\end{equation}

\chapter{Bessel Functions}

Bessel functions $Z_\nu(z)$ are solutions of
\begin{equation}
\frac{d^2\glslink{Znu}{Z_\nu}}{dz^2} + \frac{1}{z}\,\frac{dZ_\nu}{dz} +
\left(
1-\frac{\nu^2}{z^2}Z_\nu = 0
\right)
\end{equation}

\chapter{Confluent hypergeometric function}

\begin{equation}
\gls{Pagz} = 1 + \frac{\alpha}{\gamma}\,\frac{z}{1!}
+ \frac{\alpha(\alpha+1)}{\gamma(\gamma+1)}\,\frac{z^2}{2!}
+\frac{\alpha(\alpha+1)(\alpha+2)}
      {\gamma(\gamma+1)(\gamma+2)}
\,\frac{z^3}{3!}
+ \cdots
\end{equation}

\begin{equation}
\gls{kv} = \frac{2}{\pi}\int_0^{\pi/2}
\cos(x \tan\theta - \nu\theta)\,d\theta
\end{equation}

\chapter{Parabolic cylinder functions}

\begin{equation}
\gls{Dp} = 2^{\frac{p}{2}}e^{-\frac{z^2}{4}}
\left\{
\frac{\surd\pi}{\Gamma\left(\frac{1-p}{2}\right)}
\Phi\left(-\frac{p}{2},\frac{1}{2};\frac{z^2}{2}\right)
-\frac{\sqrt{2\pi}z}{\Gamma\left(-\frac{p}{2}\right)}
\Phi\left(\frac{1-p}{2},\frac{3}{2};\frac{z^2}{2}\right)
\right\}
\end{equation}

\chapter{Elliptical Integral of the First Kind}

\begin{equation}
\gls{Fpk} = \int_0^\phi
\frac{d\alpha}{\sqrt{1-k^2\sin^2\alpha}}
\end{equation}

\chapter{Constants}

\begin{equation}
\gls{C} = 0.577\,215\,664\,901\ldots
\end{equation}

\begin{equation}
\gls{G} = 0.915\,965\,594\ldots
\end{equation}

\end{document}
