1

In the below MWE, my custom page style cannot get applied to the first page of a chapter, as can be seem be examining the style of the page number; all subsequent pages seem to be styled corretly. Why is this happening and how can I fix it?

\documentclass[openany]{book}
\usepackage{lipsum}
\usepackage[pagestyles]{titlesec}
\newpagestyle{main} { 
  \sethead*{}{}{}
  \setfoot*{}{\footnotesize---\ \thepage\ ---}{}
}

\begin{document}
\pagestyle{main}
\chapter{Something}
\lipsum[1-20]
\end{document}

MWE: first page's page number style does not get changed by the custom style

1 Answer 1

0

The problem is that \chapter uses the plain style on the first page of a chapter, so you have to redefine the plain style:

\documentclass[openany]{book}
\usepackage{lipsum}
\usepackage[pagestyles]{titlesec}
\newpagestyle{main} {
  \sethead*{}{}{}
  \setfoot*{}{\footnotesize---\ \thepage\ ---}{}
}
\renewpagestyle{plain} {
  \sethead*{}{}{}
  \setfoot*{}{\footnotesize---\ \thepage\ ---}{}
}

\begin{document}

\pagestyle{main}
\chapter{Something}
\lipsum[1-20]

\end{document}

enter image description here

1
  • Thanks! It works!
    – Rainn
    Commented Aug 11, 2019 at 17:46

You must log in to answer this question.

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