
如何新增「側邊欄」文字?我知道「側邊欄」這個詞可能用錯了。請讓我知道正確的術語是什麼。我指的是大寫字母左側的文字(“感恩節”。)
一些見解:我正在努力複製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}
謝謝!
PS:尋找有關學習 LaTeX(尤其是對於患有 LD 的人)並參與此堆疊的文章。
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-y 解決方案實現。 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}
並為我們完成所有這些工作。
請注意,現在我們無法使用loversize
喬恩提到的那個技巧。我們可以將其作為一個可選參數來允許:
\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
。
「阿門」設置在距離最後一個字兩個四邊形處(不允許換行);在程式碼中,它顯示如何將其推到右邊距(如果需要)。
對於兩行前奏,有一種可能性:將程式碼 from替換\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}
(注意最好標出換行符)會產生