4

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 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

Table of contents Passage from acknowledgements to acronyms Last acronym page with the return of the roman numbers

6
  • 1
    Why setting \pagenumbering{roman} in the definition of \acronimi? Remove it and the numbering will get back to normal.
    – egreg
    Jul 2, 2013 at 11:11
  • I tried, but as a result all the pages from "acronym" will have an arabic number (whereas I would like roman numbers for the table of contents, acknowledgements, summary and so forth). What changes though is that the sequentiality is, in that case, respected.
    – Ales
    Jul 2, 2013 at 11:17
  • A MWE is needed.
    – egreg
    Jul 2, 2013 at 12:19
  • If by MWE you mean a working example, I've added one in the main thread. Thank you very much for taking interest!
    – Ales
    Jul 2, 2013 at 12:21
  • Sorry, but a 600 KiB zip file is not a MWE.
    – egreg
    Jul 2, 2013 at 12:23

1 Answer 1

3

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 by glossaries and to call the internal command \@schapter, that is what LaTeX calls when it sees \chapter*.

\documentclass[12pt,oneside,cucitura]{toptesi}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage[acronym]{glossaries}
% we want to teach the correct word for Italian
\addto\captionsitalian{\renewcommand{\acronymname}{Acronimi}}
\makeglossaries

\usepackage{hyperref}
\hypersetup{%
    pdfpagemode={UseOutlines},
    bookmarksopen,
    pdfstartview={FitH},
    colorlinks,
    linkcolor={blue},
    citecolor={red},
    urlcolor={blue}
  }

\makeatletter
\newcommand\acronimi{%
 \iffrontmatter\else\frontmattertrue\fi
 \if@openright\cleardoublepage\else\clearpage\fi
 % change the meaning of \chapter in a group
 \begingroup\def\chapter##1{\@schapter}
 \phantomsection % for the hyperlink
 \addcontentsline{toc}{chapter}{\acronymname} % for the TOC
 \printglossary[type=\acronymtype]
 % The following two lines seem unnecessary
 %\global\@topnum\z@
 %\@afterindentfalse 
 \endgroup
}  
\makeatother

% Define the acronyms
\newacronym{cctv}{CCTV}{closed-circuit television}
\newacronym{cdss}{CDSS}{clinical decision support systems}
\newacronym{chf}{CHF}{chronic heart failure}

\glsaddall

\begin{document}

\sommario

La pressione barometrica di Giove viene misurata
mediante un metodo originale  messo a punto dai candidati, che si basa
sul rilevamento telescopico della pressione.

\ringraziamenti

I candidati ringraziano vivamente il Granduca di Toscana per i mezzi
messi loro a disposizione, ed il signor Von Braun, assistente del
prof.~Albert Einstein, per le informazioni riservate che egli ha
gentilmente fornito loro, e per le utili discussioni che hanno permesso
ai candidati di evitare di riscoprire l'acqua calda.

\acronimi
\indici

\mainmatter

\part{Prima Parte}
\chapter{Introduzione generale}

Le grandezze in gioco ...

\end{document}

enter image description here

6
  • Sadly, it's still not working. There must be some problem with the way Latexian launches the makeglossaries command. If I run the makeglossaries command under texmaker, I can see the correct number, but the Acronyms page is not printed. If I use Latexian (and the in-built makeglossaries function) the page is printed but the numbers are wrong again. I'm looking into it. Thank you again.
    – Ales
    Jul 2, 2013 at 16:40
  • @Ales With an unmodified toptesi my example works, as the image shows.
    – egreg
    Jul 2, 2013 at 16:54
  • sorry, I didn't mean to say that your example was wrong, I'm sure it does work perfectly. Sadly it doesn't in my computer (with an unmodified toptesi. I must be making some mistake while launching the makeglossaries command.
    – Ales
    Jul 2, 2013 at 16:56
  • Nothing. I confirm that the code you posted (copied and pasted) doesn't work (at least on my computer) when I compile using makeglossaries on a pristine version of the toptesi class (I have deleted the entire texlive2012 distribution and installed the new one, texlive2013). If I compile without using the makeglossaries command it does show what you posted as an image, but the Acronimi page is not compiled properly. I'm puzzled...
    – Ales
    Jul 2, 2013 at 19:13
  • @Ales Now I understand better the problem. A solution is expected soon.
    – egreg
    Jul 2, 2013 at 21:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .