summaryrefslogtreecommitdiff
path: root/macros/latex209/contrib/dropcaps/dropcaps.sty
blob: b1675580e8913167528f52a2a6e5ae27238a4aba (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
%%
%%        Style-option `dropcaps' for use with LaTeX v2.09
%%
\def\fileversion{0.30}
\def\filedate{13 Sep 1993}
\def\docdate{\filedate}
%%
%% Copyright (C) 1993 by Fred J. Lauwers, fred@dutspf.tudelft.nl .
%% All rights reserved. 
%%
%% THANKS
%%   Jeremy Gibbons
%%
%% DESCRIPTION:
%%   dropcaps.sty contains a macro for dropping caps in LaTeX.
%%
%% INSTALLATION:
%%   Put this file where your TeX looks for inputs, 
%%   under the name dropcaps.sty.
%%
%% DOCUMENTATION:
%%   dropcaps.tex
%%
%% COPYING:
%%   Copying of part or all of this file is allowed under the following
%%   conditions only:
%%   (1) You may freely distribute unchanged copies of the file. Please
%%       include the documentation when you do so.
%%   (2) You may modify a renamed copy of the file, but only for personal
%%       use or use within an organization.
%%   (3) You may copy fragments from the file, for personal use or for
%%       distribution, as long as credit is given where credit is due.
%%
%%   You are NOT ALLOWED to take money for the distribution or use of
%%   this file or modified versions or fragments thereof, except for
%%   a nominal charge for copying etc.
%%
\typeout{\space\space Style option: 'dropcaps' v\fileversion \space\space 
  <\filedate> \space\space (FJL)}%

\font\fredfont=cmbxsl10
\def\fred{F\kern-.25em\j\kern-.1emL}

\def\yes{y }\def\no{n }\newif\ifdvips
\message{*** Are you using Rokicki's DVIPS [y/n] ? }
\read-1 to \answer
\ifx\answer\yes\dvipstrue
\else\dvipsfalse\fi

\newcount\bigscale
\ifdvips\typeout{*** Good choice.}%
%
%   DVIPS users
%
\newcount\wantedcount\newcount\actualcount%
\newdimen\actualheight%
\def\findsize#1#2{%
\bigscale=1000%
\font\BIG=#1 scaled \bigscale%
\setbox0=\hbox{\BIG #2\/}%
\actualheight=\ht0%
\typeout{*** Needed height: \the\wantedheight, 
 \space Unscaled height: \the\actualheight}%
\wantedcount=\wantedheight \actualcount=\actualheight%
\advance\actualcount by 50%
\divide\actualcount by 100%
\multiply\wantedcount by 10%
\divide\wantedcount by \actualcount%
\font\BIG=#1 scaled \wantedcount%
\setbox0=\hbox{\BIG #2\/}%
\bigscale=\wantedcount%
}
\else\typeout{*** OK, prepare for bad output...}%
%
%   non-DVIPS users
%
\def\nextmagstep#1#2#3{%
\bigscale=#3%
\font\BIG=#1 scaled \bigscale%
\setbox0=\hbox{\BIG #2\/}}%
\def\findsize#1#2{%
\typeout{***  Needed height: \the\wantedheight}%
\nextmagstep{#1}{#2}{\magstep0}%
\ifdim\ht0<\wantedheight%
\nextmagstep{#1}{#2}{\magstephalf}%
\ifdim\ht0<\wantedheight%
\nextmagstep{#1}{#2}{\magstep1}%
\ifdim\ht0<\wantedheight%
\nextmagstep{#1}{#2}{\magstep2}%
\ifdim\ht0<\wantedheight%
\nextmagstep{#1}{#2}{\magstep3}%
\ifdim\ht0<\wantedheight%
\nextmagstep{#1}{#2}{\magstep4}%
\ifdim\ht0<\wantedheight%
\nextmagstep{#1}{#2}{\magstep5}%
\fi\fi\fi\fi\fi\fi%
}\fi

\newcount\down
\newdimen\saveunitlength
\newdimen\wantedheight
\def\bigdrop#1#2#3#4{%
\saveunitlength=\unitlength%
\unitlength=\baselineskip%
\setbox1=\hbox{\the\font I}%
\wantedheight=#2\baselineskip \advance\wantedheight by -\baselineskip%
\advance\wantedheight by \ht1% 
\findsize{#3}{#4}%
\advance\wantedheight by -\ht0%                 only for typeout...
\typeout{***  #3 scaled \the\bigscale \space ==> height: 
  \the\ht0 \space (error: \the\wantedheight).}%
\hangindent=\wd0 \advance\hangindent by #1%
\hangafter=-#2%
\ifdim\dp0>0.25\baselineskip%            0pt ?
 \typeout{*** extra line(s) indented: non-zero depth: \the\dp0}
 \loop\ifdim\dp0>\baselineskip
  \advance\baselineskip by \baselineskip
  \advance\hangafter by -1
 \repeat
 \advance\hangafter by -1
 \baselineskip=\unitlength
\fi%
\noindent%
\down=-#2 \advance\down by 1%
\begin{picture}(0,0)%
\put(0,\down){\makebox(0,0)[br]{\box0}}%
\end{picture}%
\unitlength=\saveunitlength}

\endinput