TransWikia.com

Align following paragraphs with heading indent

TeX - LaTeX Asked by Ole Aldric on June 2, 2021

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}

setlengthparindent{0em}
setlengthparskip{1em}
setlength{baselineskip}{1.1em}
renewcommand{baselinestretch}{1.25}

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


begin{document}
section*{Introduction}
parshape 1 5pt dimexprlinewidth-1cmrelax
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.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP