\midsloppy 和 \lettrine 效果不佳

\midsloppy 和 \lettrine 效果不佳

我的问题与字母后面的小型大写字母的字间距有关。我希望它能与其余文本一起流动和换行,但事实并非如此。

以下是 MWE:

MWE 渲染

\documentclass[smalldemyvopaper,12pt,twoside,onecolumn,openany,extrafontsizes]{memoir}
\usepackage[osf]{Alegreya,AlegreyaSans}
\usepackage{lettrine}
\midsloppy
\checkandfixthelayout
\begin{document}
\mainmatter
\lettrine{E}{xample text that is quite long but not} too long, to demonstrate the weird word spacing that occurs when using the small caps feature.
\end{document}

请注意“not”和“too”之间的间距有很大不同。

如果我删除\midsloppy,那么它看起来会更好,但这并不是真正的修复,因为我的文档的其余部分因溢出的文字而被破坏。

答案1

的第二个参数\lettrine是带框的,因此其中的空格不灵活。

\documentclass[smalldemyvopaper,12pt,twoside,onecolumn,openany,extrafontsizes]{memoir}
\usepackage[osf]{Alegreya,AlegreyaSans}
\usepackage{lettrine}

\newcommand{\longlettrine}[3]{%
  \lettrine{#1}{#2} {\LettrineTextFont #3}%
}

\midsloppy
\checkandfixthelayout

\begin{document}

\mainmatter
\longlettrine{E}{xample}{text that is quite long but not} too long, to demonstrate
the weird word spacing that occurs when using the small caps feature.

\end{document}

在此处输入图片描述

相同,但使用原始语法:我们将其改为\usebox{\L@tbox}\unhbox\L@tbox因此框中的空格恢复了其灵活性。

\documentclass[smalldemyvopaper,12pt,twoside,onecolumn,openany,extrafontsizes]{memoir}
\usepackage[osf]{Alegreya,AlegreyaSans}
\usepackage{lettrine}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\@lettrine}
 {\usebox{\L@tbox}}
 {\unhbox\L@tbox}
 {}{}
\makeatother

\midsloppy
\checkandfixthelayout

\begin{document}

\mainmatter
\lettrine{E}{xample text that is quite long but not} too long, to demonstrate
the weird word spacing that occurs when using the small caps feature.

\end{document}

相关内容