3

How can we flush right the page number in the glossary/index considering the following MWE:

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[style=super]{glossaries}

\makeglossaries
\newglossaryentry{label}{name={Name}, description={Description}}

\begin{document}

\glsaddall
\printglossaries

\end{document}

... which gives this output

enter image description here

I want the page number to be at the far right of the page, is it possible to do so ?

2

It could be also done with style=super. Here is a step-by-step solution. At the end i added another alternative with \usepackage{glossary-superragged}. But first i will start with adaptions to your mwe.

  1. (OPTIONAL) Visualize the margins with \usepackage{showframe}
  2. (OPTIONAL) Visualize borders of the style super with superborder \usepackage[style=superborder,automake]{glossaries}. Later you could use the original \usepackage[style=super,automake]{glossaries} without lines around it.
  3. Shift page number to the right with \renewcommand*\glspostdescription{\hfill}. Similar to @clemens answer here.
  4. For the next step you need \usepackage{calc}. Have a look to 15.1.5 Supertabular Styles,p.226 and redefine glsdescwidth so that it fits the rest of the page. Done with \setlength\glsdescwidth{\textwidth-\widthof{longest Name}-4\tabcolsep}. Note: Instead of longest Name you have to write always your longest glossaries entry.

Results with superborder, border and as an alternativeglossary-supperragged:

enter image description here

MWE: style=super/ superborder(=super with horizontal and vertical lines around it)

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
%\usepackage{showframe}

\usepackage[style=super,automake]{glossaries}
%OR \usepackage[style=superborder,automake]{glossaries}

\renewcommand*\glspostdescription{\hfill}

\usepackage{calc}

\makeglossaries
\newglossaryentry{label}{name={Name}, description={Description}}
\newglossaryentry{labelLong}{name={longest Name}, description={Description}}
\begin{document}
\setlength\glsdescwidth{\textwidth-\widthof{longest Name}-4\tabcolsep}

\glsaddall
\printglossaries
\end{document}

MWE: alternative with glossary-supperragged

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[automake]{glossaries}
\usepackage{glossary-superragged}
\renewcommand*\glspostdescription{\hfill}
\makeglossaries
\newglossaryentry{label}{name={Name}, description={Description}}
\newglossaryentry{labelLong}{name={longest Name}, description={Description}}
%\usepackage{showframe}
\begin{document}
\glsaddall
\printglossaries
\end{document}
1

Thanks to Troy, the solution is to load a different style :

\usepackage[style=super4col]{glossaries}

do the job.

A comprehensive list of glossaries styles can be found here.

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.