0

I want to put chapter number and chapter title in one line and i found this code that works well: (Chapter number and chapter title in one line)

\documentclass{book}
\usepackage{titlesec}
\titleformat{\chapter}[hang] 
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter:}{1em}{}

\begin{document} \chapter{A chapter} \section{A section} \end{document}

However it uses the titlesec package that is incompatible with memoir class that use in my book. It is possible to achieve the same result in another not-titlesec depended way?

  • Could you show a MWE for the memoir class which is incompatible. – Tom May 24 '22 at 20:46
  • 1
    Isn't this more or less a variation over the section chapter style in memoir. It is not hard to do. Not at pc, so will have a look tomorrow. Basically the macros that print the chapter+number line has to be redefined to do nothing. The midskip macro (don't remember the name) also gave to do nothing. Then redefine printchaptertitle to print chapter+number+title. – daleif May 24 '22 at 21:10

1 Answers1

2

memoir provides the commands to create custom chapter styles without additional packages.a

\documentclass{memoir}

\makechapterstyle{sectionx}{% define the new style \chapterstyle{default} \renewcommand{\chaptitlefont}{\normalfont\huge\bfseries} \renewcommand{\chapnumfont}{\chaptitlefont} \renewcommand{\printchaptername}{\chaptitlefont \chaptername} \renewcommand{\printchapternum}{\thechapter:} \renewcommand{\afterchapternum}{\hspace{1em}} }
\chapterstyle{sectionx}% use the style

\begin{document} \chapter{A chapter} \section{A section} \end{document}

Highly recommended reading for memoir users: Chapter styles in memoir class.

Simon Dispa
  • 39,141