0

Under the default usage of the \part command, the text appears on a new page as "Part I" then on a new line "This is the name of the part".

I am trying to change the appearance of the "Part I" text. I have figured out how to remove the "Part" text using

\renewcommand{\partname}{}

I wish to also change the font size and color of the "I" text, but I am stuck. Any ideas how to do this?

Erik M
  • 203
  • The code of \part (actually \@part) depends on the underlying class. You should provide at least a compilable document –  Sep 05 '17 at 21:55
  • @ChristianHupfer the document is based on the book class, actually in a class called "Dissertate.cls" - there are a bunch of files required for compiling the document so I unfortunately wouldn't be able to recreate it here. Is there a way to do it for the book class? Perhaps I could go from there. – Erik M Sep 05 '17 at 22:02
  • I provided an answer to your question which is pretty much doing what you requested. Please give feedback –  Sep 08 '17 at 18:46

1 Answers1

4

The \@part macro is the one that must be changed here if numbered \parts are under consideration.

The \partname\nobreakspace\thepart construct is used in \@part in the book.cls (and in report as well)

A patch with \xpatchcmd can be applied in order to strip the \partname\nobreakspace content and use \textcolor{partnumbercolour}{\thepart} instead only.

Redefinition of \partname may break other features, I don't recommend it here.

Since the user class is loading book only, \AtBeginDocument{...} might be necessary to make the change effective.

\documentclass{book}

\usepackage{xcolor}


\usepackage{xpatch}

\colorlet{partnumbercolour}{blue}

\makeatletter
\AtBeginDocument{
\xpatchcmd{\@part}{\partname\nobreakspace\thepart}{\textcolor{partnumbercolour}{\thepart}}{}{}
}
\makeatother

\begin{document}

\part{Foo}

\part{Foobar}

\end{document}

enter image description here