# multiline equation inside \newglossaryentry

I want a multiline equation (preferably even centered w.r.t. the appropriate column, since single line equations I already have using [ and ] or  aren't centered) in part of the description of \newglossaryentry.

So basically I want, centered in the column of the glossary, single-line and multi-line equations.

Thanks!

P.S. I thought I could get something from this: enter link description here but I couldnt'...

\documentclass[twoside]{amsbook}

\usepackage[xindy,counter=section,sanitize={name=false},style=index]{glossaries} %[toc]% %\glstoctrue
\usepackage{nomencl}
\makeglossaries %has to be after \usepackage{hyperref}
%
\glossarystyle{long3col}
%\glossarystyle{super3col}

\setlength{\glsdescwidth}{0.6\textwidth}
\setlength{\glspagelistwidth}{0.15\textwidth}
\newglossaryentry{AffineVariety}
{
name=Affine Variety,
description={Affine varieties are defined to be anything that looks like the set of common zeros of a collection of polynomials. E.g., $A = \mathbb{C}[X]$ is the ring of polynomials in $X$ with complex coefficients. Let $f=X-1 \in A$ and its set of zeros, $Z(\{f\})=\{1\}$ is an example of an affine variety.}
}
\newglossaryentry{RemovableSingularity}
{
name=Removable Singularity,
description={Formally, if $U \subset \mathbb{C}$ is an open subset of the complex plane $\mathbb{C}$, and $a \in U$, and $f: U\backslash\{a\} \to \mathbb{C}$ a holmorphic function, then $a$ is a removable singularity for $f$ if there exists a holomorphic function $g: U \to \mathbb{C}$, coinciding with $f$ on $U\backslash\{a\}$. It is said that $f$ is holomorphically extended over $U$ if such a $g$ exists.  A simple example is the function $$f(z) = \frac{\sin(z)}{z}$$ at $z=0$ (even this: $f(z) = \frac{\sin(z)}{z}$ doesn't center.). The singularity, due to the indeterminate form, can be removed by defining $f(0)=1$, which is the limit of $f$ as $z$ approaches zero.}
}
\newglossaryentry{TetrahedralCoordinates}
{
name=Tetrahedral Coordinates,
description={Coordinates useful in plotting projective three-dimensional curves of the form $f(x_0,x_1,x_2,x_3)=0$, which are defined by
%               \begin{minipage}[t][5cm][b]{0,5\textwidth}
%               \ensuremath{
%               $${\setlength\arraycolsep{0.2em} \begin{eqnarray} x_0 = 1-z-\sqrt{2}\,x \\ x_1 = 1 - z + \sqrt{2}\,x \\ x_2 = 1+ z+ \sqrt{2}\,y \\ x_3 = 1 + z - \sqrt{2}\,y \end{eqnarray} }$$
%               \end{minipage}
%               }
}
}

\makeglossaries

\begin{document}

Consider the equation
\begin{equation}
e = m * c^2
\end{equation}
in which \gls{AffineVariety} is here, but not here \gls{TetrahedralCoordinates} oh and this \gls{RemovableSingularity}.

\printglossary

\end{document}

• The problem has to do with the use of the $...$ in a longtable environment. It is not really to do with glossaries. If you use a style which doesn't depend on that kind of environment, they centre fine. – cfr Mar 19 '14 at 1:12
• Well I tried it with glossarystyle super3col' and I have the same result. Are you suggesting I need to pick a different glossary style? Or two columns only? – nate Mar 19 '14 at 1:16
• Well if you used e.g. the default style, they centre fine. Anything based on a longtable/supertabular etc. environment causes the issue. You can reproduce it in a longtable outside of the glossary, as well. Which is why I said it doesn't really have anything to do with glossaries. – cfr Mar 19 '14 at 1:18
• I see - I tried what you say and see that. Because I'll have many linkbacks to text from the glossary I kind of like the 3 column approach though... Any ideas? – nate Mar 19 '14 at 1:20
• You can put it in a minipage. You could define a new column type using the array package based on this and then define a new glossary style using that. – cfr Mar 19 '14 at 1:33

Wrapping the contents in a minipage environment enables displayed maths to be centred in the longtable environment. But doing that every time would be tedious, inflexible and prone to error.

A better option is to use the \newcolumntype command of the array package to set up a new column type for tabular environments which we can then use to define a new glossary style, my3col. This style will be based on long3col but with a changed column type for the description.

I've loaded glossaries earlier so that \glsdescwidth is available when the new column type is defined. This in turn is defined before setting up the new glossary style which will make use of it. Finally, the new style is activated.

# The code

\documentclass[twoside]{amsbook}

\usepackage[xindy,counter=section,sanitize={name=false},style=index]{glossaries} %[toc]% %\glstoctrue
\usepackage{nomencl}
\setlength{\glsdescwidth}{0.6\textwidth}
\setlength{\glspagelistwidth}{0.15\textwidth}
\usepackage{array}
\newcolumntype{G}{% This is defining a new column type for tabulars which we will use to define the longtable environment in the new glossary style
>{\begin{minipage}[t]{\glsdescwidth}}{c}<{\end{minipage}}%
}
\newglossarystyle{my3col}{% call that style my3col
\setglossarystyle{long3col}% base it on long3col so we don't need to define the everything from scratch
\renewenvironment{theglossary}% here's the bit we want to alter
{\begin{longtable}{lGp{\glspagelistwidth}}}% just change the central column to our new column type, G
{\end{longtable}}}

\glossarystyle{my3col}% we want to use the new style!
\makeglossaries %has to be after \usepackage{hyperref}

\newglossaryentry{AffineVariety}
{
name=Affine Variety,
description={Affine varieties are defined to be anything that looks like the set of common zeros of a collection of polynomials. E.g., $A = \mathbb{C}[X]$ is the ring of polynomials in $X$ with complex coefficients. Let $f=X-1 \in A$ and its set of zeros, $Z(\{f\})=\{1\}$ is an example of an affine variety.}
}
\newglossaryentry{RemovableSingularity}
{
name=Removable Singularity,
description={Formally, if $U \subset \mathbb{C}$ is an open subset of the complex plane $\mathbb{C}$, and $a \in U$, and $f: U\backslash\{a\} \to \mathbb{C}$ a holmorphic function, then $a$ is a removable singularity for $f$ if there exists a holomorphic function $g: U \to \mathbb{C}$, coinciding with $f$ on $U\backslash\{a\}$. It is said that $f$ is holomorphically extended over $U$ if such a $g$ exists.  A simple example is the function
$f(z) = \frac{\sin(z)}{z}$
at $z=0$ (even this:
$f(z) = \frac{\sin(z)}{z}$
doesn't center.). The singularity, due to the indeterminate form, can be removed by defining $f(0)=1$, which is the limit of $f$ as $z$ approaches zero.}
}
\newglossaryentry{TetrahedralCoordinates}
{
name=Tetrahedral Coordinates,
description={Coordinates useful in plotting projective three-dimensional curves of the form $f(x_0,x_1,x_2,x_3)=0$, which are defined by
\begin{gather*}
X_0 = 1-Z-\sqrt{2}\,X \\
X_1 = 1 - Z + \sqrt{2}\,X \\
X_2 = 1+ Z+ \sqrt{2}\,Y \\
X_3 = 1 + Z - \sqrt{2}\,Y
\end{gather*}
}
}

\begin{document}

Consider the equation
\begin{equation}
e = m * c^2
\end{equation}
in which \gls{AffineVariety} is here, but not here \gls{TetrahedralCoordinates} oh and this \gls{RemovableSingularity}.

\printglossary

\end{document}


# The output # Notes

• You do not need \makeglossaries twice in the preamble.
• $$...$$ is deprecated and should not be used. Use $...$`, for example, instead.
• Nice! Perfect! I was deep in glossaries.pdf trying to figure out ... something :) I hope to use your answer as a template to also tweak even more! Thanks for the Notes. – nate Mar 19 '14 at 2:03
• @nate Be sure to get the edit or your entry labels will be weirdly placed. The crucial bit is on page 161 of the manual 'Example 21 (Creating a new glossary style based on an existing style)' ;). – cfr Mar 19 '14 at 2:06