-
Notifications
You must be signed in to change notification settings - Fork 2
/
doublespace.sty
executable file
·192 lines (171 loc) · 7.08 KB
/
doublespace.sty
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
%------------------------------------------------------------------------------
%
% LaTeX Document style option "doublespace"
% -- usage: \documentstyle[...,doublespace,...]{...}
%
% This style option produces a double-spaced document by redefining
% the LaTeX parameter \baselinestretch to 2.
%
% It also fixes a number of problems with standard LaTeX, as follows:
%
% 1. A new environment "singlespace" is provided, within which single
% spacing will apply.
% JFL - changed so that it works in regular text and so that vertical
% space is before and after is correctly computed
% 2. Double spacing is turned off within footnotes and floats (figures
% and tables).
% 3. Proper double spacing happens below tabular environments and in other
% places where LaTeX uses a strut.
% 4. Slightly more space is inserted before footnotes.
% 5. JFL - fixes spacing before and after displayed math
% 6. MAR - fix to work with new font selection scheme if used
% 7. KPC - fix superfluous space bug.
% 8. HGS - fixed for use with NFSS2
%
% Note: This version sets a baselinestretch of 2. If this is too much,
% put \setstretch{1.7} (or some appropriate value) before the
% \begin{document} command. To print the document with single spacing
% again, without removing "singlespace" environments, just put a
% \setstretch{1} at the top of the document.
%
% PLEASE REPORT ANY BUGS
%
% Modified by: Kaja P. Christiansen, [email protected]
%
% Modified by: Mark A. Roth, [email protected]
%
% Modified by: Jean-Francois Lamy
%
% Modified by: Hendrik G. Seliger (HGS)
%
% Author: Stephen Page -- [email protected]
% sdpage%[email protected]
%
% Release date: 6 July 1986 - September 3, 1986
%
% Known bugs:
% . It might be nice if spacing before the footnote rule (\footins)
% were provided in a tidier way.
% . Increasing struts may possibly cause some other obscure part of
% formatting to fall over.
% . \begin{singlespace}\begin{quote} produces the wrong spacing before
% the quote (extra glue is inserted), use \begin{quote}\begin{singlespace}
% . shouldn't @setsize stretch parskip as well?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---Set up double spacing
\def\baselinestretch{2}
%---New command "\setstretch" (slightly more mnemonic... and easier to type)
\def\setstretch#1{\renewcommand{\baselinestretch}{#1}}
%---Stretch the baseline BEFORE calculating the strut size. This improves
% spacing below tabular environments etc., probably...
% Comments are welcomed.
% This change not needed with new font selection scheme-MAR
\ifx\undefined\selectfont %then new font selection scheme not invoked-MAR
\def\@setsize#1#2#3#4{\@nomath#1%-KPC
\let\@currsize#1\baselineskip
#2\baselineskip\baselinestretch\baselineskip
\parskip\baselinestretch\parskip
\setbox\strutbox\hbox{\vrule height.7\baselineskip
depth.3\baselineskip width\z@}%-KPC
\normalbaselineskip\baselineskip#3#4}
\else %new font selection scheme is defined, set up way to change baselines-MAR
% NFSS2 does not have \setnew@baselineskip anymore - HGS
\def\@newbaseline{%
\ifx\undefined\setnew@baselineskip% HGS
\baselineskip\f@baselineskip\relax%
\else% HGS
\setnew@baselineskip%
\fi% HGS
\baselineskip\baselinestretch\baselineskip
\setbox\strutbox\hbox{\vrule\@height.7\baselineskip
\@depth.3\baselineskip \@width\z@}%
\normalbaselineskip\baselineskip}% -MAR
\fi %-MAR
%---Increase the space between last line of text and footnote rule.
% This is a very untidy way to do it!
\skip\footins 20pt plus4pt minus4pt
%---Reset baselinestretch within footnotes and floats. Originally stolen
% from Stanford thesis style.
\def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
\@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner
\@parmoderr\@floatpenalty\z@
\else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname
\multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n
\@tfor \@tempa :=#2\do
{\if\@tempa h\advance\@tempcnta \@ne\fi
\if\@tempa t\advance\@tempcnta \tw@\fi
\if\@tempa b\advance\@tempcnta 4\relax\fi
\if\@tempa p\advance\@tempcnta 8\relax\fi
}\global\count\@currbox\@tempcnta}\@fltovf\fi
\global\setbox\@currbox\vbox\bgroup
\def\baselinestretch{1}
\ifx\undefined\selectfont %then new font selection scheme not invoked-MAR
\small\normalsize
\else %else new font selection scheme is invoked-MAR
\@newbaseline %include new baselinestretch-MAR
\fi %-MAR
\boxmaxdepth\z@
\hsize\columnwidth \@parboxrestore}
\long\def\@footnotetext#1{\insert\footins{\def\baselinestretch{1}\footnotesize
\interlinepenalty\interfootnotelinepenalty
\splittopskip\footnotesep
\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
\hsize\columnwidth \@parboxrestore
\edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
{\rule{\z@}{\footnotesep}\ignorespaces
#1\strut}}}
% Stolen from MIT.
%
% A single spaced quote (say) is done by surrounding singlespace with quote.
%
\def\singlespace{%
\vskip\parskip%
\vskip\baselineskip%
\def\baselinestretch{1}%
\ifx\undefined\selectfont %then new font selection scheme not invoked-MAR
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
\else %else new font selection scheme is invoked-MAR
\@newbaseline %include new baselinestretch-MAR
\fi %-MAR
\vskip-\parskip%
\vskip-\baselineskip%
}
\def\endsinglespace{\par}
% spacing, doublespace and onehalfspace all are meant to INCREASE the
% spacing (i.e. calling onehalfspace from within doublespace will not
% produce a graceful transition between spacings)
%
\def\spacing#1{\par%
\begingroup % moved from \endspacing by PGBR 1-29-91
\def\baselinestretch{#1}%
\ifx\undefined\selectfont %then new font selection scheme not invoked-MAR
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi
\else %else new font selection scheme is invoked-MAR
\@newbaseline %include new baselinestretch-MAR
\fi %-MAR
}
\def\endspacing{\par%
\vskip \parskip%
\vskip \baselineskip%
\endgroup%
\vskip -\parskip%
\vskip -\baselineskip%
} %\begingroup used to be here, PGBR 1-29-91
\def\onehalfspace{\spacing{1.5}}
\let\endonehalfspace=\endspacing
\def\doublespace{\spacing{2}}
\let\enddoublespace=\endspacing %corrected--first end missing-MAR
% Fix up spacing before and after displayed math
% (arraystretch seems to do a fine job for inside LaTeX displayed math,
% since array and eqnarray seem to be affected as expected)
% Changing \baselinestretch and doing a font change also works if done here,
% but then you have to change @setsize to remove the call to @nomath)
%
\everydisplay{
\abovedisplayskip \baselinestretch\abovedisplayskip%
\belowdisplayskip \abovedisplayskip%
\abovedisplayshortskip \baselinestretch\abovedisplayshortskip%
\belowdisplayshortskip \baselinestretch\belowdisplayshortskip}