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.

How could I adjust the size and placement of chapter heading in my custom class? I am using report class as my base. When I used titlesec package inside my custom class, it threw error

! Package titlesec Error: Not allowed in `easy' settings.

share|improve this question
    
So you don't want to use titlesec? –  Werner Sep 19 '13 at 4:37
    
@Werner I want my things done. Thats all :D –  tex Sep 19 '13 at 4:38
add comment

2 Answers 2

up vote 4 down vote accepted

The error message indicates that you were trying to use the "easy setup" with \titleformat* in a wrong way. For substantial formatting modifications, use the non-starred variant \titleformat and for changing the spacing, use \titlespacing*. Below are the default settings, which you can change according to your needs:

\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}
  {0pt}{50pt}{40pt}

For example, to center the title, reduce the space before from 50pt to 30pt and the space after from 40pt to 20pt, you can do:

\documentclass{report}
\usepackage{titlesec}
\usepackage{lipsum}

\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\filcenter}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}
  {0pt}{30pt}{20pt}

\begin{document}
\chapter{Test Chapter}
\lipsum[4]
\end{document}

enter image description here

share|improve this answer
    
How could I place it at Center? –  tex Sep 19 '13 at 4:51
    
@user3984 please see my updated answer. –  Gonzalo Medina Sep 19 '13 at 4:53
    
Why does the default use pt instead of em. shouldn't ems be used to scale in case of a huge paper sheet? –  Mario S. E. Nov 1 '13 at 0:33
add comment

The regular (numbered) chapter header in report is set by \@makechapterhead:

\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}

You see a 50\p@ (or 50pt) vertical gap before setting \@chapapp\space \thechapter in \huge\bfseries; then another 20\p@ gap and the title in \Huge\bfseries, and yet another 40\p@. Starred chapters are set using \@makeschapterhead:

\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}

You can change these values to your liking.

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.