summaryrefslogtreecommitdiff
path: root/macros/latex209/contrib/dropcaps/dropdoc.tex
blob: 940e812ed72613d73ee2446603117bc7319f98b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
%   DROPDOC.TEX -- 13-09-1993
%
\documentstyle[dropcaps]{ttn2n1a}
\begin{document}

\Section{{\huge {\tt dropcaps.sty}}\\ 
         a style file for dropping caps (\fred)}

\bigdrop{-10pt}{3}{cmsl10}{I}n a previous issue of \TTN\ 
(vol. 1, No. 4, 1992), Peter Flynn dedicates a subsection of 
{\sl Typographer's Inn\/} to the problem of dropped capitals. This is 
my answer to some of his questions. Basically, I don't start with the
capital, but I let the capital's size depend on the chosen design.
I wrote a dropped caps macro for use with \LaTeX, and took these 
design decisions:
\begin{itemize}
\item First, let the writer choose her favourite design, within certain 
      limitations though, and let the macro do the dirty work: adjusting 
      the cap to the optimal size.
\item Let the writer decide how many lines she wants to dropindent. Let
      her also decide in which font the cap should appear, whether to 
      start the cap {\em at\/} the left margin, or somewhat to the left 
      (into the white space) or to the right (into text direction). Let 
      her decide what she puts into dropped caps: a single character, or 
      even one or more whole words, or without caps at all.
\item The limitations: Let the cap's baseline be aligned with the baseline 
      of the lowest of the indenting lines. Let the cap's top line be 
      aligned with the top line of the first of the indenting lines.
      Don't let the writer mess with this!
\end{itemize}

\Subsection{Usage}

\bigdrop{-10pt}{3}{cmsl10}{M}y {\tt dropcaps.sty} is a \LaTeX\ style 
file, that defines a macro command \verb+\bigdrop+ that enables you to 
drop capitals at the beginning of a paragraph. The layout can be 
controlled in various ways, with four parameters (not optional). For 
instance, the current paragraph started with\\ [2pt]
\verb+\bigdrop{-10pt}{3}{cmsl10}{M}y ...+\\ [2pt]
The required parameters are:
\begin{enumerate}
\item a {\em length}, that denotes the distance from the left margin 
      (to the left or to the right) at which the dropped capital starts, 
      in this case 10pt into the left margin: {\tt -10pt}. 
\item an integer value, that denotes the number of lines to be indented, 
      in this case {\tt 3} lines.
\item the font to be used for the dropped capital, in this case {\tt cmsl10}. 
\item the character or text to be dropped, in this case a single {\tt M}.
\end{enumerate}

\Subsection{The messy details}

\bigdrop{-10pt}{3}{cmsl10}{W}hen the macro \verb+\bigdrop+ is called 
(with four parameters), this is what happens. First, a capital "I" is 
typeset in the current text font and put in a box (\verb+box1+). The 
desired font height (\verb+\wantedheight+) is then computed from 
\verb|(n-1)*\baselineskip+\ht1|, where {\tt n} is the number of lines 
to indent. Then the procedure differs, depending on the choice for DVIPS 
or not.\\ [8pt]
%
{\fredfont DVIPS users}\\ 
%
In this case the text to be capitalized, typeset in the chosen font 
(at scale \verb+1000+), is put in a box (\verb+box0+), with height
\verb+\actualheight+ $=$ \verb+\ht0+. Now, the scaling factor for this 
font can be computed from dividing \verb+\wantedheight+ by 
\verb+\actualheight+ and multiplying this by \verb+1000+. Because 
divisions are integer, the heights are first put in count registers, 
and then, to prevent from rounding errors and overflow, 
\verb+\wantedheight*10+ is divided by \verb+\actualheight/100+. The 
outcome of this is the scale at which the chosen font is typeset.\\ [8pt]
%
{\fredfont non-DVIPS users}\\
%
Without DVIPS things are less elegant, for only the standard magsteps 
are available for scaling fonts\footnote{The \verb+magstep+'s {\tt 0}, 
{\tt half}, {\tt 1}, {\tt 2}, {\tt 3}, {\tt 4}, and {\tt 5}.}. The text 
to be capitalized in the chosen font, is first typeset at 
\verb|\magstep 0| and put in a box (\verb+box0+), with height \verb+\ht0+.

If \verb+\wantedheight+ is bigger then \verb+\ht0+, the text is typeset 
at \verb|\magstephalf|, and put in \verb+box0+ again. If 
\verb+\wantedheight+ is still bigger then \verb+\ht0+, again the 
\verb|\magstep| is increased one step, et cetera. This process is
repeated until \verb+\wantedheight+ is smaller then \verb+\ht0+.\\ [8pt]
%
{\fredfont both}\\
%
The result of the computation can be observed on the screen and in the
{\tt .log} file. Each time a capital is dropped, two lines like\\ [2pt]
\verb|*** Needed height: 30.83331pt,  Unscaled height: 6.83331pt|\\
\verb|*** cmsl10 scaled 4512 ==> height: 30.83195pt (error: 0.00136pt).|\\ [2pt]
appear. This example is from processing this document with {\tt n = 3} 
and font {\tt cmsl10}.

At the end of the computation {\tt box0} contains the text, typeset in
the desired font and scaled such that \verb+\ht0+ equals the height of
the indenting lines. Then, \verb+\hangindent+ and \verb+\hangafter+ are 
set according to {\tt box0} and the parameter values:
\verb|\hangindent:=\wd0+#1|, and \verb|\hangafter:=-#2|. 
Precautions are taken for the case that \verb+\dp0+ is not equal to 
zero\footnote{An extra line is indented, if overlap occurs, the test file 
{\tt droptest.tex} shows an example of this.}. Finally, in a \LaTeX\ 
picture environment, the text is placed where we want it.

\Subsection{Requirements}

\bigdrop{-10pt}{3}{cmsl10}{I}n order to use this style file, a big 
version of \LaTeX\ is needed, because almost always fonts have to be 
generated, and already from 4 indenting lines, they tend to become very 
large. I tested this with em\TeX's \TeX386 (with emx) on a 486DX33 PC, 
and with em\TeX's b\TeX186 on a AT286 PC.

Also needed is a version of {\bf DVIPS} by Tomas Rokicki with {\bf MakeTeXPK} 
running, so the generation of fonts will be done automatically. For me
the recently uploaded {\bf DVIPS 5.518} works great on both machines.

All this is necessary because the implemented procedure in this macro 
automatically leads to non-standard fonts. So, for optimal pleasure, 
use a big \TeX\ and Rokicki's {\bf DVIPS}.

\Subsection{Alternatives}

\bigdrop{-10pt}{3}{cmsl10}{O}nly one style file that does something 
similar is listed in \TeX--index v1.06 by David M. Jones, namely 
{\tt drop.sty} by David G. Cantor. The latest version is dated 
17--02--1988. This style file also defines a macro to drop capitals, 
but has no possibilities to accept controlling parameters, except for 
the choice of font. You are not able to choose the desired height by
supplying the number of lines to be indented. 

The dropped capital has a fixed size, namely \verb+\magstep5+, and 
always two lines are indented. This font height is somewhat smaller 
than the height of two indenting lines, so the vertical placement of 
the dropped capital's baseline lies not at the same height as the 
vertical placement of the baseline of the second indenting line (next 
to it). The advantage of this is that everyone has this font.

\vspace{2cm}
\leftline{Fred J. Lauwers ({\sl \fred\/})}
\leftline{\tt fred@dutspf.tudelft.nl}

\end{document}