[Tex/LaTex] Difference between setting parindent and hangindent

indentationluatexparagraphstex-core

Is there a difference between setting

  • \parindent to 1em

and to setting

  • \parindent to 0em, \hangindent to 1em, and \hangafter to -1

that shows in practical use? The nodes created by TeX are different, but does that show in typesetting at one point? One difference that I see is that the hang* settings are paragraph-local, but I don't care about that because I create every paragraph using LuaTeX's tex.linebreak()

This question is specific about LuaTeX, but I guess the answer applies to all engines.

Sample code:

\documentclass{article}
\begin{document}
\linewidth 300pt

\newcommand\text{A wonderful serenity has taken possession of my entire soul, like
these sweet mornings of spring which I enjoy with my whole heart. I am
alone, and feel the charm of existence in this spot, which was created
for the bliss of souls like mine. I am so happy, my dear friend, so
absorbed in the exquisite sense of mere tranquil existence, that I
neglect my talents.}

\text

\hangindent=\parindent
\parindent 0pt
\hangafter=-1
\text

\end{document}

Best Answer

LaTeX list environments use \parshape (for which \hangafter is a shorthand essentially) so the behaviour there is likely to be different.

But perhaps the first difference to bite is that LaTeX's mechanism to suppress paragraph indentation after section headings (and after mid-paragraph display environments) removes the parindent node but won't see hangafter.

Compare:

\section{aaa}

\text

in the two cases.