[Tex/LaTex] Using Lettrine with short paragraphs

lettrine

I'm trying to create drop caps with the lettrine package, and I'm running into trouble when the first paragraph is too short. It appears that the package only indents the paragraph where it appears, with all lines on subsequent paragraphs being unaffected.

Here's a MWE:

\documentclass{book}
\usepackage{lmodern}
\usepackage{lettrine}

\begin{document}
\lettrine[lines=3]{T}{his} is a short paragraph.

This is a longer one, which fills all the lines taken up by the large letter, but unfortunately is not properly indented to accommodate that letter.
\end{document}

This yields the following bad result:

The second paragraph is typeset in exactly the same place it would normally be, overlapping the large letter.

One solution would be to remove the paragraph break and instead use \\ \hspace*{\parindent}. Is there a more elegant, semantic solution?

Best Answer

enter image description here

Put \zz immediately before the following paragraph and it will extend the cutout if needed.

\documentclass{book}
\usepackage{lmodern}

\newcount\zzc
\makeatletter
\def\zz{%
\ifnum\prevgraf<\c@L@lines
\zzc\z@
\loop
\ifnum\zzc<\prevgraf
\advance\zzc\@ne
\afterassignment\zzda\count@\L@parshape\relax
\repeat
\parshape\L@parshape
\fi}
\def\zzda{\afterassignment\zzdb\dimen@}
\def\zzdb{\afterassignment\zzdef\dimen@}
\def\zzdef#1\relax{\edef\L@parshape{\the\numexpr\count@-1\relax\space #1}}
\makeatother
\usepackage{lettrine}

\begin{document}




\lettrine[lines=3]{T}{his} is a short paragraph.

\zz
This is a longer one, which fills all the lines taken up by the large letter, but unfortunately is not properly indented to accommodate that letter.



\lettrine[lines=3]{T}{his} is not a short paragraph.
This is is not a short paragraph. This is is not a short paragraph.
This is is not a short paragraph. This is is not a short paragraph.
This is is not a short paragraph. This is is not a short paragraph.

\zz
This is a longer one, which fills all the lines taken up by the large letter, but unfortunately is not properly indented to accommodate that letter.
\end{document}
Related Question