TeX 中有这个宏。
在 Yannis Haralambous 于 1990 年举行的 TUG 大会演讲中,https://www.tug.org/TUGboat/tb12-1/tb31hara.pdf在《Initials》第 132 页中,他写道:
\yinitial{D}
为了排版附录 B 的首字母 D,我使用了如下宏(带有zero_depth:=false
)
\def\yinitial#1
{\hangindent=2.54cm
\hangafter=-4
\hskip-3.24cm
\lower-2.7mm
\hbox{\yinit #1}
\hskip1.5mm}
如何在newcommand
LaTeX 中翻译这个宏,以便准确写出与附录 B 中一样漂亮的首字母“D”?
当然,我已经yinitas
正确安装字体了。
答案1
我会使用 lettrine,但为了回答所问的问题,代码应该或多或少地像在乳胶中一样工作,我做了一些间距调整。
\documentclass{article}
\usepackage{kantlipsum}
\font\yinit=yinit at 15pt
\def\yinitial#1{%
\hangindent=2.54cm
\hangafter=-5
\hskip-3.24cm
\smash{\lower1.7cm \hbox{\yinit #1}}%
\hskip1.5mm
}
\begin{document}
\yinitial{D}\textsc{avid uses Yannis' code}. \kant[5]
\end{document}
答案2
我想指出的是,现在有opentype
此字体的一个版本,可以更轻松地在查看器中缩放和放大。以下示例使用,可以使用 或fontspec
进行编译:xelatex
lualatex
\documentclass[a4paper,12pt, twoside]{article}
\usepackage[marginratio={4:6, 5:7}, textwidth=131mm, noheadfoot]{geometry}
\usepackage{fontspec}% font selecting commands%
\defaultfontfeatures{Numbers = {OldStyle, Proportional}, Ligatures = Rare, WordSpace = 1.1}%,2
\setmainfont{Minion Pro}%
\usepackage{polyglossia}
\setmainlanguage[variant = british]{english}%
\newfontface{\yinit}{Yinit}
\usepackage{parskip, nicefrac}
\usepackage[x11names]{xcolor}
\title{\color{Tomato2}\huge\bfseries\addfontfeatures{LetterSpace=1} TO MAKE AN AMBLONGUS PIE}
\author{\Large Edward Lear}
\date{}
\usepackage{lettrine}
\renewcommand{\DefaultLoversize}{0.1}
\setlength\DefaultFindent{0.1em}
\setlength\DefaultNindent{0.25em}
\renewcommand{\LettrineFontHook}{\color{Tan1}\yinit}
\begin{document}
\maketitle
\lettrine{T}{ake} 4 pounds (say 4 \nicefrac{1}{2} pounds) of fresh Amblongusses, and put them in a small pipkin.
\lettrine{C}{over} them with water and boil them for 8 hours incessantly, after which add 2 pints of new milk, and proceed to boil for 4 hours more.
\lettrine{W}{hen} you have ascertained that the Amblongusses are quite soft, take them out and place them in a wide pan, taking care to shake them well previously.
\lettrine{G}{rate} some nutmeg over the surface, and cover them carefully with powdered gingerbread, curry-powder, and a sufficient quantity of Cayenne pepper.
\lettrine{R}{emove} the pan into the next room, and place it on the floor. Bring it back again, and let it simmer for three-quarters of an hour. Shake the pan violently till all the Amblongusses have become a pale purple colour.
\lettrine{T}{hen}, having prepared a paste, insert the whole carefully, adding at the same time a small pigeon, 2 slices of beef, 4 cauliflowers, and any number of oysters.
\lettrine{W}{atch} patiently till the crust begins to rise, and add a pinch of salt from time to time.
\lettrine{S}{erve up} in a clean dish, and throw the whole out of the window as fast as possible.
\end{document}
答案3
使用lettrine
并调整参数,考虑到这yinit
是一个大字体。
\documentclass{article}
\usepackage{lettrine}
\usepackage{kantlipsum}
\renewcommand{\LettrineFontHook}{\usefont{U}{yinit}{m}{n}}
\setcounter{DefaultLines}{4}
\renewcommand{\DefaultLoversize}{-0.75}
\begin{document}
\lettrine{I}{t was} a dark and stormy night. \kant[5]
\end{document}