On 09/02/14 20:01, Dave94705 wrote:
> I would like an altree style glossary so that I can have sublevels and each item's
> description in the glossary starts at the same location in the line.
>
> In the below example I get two things which really confuse me: 1) the sort is crazy
> (without, cdots, exists, forall is no order at all....) and 2) first item in the glossary
> has its description paragraph fulling indented (or not indented at all but moved over to
> the right entirely) while subsequent items' descriptions only have their first line indented.
> I like the first item's look -- the whole description indented.
>
> Why is sort not working as expected (at least not for me)? And how can I get all the descriptive
> paragraphs indented or moved to the right?
>
The sort problem is caused by a missing comma before "sort={without}".
The indentation problem is partly caused by a bug in the alttree style,
which I'll fix in the next version, but it can be patched using:
\makeatletter
\renewcommand{\glossentry}[2]{%
\settowidth{\glstreeindent}{\textbf{\@glswidestname\space}}%
\hangindent\glstreeindent
\parindent\glstreeindent
\makebox[0pt][r]{\makebox[\glstreeindent][l]{%
\glsentryitem{#1}\textbf{\glstarget{#1}{\glossentryname{#1}}}}}%
\ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}%
\glossentrydesc{#1}\glspostdescription \space #2\par
}%
\makeatother
The other part of the problem is caused by the enumerate environment
conflicting with the \hangindent setting. This can be fixed by
temporarily adding the hangindent to \leftmargini before the start of
the enumerate environment:
\documentclass{article}
\usepackage[nonumberlist,nopostdot]{glossaries}
\newglossary[slg]{symbols}{syi}{syo}{Symbols}
\setglossarystyle{alttree}
\glssetwidest{\hbox to 4em{\hfil}} % level 0 widest name
\glssetwidest[1]{\hbox to 2em{\hfil}} % level 1 widest name
\makeatletter
\renewcommand{\glossentry}[2]{%
\settowidth{\glstreeindent}{\textbf{\@glswidestname\space}}%
\hangindent\glstreeindent
\parindent\glstreeindent
\makebox[0pt][r]{\makebox[\glstreeindent][l]{%
\glsentryitem{#1}\textbf{\glstarget{#1}{\glossentryname{#1}}}}}%
\ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}%
\glossentrydesc{#1}\glspostdescription \space #2\par
}%
\makeatother
\makeglossaries
\newglossaryentry{cdots}{type=symbols,
name={\ensuremath{\cdots}},
description={is the mathematical symbol that indicates that
items continue on prior and/or following immediately neighboring
items in the simplest consistent pattern. If only one preceding
and/or following item is present, they continue on with single steps
of that item's subscript or other well-known (e.g.\ alphabetical or
numerical) progression. When not between starting and ending items,
\gls{cdots} are taken to mean pattern progresses infinitely onward.
Examples: $1 + 2 + \gls{cdots} + 9 + 10 = 1 + 2 + \gls{cdots} + 10 =
1 + \gls{cdots} + 10 = 55$. $(x_0, x_1, \gls{cdots}, x_{99},
x_{100}) = (x_0,\gls{cdots}, x_{100})$.},
sort={cdots}
}
\newglossaryentry{exists}{type=symbols,
name={\ensuremath{\exists}},
description={is the mathematical symbol for \emph{there exists}.},
sort={exists}
}
\longnewglossaryentry{for all}
{type=symbols, name={\ensuremath{\forall}}, sort={for all}}
{is the mathematical symbol for for all, for each, for every
($\forall$) is the mathematical symbol for: for all, for each, or
for every. Restrictions on such variables can be detailed
immediately after the variable(s) following the \gls{for all}
symbol. Examples:
\addtolength{\leftmargini}{\hangindent}%
\begin{enumerate}
\item $\gls{for all} x$ should be read as ``for all $x$'';
\item $\gls{for all} y > 5$ should be read as ``for all $y$
greater than $5$.''
\end{enumerate}
}
\newglossaryentry{wolg}{type=symbols,
name={{\rm w.o.l.g{.}}},
description={is the mathematical acronym for without loss of
generality. For example, \gls{wolg} assume that $n$ and $m$ have no
common factors and let $r=n/m$. We can do that because if $n$ and
$m$ have a net common factor $l$, then letting $p=n/l$ and $q=m/l$
gives $r = p/q$ and $p$ and $q$ do not, by definition of $l$ have
any common factor(s).},
first={{\rm w.o.l.g{.}} (``without loss of generality'')},
sort={without}
}
\begin{document}
Here are the symbols and acronyms I use: \gls{cdots}, \gls{wolg},
\gls{exists}, and \gls{for all}.
Here are my glossaries:
\printglossaries
\end{document}
(Incidentally, the old LaTeX2.09 font changing commands such as \rm are
deprecated.)
Regards
Nicola Talbot
--
Home:
http://www.dickimaw-books.com/
Creating a LaTeX Minimal Example:
http://www.dickimaw-books.com/latex/minexample/