How do I make the spacing between the chapter title and the text / section / whatever after it the same space ? I tried using this \titlespacing\chapter{0pt}{50pt}{20pt} but the text and section after the title still do not have the same spacing.
Asked
Active
Viewed 275 times
1 Answers
4
Here is a way:
\documentclass[a4paper,10pt]{report}
\usepackage[utf8]{inputenc}
% Title Page
\title{}
\author{}
\def\reducespace{\vspace*{-15pt}}
\let\oldchapter\chapter
\makeatletter
\def\chapter{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred chapter can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}
\def\@StarredWith[#1]#2{%
\oldchapter*{#2}\reducespace%
}
\def\@StarredWithout#1{
\oldchapter*{#1}\reducespace%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}\reducespace%
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}\reducespace%
}
\makeatother
\begin{document}
\maketitle
\chapter{Test Chapter 1}
text
\chapter{Test chapter 2}
\section{Section 1}
\end{document}
source: an old answer of mine here: https://tex.stackexchange.com/a/380116/120578
Output:
koleygr
- 20,105
-
3I once started with such
\def\chapter...thingies four years ago but soon learned thatxpatchandxparseprovide much better methods.\@ifstar...etc is getting tedious – Dec 31 '17 at 23:55 -
1thanks for reminding @ChristianHupfer... I will keep in mind... I still love old years :P – koleygr Jan 01 '18 at 00:05



Testhas no descenders likeBackground; adding\strutto the title should correct for this. Also,\sectionis typically set in\large, so add{\large\strut}just beforeTest.I'm thinking you want all of this automated, right? Well, it's probably easier to just fix it manually. – Werner Dec 31 '17 at 23:34\Largebefore "Test" at the start of chapter 3. For sure, one might well argue that it would be improper (typographically speaking) not to adjust the spacing for the fact that a section-level header might occur after a chapter header. – Mico Dec 31 '17 at 23:53