My minimal example looks like this:


\definecolor{shadecolor}{RGB}{230, 230, 230}



which results in


However, if I uncomment the lines to add the titlesec package, the result looks like this


Obviously, \titlespacing{\section}{0mm}{0mm}{0mm} is not enough (or even wrong?) to return to the previous spacing. What are the right commands to make titlesec do this?


titlesec doesn't add spacing. But it adds a strut so that every section has the same height and depth. Compare this here (without titlesec) with a second section with small content:

enter image description here

and this output from titlesec:

enter image description here

  • Oh, okay. Thank you. So, it's a feature then? I guess there is no way to disable this in titlesec other than patching its commands? – finefoot Dec 20 '17 at 23:21
  • 1
    No as far as I can see there is no switch. The \struts are quite fixed (and in various places. But why do want disable it? Imho backgrounds of different sizes would look odd. – Ulrike Fischer Dec 20 '17 at 23:24
  • 1
    A strut is an invisible rule with the height and depth of a line. And it doesn't make sense to ask my "why". I didn't write titlesec. The package author has decided to ensure in various places that the sizes of the objects are the same regardless of the content and if you don't like it you can either define your sectioning command without titlesec, or patch the commands or make a feature request. – Ulrike Fischer Dec 21 '17 at 9:32
  • 1
    Alright, thanks :-) Even if you're not the author of titlesec, you still seem to have a lot of experience with it. Certainly more than I have. So why shouldn't you know something about the "why" I asked? A reason a beginner like me maybe doesn't think of. That's why I asked. :-) – finefoot Dec 21 '17 at 13:56
  • 1
    It's in the to do list. But I'm so busy with babel-- – Javier Bezos Dec 21 '17 at 18:29

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.