I'm working on a final dissertation and I've been using the toptesi class provided by our university. The problem is that I wanted to manually add the glossaries package. Now, whilst I managed to insert properly the acronyms list in the right spot (both in the document and the table of contents) by adding this code to the toptesi.sty file:
\def\acronimi{%
\iffrontmatter\else\frontmattertrue\fi
\if@openright\cleardoublepage\else\clearpage\fi
\printglossary[type=\acronymtype]
\pagenumbering{roman}
\global\@topnum\z@
\@afterindentfalse
\addcontentsline{toc}{chapter}{Acronyms}
}
after the default code:
\def\frontmatter{\clearpage\ps@plain\pagenumbering{roman}%
\numeriromanitrue\frontmattertrue\@openrightfalse}
\def\mainmatter{\if@twoside\@openrighttrue\fi
\clearpage\ps@headings\pagenumbering{arabic}%
\numeriromanifalse\frontmatterfalse}
\AtBeginDocument{\frontmatter}
\figurespagefalse
\tablespagefalse
\def\sommario{%
\iffrontmatter\else\frontmattertrue\fi
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindentfalse
\@schapter{\summaryname}%
\addcontentsline{toc}{chapter}{\summaryname}%
}
\def\ringraziamenti{%
\iffrontmatter\else\frontmattertrue\fi
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindentfalse
\@schapter{\acknowledgename}%
\addcontentsline{toc}{chapter}{\acknowledgename}%
}
\renewcommand\chapter{%
\iffrontmatter\mainmatter\fi
\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\renewcommand\part{%
\iffrontmatter\mainmatter\fi
\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{empty}%
\if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi
\null\vfil
\secdef\@part\@spart}
\renewcommand\listoffigures{%
\if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindentfalse
\@schapter{\listfigurename}
\@mkboth{\listfigurename}{\listfigurename}%
\@starttoc{lof}%
\clearpage
\if@restonecol\twocolumn\fi
}
\renewcommand\listoftables{%
\if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindentfalse
\@schapter{\listtablename}%
\@mkboth{\listtablename}{\listtablename}%
\@starttoc{lot}%
\clearpage
\if@restonecol\twocolumn\fi
}
\renewcommand\tableofcontents{%
\if@twocolumn\@restonecoltrue\onecolumn\else\@restonecolfalse\fi
\if@openright\cleardoublepage\else\clearpage\fi
\global\@topnum\z@
\@afterindentfalse
\@schapter{\contentsname}%
\@starttoc{toc}%
\clearpage
\if@restonecol\twocolumn\fi
}
\def\indici{%
\iffrontmatter\else\frontmattertrue\fi
\iftablespage
{\addvspace{10pt}
\let\saveaddvspace=\addvspace
\def\addvspace##1{}
\listoftables
\let\addvspace=\saveaddvspace}
\addcontentsline{toc}{chapter}{List of Tables}%
\fi
\iffigurespage
{\addvspace{10pt}
\let\saveaddvspace=\addvspace
\def\addvspace##1{}
\listoffigures
\let\addvspace=\saveaddvspace}
\addcontentsline{toc}{chapter}{List of Figures}%
\fi
\tableofcontents
% \addcontentsline{toc}{chapter}{Index}%
}
it completely messes up the page numbering. Firstly, the acronyms page numbers are displayed as arabic instead of roman numbers (apart from the last page of the acronyms list which, surprisingly, exhibits a roman number). Secondly, the page numbering sequentiality is lost.
Edit: here is a file package with all the necessary files to simulate this error Click here to download a working example
Best Answer
Don't modify a class file under any circumstances.
Just add the definition of
\acronimi
to your document; here's an example, obtained by reducing your document to a MWE. However you have to remove the\pagenumbering{roman}
instruction that is the cause of your failure.There are a few things more to adjust, because
toptesi
tries to do clever things when it finds a\chapter
command, in particular switching to\mainmatter
. So we set temporarily\chapter
to swallow the*
automatically provided byglossaries
and to call the internal command\@schapter
, that is what LaTeX calls when it sees\chapter*
.