Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
Welcome to TeX.sx! No need to include 'thanks', simpliy upvote any good answers you may receive. –  Peter Jansson Feb 9 '13 at 10:01
    
thanks Peter :) –  M. Habib Feb 9 '13 at 10:04
add comment

2 Answers

up vote 8 down vote accepted

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.

share|improve this answer
    
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 '13 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. –  Brent.Longborough Feb 9 '13 at 11:16
2  
Use \renewcommand{\chapnamefont}{\chaptitlefont\centering}. –  lockstep Feb 9 '13 at 11:46
    
Many thanks Brent and lockstep ... works perfectly now –  M. Habib Feb 9 '13 at 13:35
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.