Lettrine + Stackengine:资本流失的错误安排

Lettrine + Stackengine:资本流失的错误安排

lettrine已更新: 2.01 版不再存在此问题

奇怪的是,几个月来(如果不是几年的话),这对我来说一直工作正常,然而我已经能够将我的问题归结为 MWE,并且似乎包括stackengine(无论是否使用)都会导致lettrine放错位置。

使用 stackengine 渲染注释掉的内容: stackengine 注释掉了

包含 stackengine 后: 包含 stackengine

梅威瑟:

\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 在各个地方使用 \global\setlength,它依赖于与 calc 包不起作用的副作用。

经过一些修改后它又可以正常工作:

\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}

在此处输入图片描述

相关内容