1

I'm using titlesec to customize the look on sections. I have adjusted these different headings in a nesting manner with lower levels being increasingly indented.

The paragraphs below the headings will not align and I figured I could use \parshape to sort this trouble out, but I can only manage to align the first paragraph after a section - and only if I put the code just before a paragraph (and not in the titlesec definitions).

This is what I have now:

\documentclass{report}
\usepackage{lipsum, xcolor, titlesec}

\setlength\parindent{0em}
\setlength\parskip{1em}
\setlength{\baselineskip}{1.1em}
\renewcommand{\baselinestretch}{1.25}

\titleformat
{\section}%
[hang]%
{\color{blue}\sffamily\large\bfseries}%
{\thesection}%
{0.25em}%
{}%
[\vspace{-1.5em}{\color{blue}\rule{0.75\textwidth}{0.01em}}]%
\titlespacing{\section}{5pt}{2.25em}{0pt}


\begin{document}
\section*{Introduction}
\parshape 1 5pt \dimexpr\linewidth-1cm\relax
\lipsum*[2][1-10]

\lipsum*[3][7-15]

\lipsum*[3][7-15]
\end{document}

This will produce the following output (with my red lines):

incorrect indentation

How can I adjust an arbitrary amount of paragraphs that align with the preceeding section header? I assume I need to add something to the after-code of either titleformat or titlespacing from the titlesec package. But I am unsure how.

Note: While this answer (multiple paragraphs with parshape) touches on the subject, I cannot seem to find out how I can use it in my case.

2
  • 1
    Just to be sure: you want a variable margin? Normal for chapters, somewhat larger for sections, even larger for subsections, and so on?
    – campa
    Feb 16, 2021 at 8:32
  • Yes, that is correct. I will also use titleformat and titlespacing from titlesec for all levels. A switch to reset would also be welcome.
    – Ole Aldric
    Feb 16, 2021 at 8:49

0

You must log in to answer this question.

Browse other questions tagged .