pdfLaTeX 中的首字下沉
我想找到一种在 pdfLaTeX 中生成首字下沉(大写字母几行高)的方法。 我知道有一个 dropping
包与 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 生成首字下沉?
I want to find a way to produce drop caps (large initial letters several lines high) in pdfLaTeX. I know that there is a dropping
package which works well when used with latex
+ dvips
. However, when used with pdflatex
the result looks ugly.
My source file is:
\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}
When I compile it as
latex drop.tex && dvips -T 12cm,8cm drop.dvi
the result is OK:
When I uncomment [pdftex]
lines and compile it as
pdflatex drop.tex
the results is:
Can anyone suggest a better way to produce drop caps with pdflatex
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
非常感谢您的快速回复! 事实上,霍普和查理·马丁的评论都很有用。
lettrine.sty
是一个很棒的包,如果使用可缩放字体,它就可以工作。因此,解决方案是强制使用 Type 1 CM 字体而不是默认 CM 和使用
lettrine.sty
。lettrine.sty
文档建议使用\usepackage{type1cm}
。这有效:
这就是结果:
谢谢!
附言。 即使使用
type1cm
,dropping
也无法正常工作。UPD。此示例也适用于
xelatex
。Thank you very much for quick responces! Actually, both comments by hop and Charlie Martin were useful.
lettrine.sty
is a fantastic package, and it works if scaleable fonts are used.So, the solution was to force Type 1 CM fonts instead of default CM and use
lettrine.sty
.lettrine.sty
documentation suggests to\usepackage{type1cm}
.This works:
And this is the result:
Thank you!
PS.
dropping
does not work correctly even withtype1cm
.UPD. This example also works with
xelatex
.尝试另一种字体,一种可以缩放的字体; 看起来 PDF 没有为 cap-W 找到足够大的字体,正在替换。 另一种选择是使用 dvi 到 PDF 的转换。
Try another font, one with scaling; this looks like the PDF isn't finding a big enough font for the cap-W and is substituting. The other option is to use a dvi-to-PDF translation.
lettrine.sty
lettrine.sty
正如 jetxee 提到的,有必要使用可缩放字体才能准确获得初始尺寸正确。 如果您更改默认字体,则无需执行任何操作即可发生这种情况。
由于历史原因,默认 CM 字体被加载为“对齐”到特定尺寸,而不是能够以任何缩放尺寸加载。 这是从使用原始 Metafont 源开始的,当时不同的字体大小改变了字形的实际形状(好奇的可以谷歌光学尺寸)。
解决 CM 字体问题的规范解决方案是加载
fix-cm
包。type1cm
包是一个较旧的包,基本上做同样的事情。As jetxee mentioned, it is necessary to use a scalable font in order to get exactly the right size for the initial. If you change the font from the default, this will occur without you having to do anything.
For historical reasons, the default CM fonts are loaded to "snap" to specific sizes, rather than being load-able at any scaled size. This is from the time when the original Metafont sources were used, when a different font size changed the actual shape of the glyphs (Google optical sizes for the curious).
The canonical solution to fix this problem with the CM fonts is to load the
fix-cm
package. The packagetype1cm
is an older package that basically does the same thing.