Page Layouttitlesec -- reduce vertical spacing around book chapters?

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
alanq
Posts: 21
Joined: Mon Dec 28, 2009 3:03 am

titlesec -- reduce vertical spacing around book chapters?

Post by alanq »

I've found lots of posts in the forum where the advice is, "just use the titlesec package" and, doubtless that's the way to go.

However, having read most of titlesec.pdf (http://www.tex-tipografia.com/archive/titlesec.pdf), I'm even more confused than when I started :oops:

Can anyone tell me how to reduce the vertical spacing above/below the chapter number/title whilst retaining all of the other formatting?

I've managed to reduce the vertical spacing. And put the title on a line below the 'Appendix X' part. But the title is still to the right of the appendix bit. Like this:

Code: Select all

Appendix A
Title of the first
appendix in the book
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
What I want is:

Code: Select all

Appendix A
Title of the first appendix in the book
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Reading titlesec.pdf it looks like I need something like leftmargin (see 3.1 on page 3). However, I can't work out where to stick leftmargin. So to speak :)

My titlesec code so far:

Code: Select all

Code, edit and compile here:
\titleformat{\chapter}
{\raggedright\huge\bfseries}% global formatting (number and title)
{Appendix \thechapter}% label: number and its formatting
{0pt}% spacing between number and title
{\vspace{1em}\\}% optional (content between number and title)
\titlespacing*{\chapter}
{0pt}% left
{1cm}% before
{1.2em}% after
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I have tried using a negative value in the spacing between number and title part. But no single value will achieve perfect alignment -- one title begins with 'M' and another with 'W' -- with a value that aligns the 'M' with the 'A', it doesn't quite create alignment for the 'W', and vice versa. (hope this makes sense).

Preamble is:

Code: Select all

Code, edit and compile here:
\documentclass[11pt,a5paper,draft]{book}
\usepackage{graphicx} % to include postscript graphics
\usepackage{wrapfig} % to allow wrapping of text around figures
\usepackage{color}
\usepackage{multicol} % to allow 3 column pages for long narrow tables
\usepackage{xtab} % to allow tables to break over twocolumn (or 3 column) pages
\usepackage{titlesec}
\usepackage[utf8]{inputenc} %for UTF8 characters (see plbook.sty)
\usepackage{plbook} % my style file
...
\mainmatter
\include{chap01}
\include{chap02}
\include{chap03}
\include{chap04}
\include{chap05}
\include{appendix}
...
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
plbook.sty is:

Code: Select all

Code, edit and compile here:
\setlength{\parskip}{\bigskipamount}
\setlength{\parindent}{0pt}
\setlength{\topmargin}{-0.5in}
\setlength{\headheight}{0.2in}
\setlength{\headsep}{0.2in}
\setlength{\topskip}{0in}
\setlength{\textheight}{9.6in}
\setlength{\footskip}{0.8in}
\setlength{\footnotesep}{0.2in}
\setlength{\textwidth}{6.2in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
appendix.tex is:

Code: Select all

Code, edit and compile here:
% Included in book.tex
% appendix.tex
%
\begin{appendix}
% from \usepackage{titlesec}
\titleformat{\chapter}
{\raggedright\huge\bfseries}% global formatting (number and title)
{Appendix \thechapter}% label: number and its formatting
{0pt}% spacing between number and title
{\vspace{1em}\\}% optional (content between number and title)
\titlespacing*{\chapter}
{0pt}% left
{1cm}% before
{1.2em}% after
\input{app01}
\input{app02}
\input{app03}
\end{appendix}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Each appendix file has the general format:

Code: Select all

Code, edit and compile here:
\chapter{Appendix Title}
\setlength{\columnsep}{0.2in}
\begin{multicols}{3}
\small
\renewcommand{\arraystretch}{1.2}
\begin{tabular}{cl}
...
\end{tabular}
\hspace*{-0.9in}
\begin{tabular}{cl}
...
\end{tabular}
%\hspace*{-0.1in}
\begin{tabular}{cl}
...
\end{tabular}
\end{multicols}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Thank you.
Last edited by alanq on Sat Jan 08, 2011 2:33 am, edited 1 time in total.

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

titlesec -- reduce vertical spacing around book chapters?

Post by frabjous »

If you were going to use "leftmargin", it would go in brackets right after \titleformat{\chapter}, but I actually think you want "display" instead. "display" is the shape used in standard Chapter titles in the book class, and it's the only one that puts the "Appendix A" part and the Appendix title on separate lines. You're trying to achieve that by using a manual line break \\ in the content between number and title, but I think that's what is causing problems.

Notice that in the display shape the "spacing between number and title" is vertical spacing, so you can just put in 1em there rather than using \vspace{1em}.

So perhaps you want something like this?

Code: Select all

Code, edit and compile here:
\titleformat{\chapter}[display]%
{\raggedright\huge\bfseries}% global formatting (number and title)
{Appendix \thechapter}% label: number and its formatting
{1em}% spacing between number and title
{}% optional (content between number and title)
\titlespacing*{\chapter}
{0pt}% left
{1cm}% before
{1.2em}% after
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Also please read this guide on how to construct a minimal working example. When you do these snippets with parts cut out like "...", it just creates more work for those who would help you, since we have to reinsert things there to make the code compiliable. It's better to substitute a minimal amount of sample material to keep the document self-contained. Also, remove everything not relevant to the problem, and to avoid using \input and \include commands unless they're directly relevant to the problem. Your problem isn't that complicated, but it took me a long time just to piece together and reconstruct a sample I could use to test.

There are some other strange oddities in your document. I'd suggest using the geometry package in place of your plbook.sty, and the \hspace* commands in the appendix part really confused me too.
alanq
Posts: 21
Joined: Mon Dec 28, 2009 3:03 am

titlesec -- reduce vertical spacing around book chapters?

Post by alanq »

[SOLVED]

Thank you frabjous!

It is indeed 'display' that does what I wanted:

Code: Select all

\titleformat{\chapter}[display]
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Apologies for the ...,
and the hspace commands (needed to make tabular and multicols play nicely).
And I shall investigate geometry, and properly read http://www.latex-community.org/forum/vi ... 878#p30535 plus http://www.minimalbeispiel.de/mini-en.html :)

Cheers
Alan
Post Reply