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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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

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.
http://tex.stackexchange.com/questions/97465/modify-default-memoir-chapter-style
tex.stackexchange.com
crawl=CC-MAIN-2016-07
83921
application/http; msgtype=response
sha1:IBTDC3FT72B3EODDY6KGXX367PTVEHIQ
<urn:uuid:b0524a4d-24f9-441a-9d9a-0cf59ce26e21>
2016-02-09T03:50:30Z
104.16.117.182
sha1:EW6ZBT75PREG4RT3ICQLYHSXRZB5U27G
<urn:uuid:8ca72f27-b10f-42ae-b067-503732be2522>
http://tex.stackexchange.com/questions/97465/modify-default-memoir-chapter-style
response
<urn:uuid:e1fa979f-7013-425d-9eaa-9bf6b65b33d5>
robots: classic
hostname: ip-10-236-182-209.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2016-07
operator: CommonCrawl Admin
description: Wide crawl of the web for February 2016
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf