1

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.

enter image description here

Kong
  • 2,313
  • 1
    They look more-or-less the same to me. However, the different might be because of the font sizes and/or baselines of the elements you're showing. For example, Test has no descenders like Background; adding \strut to the title should correct for this. Also, \section is typically set in \large, so add {\large\strut} just before Test. 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
  • @Werner I think the OP means same distance between chapter "label" to chapter title and chapter title to text or section following... (Not sure) – koleygr Dec 31 '17 at 23:45
  • 1
    Your main claim does not seem to be correct. You may be confused by the fact that the word "Test" which follows the chapter-3 header is typeset at a different font size than the string "2.1 Recurrent Neural Networks" that follows the chapter-2 header. This may be verified by inserting the directive \Large before "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
  • 3
    I'm voting to close this question as off-topic because it appears to be based on an incorrect premise. – Mico Dec 31 '17 at 23:54
  • I am thinking to vote to reopen this question because closed by a misunderstood of OP's request... It is clear for me that the OP asks for equality between (chapter header[word chapter] with chapter name) and (chapter title header with text/section/whatever). So the reason that closed as off-topic doesn't seems valid to me. (Voting... Feel free to re-close if you thing I am wrong) – koleygr Jan 10 '18 at 13:40

1 Answers1

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:

enter image description here

enter image description here

koleygr
  • 20,105
  • 3
    I once started with such \def\chapter... thingies four years ago but soon learned that xpatch and xparse provide much better methods. \@ifstar... etc is getting tedious –  Dec 31 '17 at 23:55
  • 1
    thanks for reminding @ChristianHupfer... I will keep in mind... I still love old years :P – koleygr Jan 01 '18 at 00:05