我想在pdfLaTeX中找到一种方法来生成首字母大写字母(大行首字母高几行)。我知道有一个 drops 包,当与 latex + dvips 一起使用时效果很好。但是,当与 pdflatex 一起使用时,结果看起来很难看。

我的源文件是:

\documentclass[12pt]{article}

% for pdflatex file.tex # dropping is ugly
% \usepackage[pdftex]{graphicx}
% \usepackage[pdftex]{dropping}

% for latex file.tex ; dvips -T 12cm,8cm file.dvi # dropping is OK
\usepackage[dvips]{graphicx}
\usepackage{dropping}

\usepackage[papersize={12cm,8cm},
    left=0.5cm,right=0.5cm,
    top=0.5cm,bottom=0.5cm]{geometry}

\begin{document}
\dropping[-3pt]{3}{W}ith a drop cap, the initial sits within the margins and
runs several lines deep into the paragraph, pushing some normal-sized text off
these lines. This keeps the left and top margins of the paragraph flush.
In~modern browsers, this can be done with a combination of HTML and CSS
by~using the float: left; setting.
\end{document}

当我将其编译为

latex drop.tex && dvips -T 12cm,8cm drop.dvi

结果还可以:

当我取消注释 [pdftex] 行并将其编译为

pdflatex drop.tex

结果是:

有人能建议使用 pdflatex 制作首字下沉的更好方法吗?

有帮助吗?

解决方案

非常感谢您快速回复!实际上,hop和Charlie Martin的评论都很有用。 lettrine.sty 是一个很棒的软件包,如果使用可扩展字体,它就可以正常工作。

因此,解决方案是强制键入1 CM字体而不是默认CM 使用 lettrine.sty lettrine.sty 文档建议 \ usepackage {type1cm}

这有效:

\documentclass[12pt]{article}

% works with pdfLaTeX
\usepackage{type1cm} % scalable fonts
\usepackage{lettrine}

\usepackage[papersize={12cm,4cm},
    left=0.5cm,right=0.5cm,
    top=0.5cm,bottom=0.5cm]{geometry}

\begin{document}
\lettrine[lines=3,slope=-4pt,nindent=-4pt]{W}{ith} a drop cap, the initial sits
within the margins and runs several lines deep into the paragraph, pushing some
normal-sized text off these lines. This keeps the left and top margins of the
paragraph flush.  In~modern browsers, this can be done with a combination of
HTML and CSS by~using the float: left; setting.
\end{document}

这就是结果:

谢谢!

PS。即使使用 type1cm dropped 也无法正常工作。

UPD。此示例也适用于 xelatex

其他提示

尝试另一种字体,一种带缩放的字体;这看起来像PDF没有为cap-W找到足够大的字体并且正在替换。另一种选择是使用dvi-to-PDF翻译。

提到 jetxee 时,必须使用可缩放字体才能获得最初的正确尺寸。如果您更改默认字体,则无需执行任何操作即可实现。

由于历史原因,默认的CM字体被加载到“快照”按钮。特定尺寸,而不是任何缩放尺寸的可加载。这是从使用原始Metafont源时开始,当不同的字体大小改变了字形的实际形状(谷歌光学尺寸为好奇)。

使用CM字体修复此问题的规范解决方案是加载 fix-cm 包。包 type1cm 是一个较旧的包,它基本上做同样的事情。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top