3

I use the glossaries package like this:

\usepackage[toc,xindy]{glossaries}
\include{glossaryentries}
\renewcommand*\glspostdescription{\dotfill}
\makeglossaries

....

\setglossarystyle{long}
\printglossary[title=List of Notations]

and get that

the page number on the 4th line on the left should be on the 3rd line on the right

It does exactly what I want, except for some entries like the second one on the picture, where the page number appear on the left instead of the right. I have no idea why. Does someone know what I should do?

This specific entry is described by

\newglossaryentry{supportfunction}{
   name         ={\ensuremath{h(K, \vect{u} )}},
   description  ={support function of $K$ evaluated in the direction $ \vect{u} $},
   sort         =hKu
   }

A minimal example:

\documentclass[11pt]{book}
\usepackage{hyperref}
\usepackage{glossaries}

\renewcommand*\glspostdescription{\dotfill}
\makeglossaries

\newglossaryentry{supportfunction}{
  name          ={\ensuremath{h(K, \boldsymbol{u} )}},
  description   ={support function of $K$ evaluated in the direction $ \boldsymbol{u} $},
  sort          =hKu
  }

\begin{document}
  \gls{supportfunction}
  \setglossarystyle{long}
  \printglossary
\end{document}
4
  • Please, make a minimal example, but also try \dotfill\nolinebreak
    – egreg
    Sep 26 '16 at 13:01
  • @egreg Thanks for your comment. \nolinebreak works. Problem solved :-) You can post it as an answer if you wish. Sep 26 '16 at 14:48
  • Not without a full (minimal) example that shows the issue.
    – egreg
    Sep 26 '16 at 16:11
  • @egreg Sorry for my laziness of not having provided a minimal example earlier. Shame on me. I just added one to my question. Sep 26 '16 at 18:39
2

This can be reproduced by explicitly using longtable:

\documentclass[11pt]{book}
\usepackage{hyperref}
\usepackage{glossaries}
\begin{document}
\begin{longtable}{lp{\glsdescwidth}}
\ensuremath{h(K, \boldsymbol{u} )} &
support function of $K$ evaluated in the direction
$ \boldsymbol{u} $\dotfill\space
1\tabularnewline
\end{longtable}
\end{document}

This is essentially what the long style does. The problem seems to be the space after \dotfill. Since this is part of the style, the simplest solution is to define a custom style based on long:

\documentclass[11pt]{book}
\usepackage{hyperref}
\usepackage{glossaries}

\makeglossaries

\newglossarystyle{longdotted}{%
  \setglossarystyle{long}%
  \renewcommand{\glossentry}[2]{%
    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \glossentrydesc{##1}\dotfill ##2\tabularnewline
  }%
}

\newglossaryentry{supportfunction}{
  name          ={\ensuremath{h(K, \boldsymbol{u} )}},
  description   ={support function of $K$ evaluated in the direction
$ \boldsymbol{u} $},
  sort          =hKu
  }

\begin{document}
  \gls{supportfunction}
  \setglossarystyle{longdotted}
  \printglossary
\end{document}

image of glossary

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.