2

I'm writing a book document with large font chapter/section/subsection titles that often get pushed into two lines. When that happens, it (logically) just pushes the word that doesn't fit into the first line anymore into the second line. While proper for regular text, within titles that creates an off-putting balance where the first line of the title is much longer than the second one.

I would like to tell LaTeX that if it has to use multiple lines, it should populate the lower lines first so that the bottom line will be longer than the ones above.

So instead of

 The enormous 
 Title

I want it to be

The
enormous Title

I'm writing it as a template/class, so I won't necessarily know what's going to be in the title, so manual linebreaks aren't convenient.

3

You probably want something like styleB as used in 5 and 7. This is like \raggedright but restricts the amount of stretch on the last line.

enter image description here

\documentclass{article}

\newcommand\styleA{\raggedright\parfillskip=-\rightskip\relax}

\newcommand\styleB{\rightskip=0pt plus .8\hsize\relax \parfillskip=0pt plus-.7\hsize\relax}
\begin{document}

1 \fbox{\parbox{5cm}{A Very Long Title with lots of Words}}

2 \fbox{\parbox{5cm}{\raggedright A Very Long Title with lots of Words}}

3 \fbox{\parbox{5cm}{\centering A Very Long Title with lots of Words}}

4 \fbox{\parbox{5cm}{\styleA A Very Long Title with lots of Words}}

5 \fbox{\parbox{5cm}{\styleB A Very Long Title with lots of Words}}

6 \fbox{\parbox{5cm}{\styleA A short title}}

7 \fbox{\parbox{5cm}{\styleB A short title}}

\end{document}
|improve this answer|||||

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.