I would like to format sections/subsections/etc. so that the entire body text of subsections is indented relative to the body text of the parent section as it is for nested lists, i.e.
1. Section heading. Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
a. Subsection heading. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur.
I am currently using the titlesec
package to achieve the run-in section heading with the following macros:
\titleformat{\section}[runin]{\normalfont\bfseries}{\thesection.}{.5em}{}[\quad]
\titleformat{\subsection}[runin]{\normalfont\bfseries}{\thesubsection.}{.5em}{}[\quad]
\titlespacing{\subsection}{\parindent}{*2}{\wordsep}
The resulting output looks like this:
1. Section heading. Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
a. Subsection heading. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur.
I've tried using the hanging
package and the underlying \hangindent
and \hangafter
commands in the \titleformat
definitions, but nothing I've tried has produced the desired results.
Best Answer
Not really. In theory, the
\section
command could be rewritten to adjust the page layout, but that would not be fun. Also, it could be ambiguous, sometimes, where sections end. I recommend instead something like the following, where you redefine the section headings into environments and then change the margins with the changepage package. .Changing the formatting of the section headings can be done, as you mention, with titlesec.