I'm trying to style my section headers using sectsty, but I can't seem to apply more than one style. This is my code:


If I uncomment the last row, it completely negates that first row. How can I both apply a rules to sections, AND change the font size? Also, how can I do this differently for each section (section, subsection and subsubsection)?

PS: I can't seem to find any documentation on \fontsize, am I using it correctly?

Thanks a bunch!

  • Welcome to TeX SX! With titlesec you can use \titleformat{\section}{...} inside the document. – Bernard Mar 28 at 9:57

\sectionfont will overwrite the default setting AFAIK, so the latter one will make the former one useless. You should put them in the same \sectionfont.

Lorem lipsum

enter image description here

A documentation on the \fontsize command can be found on Wikibooks.

  • Oh yeah I tried this, but in another order: \sectionfont{\sectionrule{0ex}{0pt}{-1ex}{0.1pt}\fontsize{30}{40}\selectfont} and this doesn't work at all. How come? Thanks btw :)! – Zorobay Mar 28 at 9:53
  • @Zorobay (1) You want the rule to be below, right? So you need to add \fontsize... before it. I also think this is pretty strange. (2) If my answer helps, please mark your question as resolved by clicking the checkmark on the left of the answer. – JouleV Mar 28 at 9:58

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.