# Too much vertical space after long section title using titlesec

I'm using titlesec to change the style of my section titles. Sometimes, when the title is long, but just short enough to fit on one line, some extra vertical spaces is add. The following MWE illustrates the problem:

\documentclass{book}
\usepackage[a4paper]{geometry}
\usepackage[explicit]{titlesec}

\titleformat{\section}[block]{\Large\normalfont\bfseries}{#1}{.5em}{}

\begin{document}
\section{This is a short title}
This is a paragraph.

\section{This is a purposely long title that shows some odd behavior}
This is a paragraph.
\end{document}


This is rendered as follows:

Clearly, there is too much space below the second section title. I've played around with \ignorespaces and \ignorespacesafterend, but can't seem to get rid of the extra space. What to do?

• This is because the book class use '\flushbottom'. Put in the command '\raggedbottom' after \begin{document}. Jul 30, 2014 at 9:13
• @Sveinung: I don't think that is the issue. To be sure, I tried adding \raggedbottom after \begin{document}, but this does not resolve anything. Also, I tried what happens when I duplicate the sections, and the problem remains: there is more vertical space under sections with long titles than under the other sections.
– yori
Jul 30, 2014 at 9:38
• I should have written: "It might be because you are using ..." =:-). But Bernhard had a solution! Jul 30, 2014 at 21:08

This is above all due to the bad syntax in:

\titleformat{\section}[block]{\Large\normalfont\bfseries}{#1}{.5em}{}


You've put #1 at the place reserved for formatting the label. A correct syntax would be, e.g.:

\titleformat{\section}[block]{\Large\normalfont\bfseries}{\arabic{section}.}{.5em}{#1}


• Aaaahhhhh how stupid of me. Thanks so much for pointing that out! I've spent so much time on this :)
– yori
Jul 30, 2014 at 9:45
• It's not easy to remember all those parameters. And your code couldn't produce any error message on compiling… The label being actually the title, it added a (invisible, of course) space of 0.5 em on next line. Jul 30, 2014 at 9:53
• Yes, I now realize that replacing .5em by 0pt will do the trick too. Thanks!
– yori
Jul 30, 2014 at 16:41