4

According to the titlesec documentation (section 3.5):

You can assign a page style to levels of class top and page, as well as the default chapter with the following command: \assignpagestyle{command}{pagestyle}

It then states (section 3.9) that

There are three classes: page is like the book \part, in a single page, top is like \chapter ...

However using \assignpagestyle with \part doesn't seem to work:

\documentclass{book}

\usepackage[pagestyles]{titlesec}  
\assignpagestyle{\part}{empty}     % Doesn't work
\assignpagestyle{\chapter}{empty}  % Works

\begin{document}

\part{Bar}
\chapter{Foo}

\end{document}

I know I can change the \part and \chapter pagestyles doing the following in the preamble

\usepackage{etoolbox}
\patchcmd{\part}{plain}{empty}{}{}
\patchcmd{\chapter}{plain}{empty}{}{}

but since I'm using the titlesec package for my headers I wanted to simply use the \assignpagestyle command.

1
  • 1
    \part is usually defined in a non-standard way and it must be assigned somehow to the page class before making use of many features, including \titlespacing (with \titleformat, for example). The manual should make this point clearer. Jun 3, 2013 at 17:49

1 Answer 1

5

It works once you define a format for \part (the reason for this is not clear to me, but in the past I've found that the behaviour for \part commands is rather singular when using titlesec):

\documentclass{book}
\usepackage[a6paper]{geometry}% just for the example
\usepackage[pagestyles]{titlesec}  

\assignpagestyle{\part}{empty}     % Works
\assignpagestyle{\chapter}{empty}  % Works
\titleformat{\part}[display]
  {\normalfont\huge\bfseries\filcenter}{\partname\ \thepart}{22pt}{\Huge}

\begin{document}

\part{Bar}
\chapter{Foo}

\end{document}

enter image description here

2
  • That solves the problem. So, basically, the command doesn't work the way the documentation suggests it should?
    – petobens
    Jun 3, 2013 at 2:49
  • @petobens it works, but only if a \titleformat for \part has been used. I will write some note asking about this to Javier Bezos. Jun 3, 2013 at 2:55

You must log in to answer this question.

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