7

I'm using memoir and using its default chapter style. what I'm looking to do is to change the format from

chapter 1

chapter title

to something like this:

chapter 1: chapter title

I'm new to LaTeX and I've been struggling with this all day reading manual and searching the net

EDIT: I forgot to mention that I would like the title to be centered as well

1

2 Answers 2

9

In your preamble:

\renewcommand{\chapnumfont}{\chaptitlefont}    % To harmonise the font sizes
\renewcommand{\chapnamefont}{\chaptitlefont}   % idem
\renewcommand{\afterchapternum}{:\quad}        % To set the line

(for example).

The macro \afterchapternum is called by memoir after setting 'Chapter n' and before setting 'This is my Chapter'.

The default value is this:

\def\afterchapternum{\par\nobreak\vskip \midchapskip}

The memoir manual describes this in §6.5, around pp 80-82.


Note: Added font harmonisation. My thanks to @lockstep.

4
  • Many Thanks Brent... it works, but I had to remove the titlesec package that i was using for centering the all chapter titles... is there any workaround for this?
    – M. Habib
    Feb 9, 2013 at 10:59
  • @M.Habib There almost certainly is, but I'm afraid I can't research exactly how to do it right now, sorry. However, you might like to take a look at the various pre-defined chapter styles available in memoir -- try \chapterstyle{crosshead}, for example, in place of my answer. Feb 9, 2013 at 11:16
  • 2
    Use \renewcommand{\chapnamefont}{\chaptitlefont\centering}.
    – lockstep
    Feb 9, 2013 at 11:46
  • Many thanks Brent and lockstep ... works perfectly now
    – M. Habib
    Feb 9, 2013 at 13:35
5

A possible solution:

\documentclass{memoir}
\usepackage{lipsum}

\makeatletter
\newcommand{\fonttitle}{\chaptitlefont}
\makechapterstyle{mystyle}{%
\def\chapterheadstart{\vspace*{\beforechapskip}}
\def\printchaptername{}
\def\printchapternum{}
\def\printchapternonum{}
\def\printchaptertitle##1{\fonttitle \@chapapp\space \fonttitle \thechapter:\space \fonttitle ##1}
\def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}
}
\makeatother

\chapterstyle{mystyle}

\begin{document}
\chapter{My chapter}
\lipsum

\chapter{Another chapter}
\lipsum
\end{document}

The result (page 1 for example):

enter image description here

0

You must log in to answer this question.

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