Page LayoutCustomization of chapter style

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
DavidH
Posts: 8
Joined: Sun Feb 05, 2012 4:33 pm

Customization of chapter style

Post by DavidH »

Hi there..

I'd like to be able to customize the style of my chapter headings. I've been looking at different chapter styles for the memoir-class (though I'm using the report documentclass), but I'm having difficulties understanding the original code for these styles.

I'd like my chapter heading style to be like this:
At the left, the chapter number (e.g. Chapter 1), and being able to control the font style and size. At one line beneath, flushed right, the chaptertitle. Right to the chaptertitle I'd like a vertical rule with the same hight as the chaptertitel.

However, the chapter style of my ToC - and the sections before that - must not be changed, so I need to be able to control when this style shall aply!

Can anyone help me achieve this!?

Thanks in advance!

\David

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Customization of chapter style

Post by Stefan Kottwitz »

Hi David,

this can be done with the titlesec package. Besides just documentation, the manual contains an appendix which explains how the standard headings are typeset. I think this is a good start, copying this and customize it.
Perhaps try, and post what you tried if you have questions regarding it.

Stefan
LaTeX.org admin
DavidH
Posts: 8
Joined: Sun Feb 05, 2012 4:33 pm

Customization of chapter style

Post by DavidH »

Alright, this is what I've done so far

Code: Select all

\usepackage{titlesec}

\newcommand{\mainchapterstyle}{%
   \titleformat{\chapter}[display]%
   {\flushright \Huge\bfseries}%
   {\flushleft \Large\sc Chapter \thechapter}%
   {1.0em}{}}
However, I still got two issues.
- The first is that I would like to decrease the horisontal space in which the chaptertitle is written. When I have long titles, sometimes a single word is placed on the next line, which doesn't look good.
- Also the space from the top of the page to \thechapter is too big.

I've been looking at the \titlespacing command, but I can't get this to solve the problem.

How do I solve these problems!?

David
Last edited by DavidH on Sat Apr 14, 2012 11:55 am, edited 1 time in total.
DavidH
Posts: 8
Joined: Sun Feb 05, 2012 4:33 pm

Customization of chapter style

Post by DavidH »

I just found some code that, partly, solves the problem with too much white space above the chapter title / label:

Code: Select all

\makeatletter
\let\@makechapterheadOLD\@makechapterhead
\renewcommand{\@makechapterhead}{\mbox{}\vspace*{-50pt}\@makechapterheadOLD}
\let\@makeschapterheadOLD\@makeschapterhead
\renewcommand{\@makeschapterhead}{\mbox{}\vspace*{-50pt}\@makeschapterheadOLD}
\makeatother
This, however, also reduces the white space when I do the starred version of the headings, e.g. \chapter*, and is not what I want. How do I either alter the above code not to change the starred chapters, or incorporate it in \titleformat command?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

Customization of chapter style

Post by Stefan Kottwitz »

You could use, for example,

Code: Select all

\titlespacing*{\chapter}{0pt}{0pt}{40pt}
within your \mainchapterstyle command.

Stefan
LaTeX.org admin
Post Reply