-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetspace.sty
309 lines (291 loc) · 13 KB
/
setspace.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
%%% ======================================================================
%%% @LaTeX-style-file{
%%% filename = "setspace.sty",
%%% version = "3.1",
%%% date = "25 May 1994",
%%% time = "10:21:09.67 CDT",
%%% author = "George D. Greenwade",
%%% address = "Department of Economics and Business Analysis
%%% College of Business Administration
%%% P. O. Box 2118
%%% Sam Houston State University
%%% Huntsville, Texas, USA 77341-2118",
%%% email = "[email protected] (Internet)
%%% BED_GDG@SHSU (BITNET)
%%% SHSU::BED_GDG (THENET)",
%%% telephone = "(409) 294-1266",
%%% FAX = "(409) 294-3712",
%%% supported = "yes",
%%% archived = "SHSU*",
%%% keywords = "LaTeX style, spacing, doublespace, half spacing,
%%% modifications to original",
%%% codetable = "ISO/ASCII",
%%% checksum = "14962 309 1381 13018",
%%% docstring = "This is a very quick hack to get setspace.sty
%%% to work with LaTeX2e as well as 2.09 with and
%%% without NFSS -- but it does work on the small
%%% test I've run. Comments welcome!
%%%
%%% The primitive logic is that we can test for
%%% the existence the definition of
%%% \selectfont -- not in LaTeX 2.09 without NFSS
%%% (prior toggle -- version 2.x)
%%% \@newbaseline -- defined in NFSS but not in
%%% LaTeX 2e (current toggle -- version 3.0)
%%%
%%% This is a modification to Erica Harris'
%%% setspace.sty. The main aspects of this
%%% modification deal with the definitions of
%%% \doublespacing, \onehalfspacing, and
%%% \singlespacing (these are near the beginning of
%%% the file). Primarily, these deal with adding
%%% fontsize changes to guarantee that the new
%%% baseline is properly defined and placed into
%%% action. The extra \vskip in the definition of
%%% \singlespacing seems to make for a cleaner
%%% transition from multiple spacing back to single
%%% spacing. These did not appear warrranted for
%%% other size changes.
%%%
%%% Modified by GDG on November 1, 1992, to allow
%%% for use of New Font Selection Scheme.
%%%
%%% Modified by GDG on June 4, 1993, to correct
%%% for spacing tokens in defintion of \@setsize
%%% Thanks to Kaja P. Christiansen <[email protected]>
%%% for the fix!!
%%%
%%% Modified by GDG on May 24, 1994, to change toggle
%%% definition from \selectfont to \@newbaseline.
%%%
%%% Modified by GDG on May 25, 1994, to add
%%% definition of \everydisplay -- this part of
%%% the code was apparently written by Geoffrey
%%% Tobin on Thu 23 Jan 1992 and was provided by
%%% [email protected] (Richard Stanton).
%%% This should help with some of the awkward math
%%% placements in changing spacings.
%%%
%%% The original headers of the main file cover the
%%% major aspects of this file and its use.
%%%
%%% The checksum field above contains a CRC-16
%%% checksum as the first value, followed by the
%%% equivalent of the standard UNIX wc (word
%%% count) utility output of lines, words, and
%%% characters. This is produced by Robert
%%% Solovay's checksum utility."
%%% }
%%% ======================================================================
%% FILE: setspace.sty in SYS2.TEX.PUB.ISULATEX.STYLES
%% AUTHOR: Erica M. S. Harris
%% DATE: April 1990
%% MOD: March 1991
%% DESCR: LaTeX Document style option "setspace"
%% Usage: \documentstyle[...,setspace,...]{...}
%% Based on the doublespace option created by Stephen Page.
%%
%% This style option provides commands and environments for doing
%% double and one-and-a-half spacing based on pt size.
%%
%% Single spacing is the default.
%%
%% Three commands, \doublespacing, \onehalfspacing, and
%% \singlespacing, are for use in the preamble to set the overall
%% spacing for the document. If a different spacing is required then
%% the \setstretch{baselinestretch} command can be used in the
%% preamble to set the baselinestretch appropriately. The default
%% spacing with this style option is single spacing.
%%
%% Three environments, singlespace, onehalfspace, and doublespace,
%% allow the spacing to be changed within the document. Both the
%% onehalfspace and doublespace environments are intended to increase
%% the spacing, so the onehalfspace environment should not be used in
%% a double spaced document. If an increased spacing different from
%% one-and-a-half or double spacing is required then the spacing
%% environment can be used. The spacing environment takes one
%% argument which is the larger baselinestretch to use,
%% e.g., \begin{spacing}{2.5}.
%%
%% \footins is adjusted the same as \parskip - appears to work. Lose
%% stretch parts but don't consider that to be crucial
%%
%% Removed code for altering spacing before and after displayed
%% equations - just looked too much.
%%
%% MODS:
%% Redefinition of \spacing and \endspacing for consistency with
%% TeX 3.x inserted by George Greenwade. Modification provided by
%% Philip Ross ([email protected]) and John Byrne via INFO-TeX.
%%
%% PLEASE REPORT ANY BUGS
%%
%% Old Documentation 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 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
%%
%%
%% mods: Jean-Francois Lamy
%%
%% POSSIBLE BUGS:
%% . 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).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\doublespacing{\ifcase \@ptsize \relax % 10pt
\def\baselinestretch{1.667}
\or % 11pt
\def\baselinestretch{1.618}
\or % 12pt
\def\baselinestretch{1.655}
\fi
\ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
\else% NFSS (2.09) present
\@newbaseline%
\fi%
}
\def\onehalfspacing{\ifcase \@ptsize \relax % 10pt
\def\baselinestretch{1.25}
\or % 11pt
\def\baselinestretch{1.213}
\or % 12pt
\def\baselinestretch{1.241}
\fi
\ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
\else% NFSS (2.09) present
\@newbaseline%
\fi%
}
\def\singlespacing{\def\baselinestretch{1}
\ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
\else% NFSS (2.09) present
\@newbaseline%
\fi%
\vskip\baselineskip% Correction for coming into singlespace
}
\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.
\ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
\def\@setsize#1#2#3#4{\@nomath#1%--modified 1993.04.07--GDG per KPC
\let\@currsize#1\baselineskip
#2\baselineskip\baselinestretch\baselineskip
\parskip\baselinestretch\parskip
\setbox\strutbox\hbox{\vrule height.7\baselineskip
depth.3\baselineskip width\z@}%
\skip\footins \baselinestretch\skip\footins
\normalbaselineskip\baselineskip#3#4}
\else% NFSS (2.09) present
\def\@newbaseline{\setnew@baselineskip
\baselineskip\baselinestretch\baselineskip
\setbox\strutbox\hbox{\vrule\@height.7\baselineskip
\@depth.3\baselineskip \@width\z@}%
\normalbaselineskip\baselineskip}%
\fi%
%---Increase the space between last line of text and footnote rule.
%\skip\footins 20pt plus4pt minus4pt
%---Reset baselinestretch within footnotes and floats.
\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}\@normalsize
\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}}}
% A single spaced quote (say) is done by surrounding singlespace with quote.
%
\def\singlespace{%
\vskip\baselineskip%
\def\baselinestretch{1}%
\ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
\else% NFSS (2.09) present
\@newbaseline%
\fi%
\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)
%
% Next two definitions fixed for consistency with TeX 3.x
\def\spacing#1{\par%
\begingroup % moved from \endspacing by PGBR 29-1-91
\def\baselinestretch{#1}%
\ifx\undefined\@newbaseline% NFSS not present; 2.09 or 2e
\ifx\@currsize\normalsize\@normalsize\else\@currsize\fi%
\else% NFSS (2.09) present
\@newbaseline%
\fi%
}
\def\endspacing{\par%
\vskip \parskip%
\vskip \baselineskip%
\endgroup%
\vskip -\parskip%
\vskip -\baselineskip}
% one and a half spacing is 1.5 x pt size
\def\onehalfspace{\ifcase \@ptsize \relax % 10pt
\spacing{1.25}
\or % 11pt
\spacing{1.213}
\or % 12pt
\spacing{1.241}
\fi}
\let\endonehalfspace=\endspacing
% double spacing is 2 x pt size
\def\doublespace{\ifcase \@ptsize \relax % 10pt
\spacing{1.667}
\or % 11pt
\spacing{1.618}
\or % 12pt
\spacing{1.655}
\fi}
\let\enddoublespace=\endspacing
% gt - EMSH chose to omit display math part that follows.
% She wrote (see above) that the "altered spacing before and after displayed
% equations ... just looked too much".
%
% 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}
\endinput