sastanin
sastanin

Reputation: 41511

Drop caps in 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:

dropping-latex-dvips

When I uncomment [pdftex] lines and compile it as

pdflatex drop.tex

the results is:

dropping-pdflatex

Can anyone suggest a better way to produce drop caps with pdflatex?

Upvotes: 15

Views: 15291

Answers (4)

sastanin
sastanin

Reputation: 41511

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:

\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}

And this is the result:

pdflatex-type1cm-lettrine

Thank you!

PS. dropping does not work correctly even with type1cm.

UPD. This example also works with xelatex.

Upvotes: 22

Will Robertson
Will Robertson

Reputation: 64560

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 package type1cm is an older package that basically does the same thing.

Upvotes: 3

Charlie Martin
Charlie Martin

Reputation: 112366

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.

Upvotes: 6

user3850
user3850

Reputation:

lettrine.sty

Upvotes: 4

Related Questions