了解 lettrine.sty 及其配置方法

了解 lettrine.sty 及其配置方法

以下代码有两个段落,每个段落都有一个字母。为什么它们的格式不同?第二个段落有所需的代码(带有配置命令),但只有第一个段落产生了所需的输出(但每次使用时都需要添加一长串命令)。

为什么会发生这种情况?我希望使用第二段的配置方法获得所需的输出。提前感谢您的帮助。(我使用的是 texlive 2014 中包含的 lettrine ver1.64)

\documentclass{book} 
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}     
\usepackage{lettrine}

\LettrineOptionsFor{W}{lines=3,lhang=0.070,findent=.40em,nindent=-0.3em,slope=-0.40em}
\setcounter{DefaultLines}{3}

\begin{document}

\lettrine[lines=3,lhang=0.070,findent=.40em,nindent=-0.3em,slope=-0.40em]{W}{\rm
  hat}
are interactions? At the start of this volume, when we summarized\linebreak
hat relates the Planck units to relativity and to quantum theory,\linebreak e
pointed out that the nature of interactions at Planck scales was still in the
dark. In this chapter ...

\lettrine{W}{\rm hat} are interactions? At the start of this volume, when we
summarized\linebreak hat relates the Planck units to relativity and to quantum
theory,\linebreak e pointed out that the nature of interactions at Planck
scales was still in the dark. In this chapter ...

\end{document}

答案1

你必须添加以下行

\LettrineOptionsFor{W}{lines=3,lhang=0.070,findent=.40em,nindent=-0.3em,slope=-0.40em}

在配置文件中(W.cfl比如说)然后调用

\renewcommand{\DefaultOptionsFile}{W.cfl}

您可以这样做:

\usepackage{filecontents}
\begin{filecontents}{W.cfl}
\LettrineOptionsFor{W}{lines=3,lhang=0.070,findent=.40em,nindent=-0.3em,slope=-0.40em}
\end{filecontents}

\renewcommand{\DefaultOptionsFile}{W.cfl}

在您的 tex 文件中。另请注意,\rm(所有两个字母的字体更改命令\bf,如\it等)已被弃用。要实现此效果,您可以使用

\renewcommand{\LettrineTextFont}{\normalfont}

在你的序言中。

代码:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{lettrine}

\usepackage{filecontents}
\begin{filecontents}{W.cfl}
\LettrineOptionsFor{W}{lines=3,lhang=0.070,findent=.40em,nindent=-0.3em,slope=-0.40em}
\end{filecontents}

\renewcommand{\DefaultOptionsFile}{W.cfl}
\renewcommand{\LettrineTextFont}{\normalfont}

\begin{document}

\lettrine[lines=3,lhang=0.070,findent=.40em,nindent=-0.3em,slope=-0.40em]{W}{hat}
are interactions? At the start of this volume, when we summarized\linebreak
hat relates the Planck units to relativity and to quantum theory,\linebreak e
pointed out that the nature of interactions at Planck scales was still in the
dark. In this chapter ...

\lettrine{W}{hat} are interactions? At the start of this volume, when we
summarized\linebreak hat relates the Planck units to relativity and to quantum
theory,\linebreak e pointed out that the nature of interactions at Planck
scales was still in the dark. In this chapter ...

\end{document}

在此处输入图片描述

相关内容