Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
    
Look for \@part –  egreg Dec 14 '11 at 18:26
    
@egreg: nothing like \@part in the .cls file either, thanks. –  limist Dec 14 '11 at 18:32
1  
@egreg the class is based on report.cls –  Alain Matthes Dec 14 '11 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. –  Yiannis Lazarides Dec 14 '11 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. –  Mike Renfro Dec 14 '11 at 20:24
show 6 more comments

1 Answer

up vote 4 down vote accepted

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
share|improve this answer
    
Thanks - which file should this code go into please? –  limist Dec 21 '11 at 18:10
    
@limist Put it in your preamble, before \begin{document}. –  egreg Dec 21 '11 at 18:51
    
Thank you; some additional changes were needed but the general approach works. –  limist Jan 11 '12 at 23:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.