5

Updated: No longer an issue with lettrine 2.01

Weirdly, this has been working fine for me for months (if not years), however I've been able to boil down my issue to a MWE and it appears that including stackengine (whether it is used or not) causes the lettrine to be misplaced.

Rendering with stackengine commented out: stackengine commented out

With stackengine included: stackengine included

MWE:

\documentclass{paper}

%%%----------------------------------------------------------------------------

%\usepackage{stackengine}
\usepackage{lettrine}

%%%----------------------------------------------------------------------------

\begin{document}

\lettrine{J}{ohn Doe} was born in 1857 and lived until he was very old and moved around a lot. And so it was that blah blah blah.... Several years and words later this paragraph ends.

\end{document}
1
  • lettrine uses faulty code (\global\setlength) which doesn't work if the calc package is loaded. Jul 31, 2018 at 8:59

1 Answer 1

6

lettrine uses in various places \global\setlength which relies on a side effect that doesn't work with the calc package.

With some changes it works again:

\documentclass{paper}

%%%----------------------------------------------------------------------------

\usepackage{stackengine}
\usepackage{lettrine}
\makeatletter
\def\Lettrine@height{%
   \ifvoid\L@tbox
     \sbox{\L@tbox}{\LettrineTextFont{\LettrineSecondString}}%
   \fi
   \setlength{\L@target@ht}{\ht\L@tbox}%
   \@tempdima=\baselineskip
   \setlength{\L@target@dp}{\value{L@lines}\@tempdima}%
   \ifnum\value{L@lines}>1
     \addtolength{\L@target@dp}{-\@tempdima}%
   \else
     \addtolength{\L@target@ht}{\L@target@dp}%
     \setlength{\L@target@dp}{0pt}%
   \fi
   \setlength{\L@target@tht}{\L@target@ht}%
   \addtolength{\L@target@tht}{\L@target@dp}%
   \global\L@target@ht=\L@target@ht
   \global\L@target@dp\L@target@dp
   \global\L@target@tht\L@target@tht
   \setlength{\L@height}{\L@target@tht}%
   \addtolength{\L@height}{\L@oversize\L@target@tht}%
}
\makeatother
%%%----------------------------------------------------------------------------

\begin{document}

\lettrine{J}{ohn Doe} was born in 1857 and lived until he was very old and moved around a lot. And so it was that blah blah blah.... Several years and words later this paragraph ends.

\end{document}

enter image description here

9
  • Thanks, however this seems to completely disable any lraise setting I make -- \lettrine[lraise=___]{J}{ohn Doe}
    – meide
    Jul 31, 2018 at 9:14
  • 2
    Ah sorry, I overlooked the \L@target@tht (with the t). I will add it. Jul 31, 2018 at 9:18
  • 1
    lettrine is maintained, so you should notify the author. Jul 31, 2018 at 9:22
  • 3
    @Ulrike Fisher: thanks for the patch, I'll issue a corrected version (2.01) of the lettrine package today. Jul 31, 2018 at 9:51
  • 2
    Thank you for vindicating stackengine, LOL. +1! Jul 31, 2018 at 19:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .