在 \lettrine 删除大写字母之前立即排版文本

在 \lettrine 删除大写字母之前立即排版文本

如何添加“侧边栏”文本?我知道“侧边栏”这个词可能用得不太好。请告诉我正确的用词是什么。我指的是大写字母左侧的文本(“感恩节”)。

一些见解:我正在努力复制一个1785 年圣公会《公祷书》的 72 页对开本。我这样做是为了好玩,也是为了确保更多人能够轻松阅读 1785 年 BCP 的精彩文章。我是 LaTeX 的新手,只用了几天时间。哦,我使用 ABBYY FineReader Pro 11 进行 OCR 工作。ABBYY 总部那边的好心人需要收到关于人们在旧文档上使用 OCR 的备忘录——他们的程序认为长 s 是 f!

我的代码是:

\documentclass{article}
\usepackage{lettrine}
\usepackage{fontspec}
    \defaultfontfeatures{Ligatures={Historical}}
    \setmainfont[Ligatures={Common,Rare}]{Adobe Caslon Pro}

\begin{document}
   \lettrine{T}{O} our prayers, O Lord, we join our unfeigned thanks for all thy
   mercies; for our being, our reaſon, and all other endowments and faculties of ſoul
   and body; for our health, friends, food, and raiment, and all the other comforts and
   conveniences of life. Above all we adore thy mercy in ſending thy only Son into the
   world to redeem us from ſin and eternal death, and in giving us the knowledge and           
   ſenſe of our duty towards thee. We bleſs thee for thy patience with us, notwithſtanding
   our many and great provocations; for all the directions, aſſiſtances, and comforts of thy
   Holy Spirit; for thy continual care and watchful providence over us through the whole
   courſe of our lives; and particularly for the mercies and benefits of the paſt day:
   Beſecching thee to continue theſe thy bleſſings to us; and to give is grace to ſhow
   our thankfulneſs in a ſincere obedience to his laws through whoſe merits and
   interceſſion we received them all, thy Son our Saviour Jeſus Chriſt. \textit{Amen.}
\end{document}

原版截图 游戏截图(使用 TeXstudio)

谢谢!

PS:正在寻找有关学习 LaTeX(尤其是针对学习障碍人士)和参与此 Stack 的文章。
PPS:我发现“我们感谢您对我们的耐心”这句话真的打动了我。现代 BCP(坦率地说,还有一般的祈祷)很少祝福上帝——它们通常是祈求上帝的祝福。可惜后来的版本中已经删除了这句话。

答案1

这个怎么样:

\documentclass{article}
\usepackage{lettrine}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={Historical}}
\setmainfont[Ligatures={Common,Rare}]{Adobe Caslon Pro}

\newcommand \prelude[1] {\makebox[8em][c]{\em\scriptsize #1.}}

\begin{document}
   \lettrine[ante={\prelude{The Thanksgiving}}, loversize=0.1]{T}{O} 
   our prayers, O Lord, we join our unfeigned thanks for all thy
   mercies; for our being, our reaſon, and all other endowments and faculties of ſoul
   and body; for our health, friends, food, and raiment, and all the other comforts and
   conveniences of life. Above all we adore thy mercy in ſending thy only Son into the
   world to redeem us from ſin and eternal death, and in giving us the knowledge and           
   ſenſe of our duty towards thee. We bleſs thee for thy patience with us, notwithſtanding
   our many and great provocations; for all the directions, aſſiſtances, and comforts of thy
   Holy Spirit; for thy continual care and watchful providence over us through the whole
   courſe of our lives; and particularly for the mercies and benefits of the paſt day:
   Beſecching thee to continue theſe thy bleſſings to us; and to give is grace to ſhow
   our thankfulneſs in a ſincere obedience to his laws through whoſe merits and
   interceſſion we received them all, thy Son our Saviour Jeſus Chriſt. \qquad \textit{Amen.}
\end{document}

答案2

Jon 的上述回答完全正确,但我想添加一个更自动化、更符合 LaTeX 风格的解决方案。LaTeX 就是以逻辑方式标记文档,对吗?使用环境可让您保持文档的整个逻辑块的一致性。

我认为,你所重复的每一个祷告都会有一些共同点:

  • 资本流失
  • 标题位于大写字母左侧(如您的图片所示)
  • 阿门在最后。

让我们以此为基础构建一些东西:

\usepackage{xparse}
\NewDocumentEnvironment{prayer}{m m m}{%
  \lettrine[ante=\prelude{#1}]{#2}{#3}%
}{
  \unskip % removes excess space
  \qquad
  \textit{Amen.}\par
}

这真是太棒了——现在我们可以谈论这样的祷告

\begin{prayer}{The Thanksgiving}{T}{O}
  our prayers, ...
\end{prayer}

并为我们完成所有工作。


请注意,目前我们无法使用loversizeJon 提到的技巧。我们可以将其设置为可选参数,以便实现以下目的:

\usepackage{xparse}
\NewDocumentEnvironment{prayer}{O{} m m m}{%
  \lettrine[ante=\prelude{#2},#1]{#3}{#4}%
}{
  \unskip % removes excess space
  \qquad
  \textit{Amen.}\par
}

现在我们也可以看起来很漂亮了!

\begin{prayer}[loverline=.15]{The Thanksgiving}{T}{O}
  our prayers, ...
\end{prayer}

如果我们想要能够选择性地定义“侧边栏”的宽度(我也不知道该怎么称呼它……)该怎么办?您无法使用\newcommand (或其朋友newenvironment)定义两个可选参数,但xparse可以这样做:

\usepackage{xparse}
\NewDocumentEnvironment{prayer}{O{} m O{8em} m m}{%
  % note I've taken out \prelude now; it is no longer general enough.
  \lettrine[ante={\makebox[#3][c]{\itshape\scriptsize #2.}}, #1]{#4}{#5}%
}{
  \unskip
  \qquad
  \textit{Amen.}\par
}

事实上,xparse它非常强大:它可以定义一些非常方便的语法非常很容易。(参见texdoc xparse,特别是第 2 页。)考虑完整的例子我仍在玩弄

% xelatex bcp.tex
% pdfcrop bcp.pdf
% convert  -density 600 bcp-crop.pdf bcp.png
\documentclass{article}
\usepackage{lettrine}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={Historical}}
\setmainfont[Ligatures={Common,Rare}]{Hoefler Text}
% Unfortunately, I do not own Caslon Pro

\usepackage{xparse}

% Starts an environment like this:
%
%   \begin{prayer}[extra options for lettrine]%
%                 {'sidebar' text}%
%                 [width of sidebar]
%     Dropped text \endl no longer dropped
%   \end{prayer}
%
%   Will automatically drop the first letter encountered and continue
%   the \lettrine until an \endl is encountered.
\NewDocumentEnvironment{prayer}{O{} m O{8em} m u{\endl}}{%
  \lettrine[ante={\raisebox{.5ex}
                 {\makebox[#3][c]{\itshape\scriptsize #2.}}},
            #1]%
           {#4}{#5}%
}{
  \unskip
  \qquad
  \textit{Amen.}\par
}
\pagestyle{empty}
\begin{document}
\begin{prayer}[loversize=.15]{The Thankſgiving}
  TO \endl our prayers, O Lord, we join our unfeigned thanks for all thy mercies;
  for our being, our reaſon, and all other endowments and faculties of
  ſoul and body; for our health, friends, food, and raiment, and all
  the other comforts and conveniences of life.  Above all we adore thy
  mercy in ſending thy only Son into the world to redeem us from ſin
  and eternal death, and in giving us the knowledge and ſenſe of our
  duty towards thee.  We bleſs thee for thy patience with us,
  notwithſtanding our many and great provocations; for all the
  directions, aſſiſtances, and comforts of thy Holy Spirit; for thy
  continual care and watchful providence over us through the whole
  courſe of our lives; and particularly for the mercies and benefits
  of the paſt day: Beſecching thee to continue theſe thy bleſſings to
  us; and to give is grace to ſhow our thankfulneſs in a ſincere
  obedience to his laws through whoſe merits and interceſſion we
  received them all, thy Son our Saviour Jeſus Chriſt.
\end{prayer}
\end{document}

得出以下结果:

输出

(我做的唯一额外更改是将“侧边栏”文本略微提高\raisebox。我认为这样看起来更接近一些。)

答案3

Sean 解决方案的变体,语法简化;“前奏”文本作为选项提供\lettrine,只需定义一个新键即可。默认情况下,此前奏的宽度为自然宽度,两端由一个四边形包围。prewidth可以给出一个键来更改此宽度,如示例所示。

该标准loversize可以在序言中进行修改,因此没有必要在每次使用时都指定它。

\documentclass{article}
\usepackage{lettrine}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={Historical}}
\setmainfont[Ligatures={Common,Rare}]{Hoefler Text}
% Unfortunately, I do not own Caslon Pro

\makeatletter
\define@key{L}{prelude}{%
  \renewcommand*{\L@ante}{%
    \quad\makebox[\L@prewidth][c]{\em\scriptsize #1.}\quad
  }%
}
\define@key{L}{prewidth}{\renewcommand*{\L@prewidth}{#1}}
\newcommand{\L@prewidth}{\width}
\renewcommand{\DefaultLoversize}{0.15}
\makeatother

\usepackage{xparse}

\NewDocumentEnvironment{prayer}{O{}mm}{%
  \lettrine[#1]{#2}{#3}%
}{%
  % if you want the Amen at a quad from the last word
  \unskip\nolinebreak\qquad\textit{Amen.}\par
  % if instead you want the Amen at the right margin
  % comment the line above and uncomment the following three lines
  %{\nobreak\hfill\penalty50\hskip1em\null\nobreak
  % \hfill\textit{Amen.}%
  % \parfillskip=0pt \finalhyphendemerits=0 \par}%
}

\begin{document}

\begin{prayer}[prelude=The Thankſgiving]{T}{O}
our prayers, O Lord, we join our unfeigned thanks for all thy mercies;
for our being, our reaſon, and all other endowments and faculties of
ſoul and body; for our health, friends, food, and raiment, and all
the other comforts and conveniences of life.  Above all we adore thy
mercy in ſending thy only Son into the world to redeem us from ſin
and eternal death, and in giving us the knowledge and ſenſe of our
duty towards thee.  We bleſs thee for thy patience with us,
notwithſtanding our many and great provocations; for all the
directions, aſſiſtances, and comforts of thy Holy Spirit; for thy
continual care and watchful providence over us through the whole
courſe of our lives; and particularly for the mercies and benefits
of the paſt day: Beſecching thee to continue theſe thy bleſſings to
us; and to give is grace to ſhow our thankfulneſs in a ſincere
obedience to his laws through whoſe merits and interceſſion we
received them all, thy Son our Saviour Jeſus Chriſt.
\end{prayer}

\begin{prayer}[prewidth=6em,prelude=The Thankſgiving]{T}{O}
our prayers, O Lord, we join our unfeigned thanks for all thy mercies;
for our being, our reaſon, and all other endowments and faculties of
ſoul and body; for our health, friends, food, and raiment, and all
the other comforts and conveniences of life.  Above all we adore thy
mercy in ſending thy only Son into the world to redeem us from ſin
and eternal death, and in giving us the knowledge and ſenſe of our
duty towards thee.  We bleſs thee for thy patience with us,
notwithſtanding our many and great provocations; for all the
directions, aſſiſtances, and comforts of thy Holy Spirit; for thy
continual care and watchful providence over us through the whole
courſe of our lives; and particularly for the mercies and benefits
of the paſt day: Beſecching thee to continue theſe thy bleſſings to
us; and to give is grace to ſhow our thankfulneſs in a ſincere
obedience to his laws through whoſe merits and interceſſion we
received them all, thy Son our Saviour Jeſus Chriſt.
\end{prayer}

\begin{prayer}[prewidth=8em,prelude=The Thankſgiving]{T}{O}
our prayers, O Lord, we join our unfeigned thanks for all thy mercies;
for our being, our reaſon, and all other endowments and faculties of
ſoul and body; for our health, friends, food, and raiment, and all
the other comforts and conveniences of life.  Above all we adore thy
mercy in ſending thy only Son into the world to redeem us from ſin
and eternal death, and in giving us the knowledge and ſenſe of our
duty towards thee.  We bleſs thee for thy patience with us,
notwithſtanding our many and great provocations; for all the
directions, aſſiſtances, and comforts of thy Holy Spirit; for thy
continual care and watchful providence over us through the whole
courſe of our lives; and particularly for the mercies and benefits
of the paſt day: Beſecching thee to continue theſe thy bleſſings to
us; and to give is grace to ſhow our thankfulneſs in a ſincere
obedience to his laws through whoſe merits and interceſſion we
received them all, thy Son our Saviour Jeſus Chriſt.
\end{prayer}
\end{document}

因此 的语法\begin{prayer}与 的语法相同\lettrine

“Amen” 设置在距最后一个单词两个四边形的位置(不允许换行);如果需要,代码中显示了如何将其推到右边距。

在此处输入图片描述

对于两行前奏,可以这样做:将代码从\makeatletter到替换\makeatother

\usepackage{varwidth}
\makeatletter
\define@key{L}{prelude}{%
  \renewcommand*{\L@ante}{%
    \quad
    \makebox[\L@prewidth][c]{%
      \begin{varwidth}[t]{12em}
      \em\scriptsize #1.
      \end{varwidth}%
    }\quad
  }%
}
\define@key{L}{prewidth}{\renewcommand*{\L@prewidth}{#1}}
\newcommand{\L@prewidth}{\width}
\renewcommand{\DefaultLoversize}{0.15}
\makeatother

然后输入

\begin{prayer}[
  prelude=The Thankſgiving\\ and Chriſtmas
]{T}{O}
our prayers, O Lord, we join our unfeigned thanks for all thy mercies;
for our being, our reaſon, and all other endowments and faculties of
ſoul and body; for our health, friends, food, and raiment, and all
the other comforts and conveniences of life.  Above all we adore thy
...
\end{prayer}

(请注意,最好标出换行符)将产生

在此处输入图片描述

相关内容