The display of all my headings in sections, subsections, etc is indented for all lines, like so:

1.1    A very long heading that
       goes over multiple lines.

This starts to look a bit silly when the number of the left is quite long, as it makes the indent very large. I would like to change it so just the first line is indented, i.e. like this:

1.1    A very long heading that
goes over multiple lines.

MWE of the default behaviour (top):

\chapter{The First Chapter}
\section{Example of a very long title with many words that goes over at least two lines}
  • you may find that the result looks a bit silly when only one short word is sent to the second line. also, you should probably consider whether to indent the paragraph that starts after the heading. if it's not indented after a multiline heading, some clarity is lost; but of course, indentation following a one-line heading is ungraceful. Dec 17 '15 at 14:42
  • @barbara beeton All valid points, which I have considered. For a very small second line, I'm going to just take it as it comes, and first see if such a thing ends up occurring in my document at all. If it does, I plan to try adjusting spacing to get things looking a bit more sensible. Not a general solution, but probably an adequate one. I also have some code ready to go to indent paragraphs that follow headings, but I've opted not to use it as it does look ugly after single line headings. I don't feel any clarity is lost though when an unidented paragraph follows a multiline heading.
    – Ulysses
    Dec 18 '15 at 1:08
  • another observation. i don't know whether your headings are set ragged right, but you might consider that. then, when (if?) a very short second line occurs, you can "tie" it to the last word on the first line, forcing that down, without excess spacing in the first line resulting. Dec 18 '15 at 13:15
  • My headings are all justified, as is the body text. If I get a very short last line I'll try adding in a non-breaking space to get another word or two onto the last line, depending on what looks sensible.
    – Ulysses
    Dec 22 '15 at 3:12

This simple code will restrict the indentation of the hanging lines. You may input them before \begin{document}.

      \hangindent 0pt%\wd\@tempboxa

You could find further formatting of section heads in titlesec package.

  • Thank you. This appears to work, but could you expand on your explanation of what this code is doing?
    – Ulysses
    Dec 17 '15 at 7:09
  • 2
    This code finds and puts the dimension to hangindent. In the above amended code, I set it to 0pt which results no indentation. The original code is commented and appear there as %\wd\@tempboxa which is the length of section number and its sep. Dec 17 '15 at 7:26

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.