# Parshape has no effect inside group

In the MWE below the \parshape command behaves as expected. However if you add grouping (by uncommenting the two lines marked with a (*)) then it seems to have no effect! How do I make it behave like it does in the ungrouped setting when inside a group? (By the way, the reason I want a group is that I want to use commands like \small and have it reset automatically when I'm done.)

\documentclass{article}

\begin{document}

%{ % (*)
\def\wide{0em \linewidth}
\def\narrow{5em \dimexpr\linewidth-5em}

\parshape3 \wide\narrow\wide
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec cursus turpis et leo mollis, ac efficitur nulla vehicula.
Ut vel dolor sit amet libero tempus consequat.
Aliquam non auctor leo.
Ut auctor lacinia nisi.
Duis id venenatis quam, ut suscipit libero.
Curabitur nisi enim, vehicula et massa quis, pharetra tincidunt nisi.
Morbi luctus nibh urna, suscipit rhoncus mi sodales quis.
%} % (*)

\end{document}

• You need a \par before the closing } in the group. – Alan Munn Oct 30 '17 at 2:09
• @AlanMunn is my answer too bad to keep it? Do you suggest to delete? Edit: Deleted... I opened a second group instead of closing the old... – koleygr Oct 30 '17 at 2:12
• @koleygr Yes. Commands like \parshape, \centering and font switches need to see the end of a paragraph, so you need a \par to end them. – Alan Munn Oct 30 '17 at 2:13
• The paragraph ended outside the group. You don't have to add \par inside the group; you can also just add a blank line. – ShreevatsaR Oct 30 '17 at 3:58
• @ShreevatsaR I agree, although in this case, the \par makes things clearer, I think. – Alan Munn Oct 30 '17 at 5:26

Various things that affect the typesetting of a paragraph, such as \parshape (but also other things like \centering, \baselineskip, \leftskip) only come into effect at the end of a paragraph. This means that if a paragraph is set inside a group, you must explicitly end the paragraph inside the group with a \par or a blank line.

\documentclass{article}

\begin{document}

{ % (*)
\def\wide{0em \linewidth}
\def\narrow{5em \dimexpr\linewidth-5em}

\parshape3 \wide\narrow\wide
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec cursus turpis et leo mollis, ac efficitur nulla vehicula.
Ut vel dolor sit amet libero tempus consequat.
Aliquam non auctor leo.
Ut auctor lacinia nisi.
Duis id venenatis quam, ut suscipit libero.
Curabitur nisi enim, vehicula et massa quis, pharetra tincidunt nisi.
Morbi luctus nibh urna, suscipit rhoncus mi sodales quis.
\par
} % (*)

\end{document}