如何在 LaTeX 中创建以书法首字母作为章节的文档?

如何在 LaTeX 中创建以书法首字母作为章节的文档?

书籍的章节开头通常会有一个特殊字母(通常跨越两行)。如何在 LaTeX 中创建这个字母?

答案1

LaTeX 伴侣建议看一下lettrine包。但是用法似乎有点复杂,而且需要合适的字体。

如果您还接受 fraktur 字母,那么该yfonts软件包有一个非常简单的解决方案:

\documentclass{article}

\usepackage{yfonts,color}

\begin{document}

\yinipar{\color{red}L}orem ipsum [...]

\end{document}

其结果是yinipar 示例伴侣建议设置段落以\fraklines获得更好的间距。看看你更喜欢哪种。

答案2

我发现这个lettrine软件包使用起来很简单,而且还有自定义选项。文档可从以下网址获取:卡坦。使用 XeLaTeX,所有字体均可用。常用语法是:

\usepackage{lettrine}
...
\lettrine[lines=2]{S}{tart} of the chapter

color也可以使用:

\lettrine[lines=4]{\color{BrickRed}S}{tart} of the chapter

我发现该包不能很好地与 配合使用verse。示例:在此处输入图片描述

答案3

这可能在很多方面都是错误的,但做起来很有趣:-)

\documentclass{minimal}
\font\Cal=cmsy10 at 25pt
\textwidth=.5\textwidth
\def\pstart#1{\noindent\smash{\lower3ex\hbox{\llap{\Cal#1}}\hskip-.2em}
  \parshape=3 1.5em \dimexpr\hsize-1.5em 2em \dimexpr\hsize-2em 0pt \hsize}
  % \parshape x (=number of lines) y (=amount of indent) i (=textwidth) [yi, yi,...]
\begin{document}
\pstart Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus leo felis, ultrices a pretium non, porttitor eget ante. Nunc varius mattis consequat. Praesent interdum, libero quis pulvinar sollicitudin, risus est mollis nulla, ac dignissim eros nibh eget eros. Quisque molestie, turpis quis eleifend gravida, velit elit adipiscing libero, at accumsan ipsum libero a risus. Nunc fermentum pulvinar pellentesque.

\pstart Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam imperdiet ultrices vehicula. Quisque tellus dui, ullamcorper non accumsan vel, tincidunt in nisi. Praesent sit amet risus at lorem egestas vulputate eget vitae sem. Suspendisse lobortis convallis nulla non suscipit. Proin at felis sapien. Vivamus eleifend, diam in hendrerit vestibulum, risus est rutrum tortor, in tincidunt tellus mauris eu ante.

\pstart Donec in leo nunc. Donec facilisis consectetur venenatis. Nam aliquet ipsum quis massa sagittis hendrerit. Fusce mattis nibh et dolor consequat ac pretium nisi ultrices. Vivamus pellentesque adipiscing gravida. Aliquam pellentesque urna eu eros egestas adipiscing. Sed vestibulum pharetra mauris ut eleifend. Praesent et urna a dui eleifend consequat non in odio. Fusce vestibulum dolor at mauris tristique facilisis rhoncus et augue.
\end{document}

在此处输入图片描述

答案4

我同意使用该lettrine软件包的建议,并且yfonts(实际上是s-yfonts)包的建议。事实上,我在排版时同时使用了这两个包绿野仙踪作为给我妻子的礼物:

%% The s-yfonts package is nearly the same as the yfonts package found
%% on CTAN.  The main difference is that s-yfonts allows free scaling
%% to any size.
\usepackage{s-yfonts}
%% Use the Schwabacher black-letter family for titling
\newcommand{\titlefont}{\swabfamily}

\usepackage{lettrine}
\renewcommand{\LettrineFontHook}{\titlefont}

lettrine包的界面很笨拙,因此我构建了一对我认为更易于使用的宏:

\def\LettrineWord#1#2 {\lettrine{#1}{#2} }

\newcommand*{\Lettrine}[2][]{
  \def\tmp##1##2 {\lettrine[#1]{##1}{##2} }
  \tmp#2
}

使用宏的方法如下\Lettrine

\Lettrine{While} the Woodman was making a ladder from wood which he
found in the forest Dorothy lay down and slept, for she was tired by
the long walk.  The Lion also curled himself up to sleep and Toto lay
beside him.

看来我最终没有使用\LettrineWord宏,但我记得我最初的计划是将其添加到宏的定义中\chapter,以便使章节的第一个单词自动具有首字下沉功能。我想我决定不这样做是因为我需要将其中一个章节更改为使用不同的字体:

%% I much prefer the Fraktur `D'.  I really should have a virtual font
%% to do this automatically.

\lettrine{\frakfamily 
D}{orothy} lived in the midst of the great
Kansas prairies, with Uncle Henry, who was a farmer, and Aunt Em, who
was the farmer's wife.  Their house was small, for the lumber to build
...

有人私下问我这个s-yfonts软件包是什么。结果发现,这一定是我自己修改的,因为我自己在网上找不到有关它的任何信息。 vanillayfonts软件包包括以下命令:

\DeclareFontFamily{LYG}{ygoth}{}
\DeclareFontShape{LYG}{ygoth}{m}{n}{%
<10><10.95><12><14.4><17.28><20.74><24.88>ygoth}{}

据我回忆,这将可能的字体大小限制为指定的字体大小。因为我想尝试不同的大小,所以我需要可以自由缩放的字体。因此,我的s-yfonts修改重写了这些行,如下所示:

\DeclareFontFamily{LYG}{ygoth}{}
\DeclareFontShape{LYG}{ygoth}{m}{n}{<-> ygoth}{}

它还补充道:

\usefont{LYG}{\gothdefault}{m}{n}

在样式文件末尾选择 Gothic 字体。这些命令的详细信息可以在字体选择指南

相关内容