3

I'm using an external .cls file, which is based on the report.cls template. I need to change the formatting of the top-level parts (i.e. \part objects) in the table of contents, and on the \part pages. In particular,

  • On the table of contents, I need the \part entries to be centered, all-caps, no page number, and start with the word "PART" e.g. "PART I: FOO," "PART II: BAR"
  • On the \part pages within the document, I need to turn off page numbering in the footer.

Currently, in the .cls file, the \tableofcontents command is:

\renewcommand{\tableofcontents}{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \normalsize
    \chapter*{\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
    {\hfill \textbf{Page}\par}%
    {\hyphenpenalty=\umthesis@listhyphenpenalty\@starttoc{toc}}%
    \if@restonecol\twocolumn\fi
    }

As for \part formatting, I don't see any commands in the .cls file for it.

I think these are straightforward changes for you TeX experts out there, but as a noob with a deadline, I'm not making much headway. Any help appreciated!

11
  • Look for \@part
    – egreg
    Dec 14, 2011 at 18:26
  • @egreg: nothing like \@part in the .cls file either, thanks.
    – limist
    Dec 14, 2011 at 18:32
  • 1
    @egreg the class is based on report.cls Dec 14, 2011 at 18:37
  • 2
    @limist Then it has the same disease:) In your code the prefix states \umthesis that made me think is from there. You need to give a link. Dec 14, 2011 at 18:48
  • 1
    Someone (i.e., faculty or staff) at that other university needs to take responsibility for the class file. Also, I'm going to guess this might be the class file in question. Dec 14, 2011 at 20:24

1 Answer 1

4

If the class doesn't define \part and the command is usable, then there is somewhere near the beginning of the class file the command \LoadClass and, from what you're reporting, the base class should be report.

So the definition to modify can be found in report.cls; the following should do what you're looking for:

\makeatletter
\def\@part[#1]#2{%
  \ifnum \c@secnumdepth >-2\relax
    \refstepcounter{part}%
    \addcontentsline{toc}{part}{%
      \MakeUppercase{Part \thepart: #1}}%
  \else
    \addcontentsline{toc}{part}{\MakeUppercase{#1}}%
  \fi
  \markboth{}{}%
  {\centering
   \interlinepenalty \@M
   \normalfont
   \ifnum \c@secnumdepth >-2\relax
     \huge\bfseries \partname\nobreakspace\thepart
     \par
     \vskip 20\p@
   \fi
   \Huge \bfseries #2\par}%
  \@endpart}
\def\@endpart{%
   \thispagestyle{empty}%
   \vfil\newpage
   \if@twoside
     \if@openright
       \null
       \thispagestyle{empty}%
       \newpage
     \fi
   \fi
   \if@tempswa
     \twocolumn
   \fi}
\makeatother
3
  • Thanks - which file should this code go into please?
    – limist
    Dec 21, 2011 at 18:10
  • @limist Put it in your preamble, before \begin{document}.
    – egreg
    Dec 21, 2011 at 18:51
  • Thank you; some additional changes were needed but the general approach works.
    – limist
    Jan 11, 2012 at 23:53

You must log in to answer this question.

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