5

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?

  • it would be possible (using code based on the code wrapfig used to re-start a cut out on a new paragraph) but it's rather rare to use drop caps on such small paragraphs so I haven't seen this implemented. – David Carlisle May 15 '17 at 16:47
  • You wrote, "...the package only indents the paragraph where it appears, with all lines on subsequent paragraphs being unaffected'. That's correct. TeX's paragraph-building algorithm typesets one paragraph at a time: Once a new paragraph is started, TeX knows (almost) nothing about what when on in the preceding paragraph(s). A separate thought: You may want to ask yourself if you're abusing or misusing the lettrine package. What exactly are you trying to achieve by having a drop-cap letter that spans three rows if the paragraph has only one row? – Mico May 15 '17 at 16:48
  • @Mico: I'm typesetting a book with drop-caps at the start of each chapter. Just a few of the chapters present this problem. – FriendOfFred May 15 '17 at 16:51
  • 2
    IMNSHO, a three-row lettrine makes little or no typographic sense if the associated paragraph doesn't have at least 5 or 6 lines. If the chapter's opening paragraph spans only 1 or 2 lines, do you have the option to place the lettrine in the second paragraph (assuming, naturally, that the 2nd paragraph spans 5 or more lines...)? – Mico May 15 '17 at 16:56
  • Is it your own document? Or are you typesetting for someone else? I'm quite willing to use short paragraphs (on a logical division basis) but can't see a good solution to make them nice with drop caps. – Chris H May 15 '17 at 17:03
  • It has to be the first paragraph, and the first letter does need to be emphasized. But I could give up on the drop-caps and just use a large letter with the same baseline as the first line of text. – FriendOfFred May 15 '17 at 17:06
  • I suspect it would be more reasonable to just start the second paragraph lower down (that is automatically or manually add \vspace{2\baselineskip}) indenting a new paragraph around a drop cap from a word in a previous paragraph seems a bit odd. – David Carlisle May 15 '17 at 17:29
  • @Mico Whether it makes typographic sense depends what you are trying to achieve. This looks pretty good typography to me, even if it was made 400 by hand years ago: https://archive.org/stream/holybiblefacsimi00polluoft#page/n224/mode/1up – alephzero May 15 '17 at 17:43
  • @DavidCarlisle I thought about suggesting that as a least worst option. At the end of a paragraph does LaTeX know how many lines it's output? So could it be automated? – Chris H May 15 '17 at 17:43
  • 1
    @ChrisH yes, yes (\prevgraf) – David Carlisle May 15 '17 at 17:55
  • 1
    @alephzero - To compare the hand-made drop-cap letters -- really, sumptuous and stupendous works of art in their own right! -- of late medieval and early modern era books with what can be produced by the lettrine package is to go rather deep into apples-to-oranges-comparison territory. My comment was aimed at a much more modest level, i.e., it was meant to address what can be done with LaTeX and, in particular, the lettrine package. I thought this was obvious; however, apparently this wasn't the case. I'm truly sorry for having misled you and for having wasted your time. – Mico May 15 '17 at 17:58
  • I understand, though, that lettrine can be used for drop-caps that are as sumptuous as you like, using the image option. – FriendOfFred May 15 '17 at 18:04
  • 3
    @Mico fortunately my macros are sumptuous and stupendous works of art in their own right as well:-) – David Carlisle May 15 '17 at 19:08

2 Answers2

9

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}
David Carlisle
  • 757,742
  • This is fantastic (as usual!). However, to get the same indentation as for a normal paragraph, I had also to set \setlength{\DefaultNindent}{0em} (equivalently, nindent=0em as an option to \lettrine). I also renamed the macros; maybe that would be a good idea for more general use? – Reuben Thomas Jun 15 '17 at 05:37
  • Even better would be to make the code subtract \DefaultNindent from the indent used. – Reuben Thomas Jun 15 '17 at 06:32
4

I once had a requirement to build multiple complicated parshapes, each of which had to span multiple paragraphs. I didn't want to define a parshape per paragraph, as that would have been a lot more work.

I don't remember anymore where this came from, I don't claim any credit for this, but you can actually "fake" a \par command by doing:

\def\Fpar{\hfil\vadjust{\vskip\parskip}\break\indent}

As lettrine seems to use \parshape internally, this solution also works for your requirement.

MWE:

\documentclass{book}
\usepackage{lmodern}
\usepackage{lettrine}
\def\Fpar{\hfil\vadjust{\vskip\parskip}\break\indent}
\begin{document}
\lettrine[lines=3]{T}{his} is a short paragraph.\Fpar
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}

Output:

enter image description here

The reason why this works seems to be that, while \Fpar produces the same document output as a \par would, it is not recognized by \parshape as being the end of a paragraph, and thus the \lettrine command has more text to work with.

takrl
  • 471