Is there a way to dynamically size titles as part of a \titleformat (from the titlesec package) definition? I'd like to scale titles of different lengths to be the same width (relative to \textwidth) by only changing fontsize.

The answers to this question describe how to resize text in a similar way, but I'm not sure how this could be used to redefine/extend the section titles. (e.g. as a part of \titleformat*{\subsection} ...)

  • Did you try to use \resizebox? – Sigur May 21 '15 at 10:13
  • @Sigur not sucessfully. how would it work? – zzkt May 21 '15 at 11:00
  • 1
    For instance, you'd want that \section{Abc} and \section{Abc def ghi jkl} typeset the text filling the same width? – egreg May 21 '15 at 15:14
  • @egreg. correct. – zzkt May 22 '15 at 8:24
  • It doesn't seem like a good idea. – egreg May 22 '15 at 8:39

It doesn't seem like a good idea.






\section{Def ghi klm}

\section{Lorem ipsum dolor sit amet}


enter image description here

One could scale also the numbers, but the overall result doesn't seem worthy a try.

  • thanks for providing an answer, despite your reservations. it works as expected. – zzkt May 22 '15 at 8:57

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.