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:



  \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.

This is rendered as follows:

enter image description here

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}. – Sveinung Jul 30 '14 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 '14 at 9:38
  • I should have written: "It might be because you are using ..." =:-). But Bernhard had a solution! – Sveinung Jul 30 '14 at 21:08

This is above all due to the bad syntax in:


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


enter image description here

| improve this answer | |
  • Aaaahhhhh how stupid of me. Thanks so much for pointing that out! I've spent so much time on this :) – yori Jul 30 '14 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. – Bernard Jul 30 '14 at 9:53
  • Yes, I now realize that replacing .5em by 0pt will do the trick too. Thanks! – yori Jul 30 '14 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.