4

My university came up with the brilliant idea of determining that the front matter of a thesis must not show the page's numbers. I applied the solutions of this answer: suppress page numbers in document's front matter and it worked but for the glossaries pages.

I'm using the glossaries package for displaying lists of symbols, acronyms and abbreviations. The class I'm using is a custom class based on the book class.

Edit:

MWE

\documentclass[a4paper,10pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{hyperref}
\usepackage{etoolbox}
\usepackage[nonumberlist,symbols,acronyms,abbreviations]{glossaries-    extra}
\usepackage{blindtext}

\makeglossaries
\appto\captionsenglish{%
\renewcommand*{\acronymname}{List of Acronyms}%
}
\appto\captionsenglish{%
\renewcommand*{\glssymbolsgroupname}{List of Symbols}%
}
\appto\captionsenglish{%
\renewcommand*{\abbreviationsname}{List of Abbreviations}%
}
% abbreviations:
\newabbreviation{const}{Const.}{Constitution}
% acronyms
\newacronym{LED}{LED}{Light Emitting Diode}
% symbols
\newglossaryentry{pi}{name={\ensuremath{\pi}},sort=    {pi},type=symbols,category=symbol,description={Ratio between the circumference and the radius of a circle}}

\makeatletter
\renewcommand{\pagenumbering}[1]{\gdef\thepage{\csname     @#1\endcsname\c@page}}
\makeatother

\begin{document}

\pagestyle{empty} % No page numbers
\begingroup
\frontmatter
\patchcmd{\chapter}{plain}{empty}{}{} % Patching the command so lists have no page numbers
\pagenumbering{arabic} % For showing in the index

\listoffigures % OK, page number not shown
\listoftables % OK, page number not shown

\glsaddall
\printglossaries % Don't work, the glossaries displays the page     numbers

\tableofcontents
\endgroup

\clearpage
\pagestyle{plain} % Back to the page numbering

\mainmatter

\chapter{First chapter}

\Blindtext

\chapter{Second chapter}

\Blindtext

\end{document}

Edit: to my amusement, in the MWE it works, but in the custom class, it doesn't.

WDiniz
  • 137
  • Please don't post such fragments of code –  Jul 08 '16 at 15:20
  • @ChristianHupfer I've posted the fragment to exemplify that the \patchmd solution does not work. A MWE with the custom class I am forced to use is very impractical. Any suggestion of how to do it better so? – WDiniz Jul 08 '16 at 15:23
  • You could at least post a compilable version with a regular class (say book, such that we don't have to do all from scratch! –  Jul 08 '16 at 15:25
  • @ChristianHupfer Thks for the advice, I produced an MWE with the book class, but strangely, it worked as it should've. Perhaps some of the many packages loaded by the custom class may be interfering with it. Think I'll have to bear with it alone :-( – WDiniz Jul 08 '16 at 15:50
  • Such customized classes aren't useful in many cases :-( –  Jul 08 '16 at 15:52
  • Try \renewcommand{\glossarypreamble}{\thispagestyle{empty}} – Nicola Talbot Jul 08 '16 at 16:03
  • @ChristianHupfer Yes, sadly I don't have the time to start all over now :-( – WDiniz Jul 08 '16 at 16:52
  • @NicolaTalbot Nice, I was looking into the code of the glossaries package to find some clue, but you saved me there :-D. That did the trick. Thanks! May you write it in an answer so that I could accept it? – WDiniz Jul 08 '16 at 16:54
  • @WDiniz Done :-) – Nicola Talbot Jul 08 '16 at 17:00

1 Answers1

4

Each glossary uses \glossarypreamble after the heading, so you just need to redefine this to override \thispagestyle{plain} issued by \chapter:

\renewcommand{\glossarypreamble}{\thispagestyle{empty}}
Nicola Talbot
  • 41,153