了解 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}

在此輸入影像描述

相關內容