首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pdfLaTeX中的首字下沉

pdfLaTeX中的首字下沉
EN

Stack Overflow用户
提问于 2009-01-05 18:01:38
回答 4查看 13.7K关注 0票数 12

我想找到一种在pdfLaTeX中产生首字下沉(几行高的大首字母)的方法。我知道有一个dropping包在与latex + dvips一起使用时工作得很好。然而,当与pdflatex一起使用时,结果看起来很丑陋。

我的源文件是:

代码语言:javascript
复制
\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}

当我将它编译为

代码语言:javascript
复制
latex drop.tex && dvips -T 12cm,8cm drop.dvi

结果是OK:

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

代码语言:javascript
复制
pdflatex drop.tex

结果是:

有没有人能推荐一种用pdflatex生成首字下沉的更好的方法?

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2009-01-05 18:51:28

非常感谢您的快速响应!实际上,hop和Charlie Martin的评论都很有用。lettrine.sty是一个很棒的包,如果使用可伸缩的字体,它就可以工作。

因此,解决方案是强制Type1CM字体而不是默认CM,并使用lettrine.stylettrine.sty文档向\usepackage{type1cm}建议。

这是可行的:

代码语言:javascript
复制
\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。即使使用type1cmdropping也不能正常工作。

UPD.此示例也适用于xelatex

票数 20
EN

Stack Overflow用户

发布于 2009-01-05 18:13:05

尝试另一种字体,一种带缩放的字体;这看起来PDF找不到足够大的字体来显示cap-W,正在替换。另一种选择是使用dvi到PDF的转换。

票数 6
EN

Stack Overflow用户

发布于 2009-01-05 18:12:22

lettrine.sty

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/413954

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档