【问题标题】:Drop caps in pdfLaTeXpdfLaTeX 中的首字下沉
【发布时间】:2010-09-29 15:52:53
【问题描述】:

我想找到一种在 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 提出一种更好的制作首字下沉的方法?

【问题讨论】:

    标签: pdf latex pdf-generation typography


    【解决方案1】:

    【讨论】:

    • 我怀疑这无济于事。 W 下降得很好——基线向下移动——但它不是一个足够大的字符。
    • dropping 不能很好地与 pdflatex 一起工作。如果 lettrine 对他不起作用,我会撤回这个答案。
    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

      非常感谢您的快速响应!实际上,cmet by hop 和 Charlie Martin 都是有用的。 lettrine.sty 是一个很棒的包,如果使用可缩放字体。

      因此,解决方案是强制使用 Type 1 CM 字体而不是默认 CM并且使用lettrine.stylettrine.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。即使使用type1cmdropping 也无法正常工作。

      UPD。此示例也适用于xelatex

      【讨论】:

        【解决方案4】:

        正如jetxee 所提到的,有必要使用可缩放的字体来获得正确的初始大小。如果您更改默认字体,则无需您进行任何操作。

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

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

        【讨论】:

          猜你喜欢
          • 2012-12-22
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-12-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多