I recently converted a document from book to memoir. It turns out that sectsty is incompatible. I used to have this:


which very conveniently changed all my section headings' colours, including chapter, sections and subsections. What's the closest I can get for memoir?


The memoir class provides plenty of hooks for doing this sort of thing, but chapters and sections are treated differently. The \printchaptername macro prints the chapter name. Since we don't want to redefine it, I have used the \addtodef macro to prepend the \color macro to its definition, leaving the rest unchanged.

Depending on how you want the Table of Contents to look like, there are two different macros that can be changed. If you only want the TOC title changed, a different patching macro \addtoiargdef is used, since that macro takes an argument and cannot be patched with addtodef.

For the section formatting, there is an empty hook for each sectioning level which is initially set to {}. There is a macro \setShook (where S stands for the sectioning level (sec, subsec, subsubsec). If you set this at the section level it will be inherited by the lower sections.

\addtodef{\tocheadstart}{\color{blue!50!black}}{} % If you want the whole TOC to be blue also
%\addtoiargdef{\printtoctitle}{\color{blue!50!black}}{} % If you just want the TOC title blue
\chapter{A chapter}
\section{A section}
\subsection{A subsection}
\chapter{An appendix}
\section{A section}
\subsection{A subsection}

partial output

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.