gpt4 book ai didi

pdf - pdfLaTeX 中的首字下沉

转载 作者:行者123 更新时间:2023-12-04 01:26:36 25 4
gpt4 key购买 nike

我想找到一种在 pdfLaTeX 中生成首字下沉(大首字母几行高)的方法。我知道有一个 droppinglatex 一起使用时效果很好的包+ 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
结果正常:
dropping-latex-dvips

当我取消注释时 [pdftex]行并将其编译为
pdflatex drop.tex
结果是:
dropping-pdflatex

任何人都可以建议一种更好的方法来使用 pdflatex 来制作首字下沉?

最佳答案

非常感谢您的快速回复!实际上,hop 和 Charlie Martin 的评论都很有用。 lettrine.sty是一个很棒的包,如果使用可缩放的字体,它就可以工作。
因此,解决方案是强制使用 Type 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}
这是结果:
pdflatex-type1cm-lettrine

谢谢!
附注。 dropping即使使用 type1cm 也无法正常工作.
更新。 这个例子也适用于 xelatex .

关于pdf - pdfLaTeX 中的首字下沉,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/413954/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com