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?

  • The code of \part (actually \@part) depends on the underlying class. You should provide at least a compilable document – user31729 Sep 5 '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 5 '17 at 22:02
  • I provided an answer to your question which is pretty much doing what you requested. Please give feedback – user31729 Sep 8 '17 at 18:46
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

  • Clearly a German document: not a single inter-word space in the whole thing:-) – David Carlisle Sep 5 '17 at 22:08
  • @DavidCarlisle: Wheredoyouwanttohaveinterwordspace? ;-) – user31729 Sep 5 '17 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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