forked from privong/easyuvathesis
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setspace.sty
508 lines (462 loc) · 19.8 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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
%%% ======================================================================
%%% @LaTeX-style-file{
%%% filename = "setspace.sty",
%%% version = "6.3",
%%% date = "Wed 8 April 1998",
%%% time = "19:08 UT+10",
%%% author = "Geoffrey Tobin",
%%% address = "School of Electronic Engineering
%%% Faculty of Science and Technology
%%% La Trobe University
%%% Bundoora VIC 3124
%%% Australia",
%%% email = "G.Tobin@latrobe.edu.au (Internet)",
%%% telephone = "(+ 613) 479-3736",
%%% FAX = "(+ 613) 479-3025",
%%% supported = "yes",
%%% archived = "CTAN",
%%% distribution = "freely redistributable",
%%% keywords = "LaTeX package, line spacing",
%%% codetable = "ISO/ASCII",
%%% checksum = "47240 507 2399 19977",
%%% docstring = "setspace.sty is a LaTeX (2e) package.
%%% Comments and bug reports welcome!
%%%
%%% This includes GDG's modification to Erica Harris'
%%% setspace.sty. The main aspects of this
%%% modification deal with the definitions of
%%% \singlespacing \onehalfspacing, and
%%% \doublespacing, (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 definition of \@setsize
%%% Thanks to Kaja P. Christiansen <kaja@daimi.aau.dk>
%%% 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
%%% stanton@haas.berkeley.edu (Richard Stanton).
%%% This should help with some of the awkward math
%%% placements in changing spacings.
%%%
%%% Modified by GT on 23 Jan 1996, to correct
%%% \everymath bug, first reported by Mario
%%% Wolczko <mario@cs.man.ac.uk> on 9 June 1992.
%%%
%%% Modified by GT on 23 Jan 1996, to correct
%%% usage of comment characters in macro
%%% definitions.
%%%
%%% Modified by GT on 23 Jan 1996, to update
%%% (adjusted) \@xfloat definition for LaTeX2e.
%%% Bug report was courtesy of Kay Nettle.
%%%
%%% Modified by GT on 24 Jan 1996, to update
%%% (adjusted) \@footnotetext definition for
%%% LaTeX2e, and to add an adjusted LaTeX2e
%%% \@mpfootnotext definition for minipages.
%%% Bug report was courtesy Kay Nettle.
%%%
%%% Changed by GT on 6 Feb 1996, into a LaTeX2e
%%% package.
%%%
%%% Made more package-like by GT on 14 Feb 1996,
%%% by adding standard messages.
%%%
%%% GT replaced \@normalsize by \normalsize on 28
%%% Sep 1996. This change was successively
%%% advised by:
%%%
%%% Rowland J.~Bartlett
%%% <R.J.Bartlett@bolton.ac.uk>
%%% on Tue 6 Aug 96,
%%%
%%% Ted Stern
%%% <stern@amath.washington.edu>
%%% on Wed 7 Aug 96,
%%%
%%% Michal Jaegermann
%%% <michal@ellpspace.math.ualberta.ca>
%%% on Fri 27 Sep 96.
%%%
%%% GT: Sat 28 Sep 1996: Added call to
%%% \setspace@size in \setstretch, as suggested
%%% by David Hull <hull@cs.uiuc.edu>
%%% on Wed 24 July 1996.
%%%
%%% GT: Sat 28 Sep 1996: Pared \setspace@size
%%% mercilessly down to \@currsize, following
%%% advice given on Fri 27 Sep 1996 by Michal
%%% Jaegermann <michal@ellpspace.math.ualberta.ca>.
%%% Retained this macro for flexibility.
%%%
%%% Code rearranged by GT, Sat 28 Sep 1996, to give
%%% greater prominence to \setstretch.
%%%
%%% Also, GT changed (Sat 28 Sep 1996) many
%%% occurrences of \def to \newcommand,
%%% \renewcommand, or \newenvironment,
%%% as seemed appropriate.
%%%
%%% GT, Tue 10 Dec 1996: Following a suggestion
%%% by Ted Stern, the `single' spacing is now
%%% settable by the user. This is for slightly
%%% large fonts such as Lucida Bright.
%%%
%%% GT, Wed 11 Dec 1996: For simplicity and
%%% maintainability, call \onehalfspacing in
%%% the onehalfspace environment, and
%%% \doublespacing in the doublespace
%%% environment.
%%%
%%% GT, Wed 11 Dec 1996: Also deleted
%%% \setspace@size from \setstretch,
%%% as \@currsize suffices.
%%%
%%% Modified by Brett Presnell
%%% <presnell@maths.anu.edu.au> on 21 Mar 1998
%%% to add nodisplayskipstretch option, which
%%% turns off the stretching of the space
%%% before and after displays, which is often
%%% excessive, particularly with doublespaced
%%% documents. Also added the
%%% setdisplayskipstretch command, which allows
%%% the user to choose by how much to stretch
%%% the space before and after displays
%%% independently from the setting of
%%% baselinestretch. This works regardless of
%%% whether the nodisplayskipstretch option is
%%% in effect.
%%%
%%% GT, Wed 15 Apr 1998: Added the singlespace*
%%% environment requested by
%%% Mark Olesen <olesen@weber.me.queensu.ca>
%%% on Sat 24 May 1997 and Wed 18 June 1997.
%%% This is reported to give improved vertical
%%% spacing around itemize and quote environments.
%%%
%%% GT, Wed 15 Apr 1998: David Hull pointed out on
%%% Fri 12 Dec 1997 that the \belowdisplayskip line
%%% in the \everydisplay was mistyped. Now fixed.
%%%
%%% 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
%%%
%%% Update to LaTeX (2e) : 6 Feb 1996.
%%% Description: LaTeX Document Package "setspace"
%%%
%%% Usage:
%%% \documentclass[...]{...}
%%% \usepackage{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, \singlespacing, \onehalfspacing, and
%% \doublespacing, 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 (ROSS@UK.AC.ABDN.BIOMED) 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
%% lamy@ai.toronto.edu
%% lamy@utai.uucp
%%
%% 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).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat {LaTeX2e}[1994/12/01]
\def \filename {setspace.sty}
\def \filedate {1998/04/8}
\def \fileversion {6.3}
\ProvidesPackage {setspace}[\filedate\space\fileversion\space
Contributed and Supported LaTeX2e package]
\typeout {Package: `setspace' \fileversion\space <\filedate>}
% BP: add nodisplayskipstretch option and \setdisplayskipstretch command.
\newcommand{\displayskipstretch}{\baselinestretch}
\newcommand{\setdisplayskipstretch}[1]{\renewcommand{\displayskipstretch}{#1}}
\DeclareOption{nodisplayskipstretch}{\setdisplayskipstretch{1.0}}
\ProcessOptions
% GT: Sat 28 Sep 1996: Widely using \newcommand, \renewcommand, and
% \newenvironment, instead of \def.
% ** Line space commands.
\newcommand{\setstretch}[1]{%
\def\baselinestretch{#1}%
\@currsize
}
% GT: Sat 28 Sep 1996: spacing commands and environments modified to
% use \setstretch instead of \baselinestretch.
%
% GT: Sat 28 Sep 1996: No, I don't know understand the line spacing
% algorithms! If someone (LaTeX team) can enlighten me as to the
% general rule, please do! It would be very pleasant if setspace.sty
% were suited for document font sizes other than 10, 11 and 12 pt.
%
% GT: Tue 10 Dec 1996: Instead of fixing singlespacing to exact unity,
% allow user to redefine it (only slightly, please!) from its initial
% value of unity, in the case when a particular font is slightly larger
% or slightly smaller than its point size would indicate. This change
% affects setspace's single spacing commands, and LaTeX's footnote and
% float environments. The one and a half, double, and arbitrary
% spacing commands are unaltered.
\newcommand{\SetSinglespace}[1]{%
\def\setspace@singlespace{#1}%
}
% Here's the default single line spacing value.
\SetSinglespace{1}
\newcommand{\singlespacing}{%
\setstretch {\setspace@singlespace}%
\vskip \baselineskip % Correction for coming into singlespace
}
\newcommand{\onehalfspacing}{%
\ifcase \@ptsize \relax % 10pt
\setstretch {1.25}%
\or % 11pt
\setstretch {1.213}%
\or % 12pt
\setstretch {1.241}%
\fi
}
\newcommand{\doublespacing}{%
\ifcase \@ptsize \relax % 10pt
\setstretch {1.667}%
\or % 11pt
\setstretch {1.618}%
\or % 12pt
\setstretch {1.655}%
\fi
}
% ** Modification of the LaTeX command \@setsize.
%---Stretch the baseline BEFORE calculating the strut size. This improves
% spacing below tabular environments etc., probably...
% Comments are welcomed.
% GT: Sun 29 Sep 1996: Question: Is this code anywhere near correct
% since this part of LaTeX (in, eg, latex.ltx) has been greatly changed?
% GT: Sun 29 Sep 1996: The meanings of the arguments to \@setsize
% appear to be (whatever these may signify) :
% current size; font baselineskip; ignored (!); and font size.
% GT: Sun 29 Sep 1996: Note that \@setsize (in latest LaTeX,
% \@setfontsize, which is called by \@setsize) seems to be the only
% place in purely modern LaTeX where \@currsize is set, and ltxguide.cls
% seems to be the only file in the LaTeX base distribution that uses it!
\def\@setsize#1#2#3#4{%
% Modified 1993.04.07--GDG per KPC
\@nomath#1%
\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}
% ** Float and footnote adjustments to compensate for a change in the
% ** main text's line spacing.
%---Increase the space between last line of text and footnote rule.
%\skip\footins 20pt plus4pt minus4pt
%---Reset baselinestretch within floats and footnotes.
% GT: Tue 23 Jan 1996: This is where the conflict with the combination
% of the color package and the figure environment used to occur.
% Floats.
% GT: Sat 28 Sep 1996: \@xfloat is the only place where \normalsize
% is still used in setspace.sty !
\let\latex@xfloat=\@xfloat
\def\@xfloat #1[#2]{%
\latex@xfloat #1[#2]%
\def\baselinestretch{\setspace@singlespace}%
\normalsize
}
% GT: Wed 24 Jan 1996: This footnote code was copied from LaTeX and
% modified rather naively. It had to be brought up to date, not only
% because of LaTeX's new color ability, but also because ther had
% been major changes to this code in LaTeX at least as far back as
% March 1992.
% Normal, bottom of the page, footnotes.
%
% GT: Based HEAVILY on original LaTeX (2e) code. A standard hook would
% be MUCH preferred, so that LaTeX's footnote implementation needn't be
% copied each time it changes.
%
% GT: The \protected@edef requires at least the December 1994 LaTeX.
% This is precisely the kind of VERSION DEPENDENCY situation that
% cannot (AFAIK) be avoided, because LaTeX (2e) LACKS appropriate
% standard hooks and/or context markers.
\long\def\@footnotetext#1{%
\insert\footins{%
% GT: Next line added. Hook desired here!
\def\baselinestretch {\setspace@singlespace}%
\reset@font\footnotesize
\interlinepenalty\interfootnotelinepenalty
\splittopskip\footnotesep
\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
\hsize\columnwidth
\@parboxrestore
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark
}%
\color@begingroup
\@makefntext{%
\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
\color@endgroup}}
% Minipage footnotes.
\long\def\@mpfootnotetext#1{%
\global\setbox\@mpfootins\vbox{%
\unvbox \@mpfootins
% GT: Next line added. Hook desired here!
\def\baselinestretch {\setspace@singlespace}%
\reset@font\footnotesize
\hsize\columnwidth
\@parboxrestore
\protected@edef\@currentlabel{%
\csname p@mpfootnote\endcsname\@thefnmark}%
\color@begingroup
\@makefntext{%
\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
\color@endgroup}}
% ** Line space environments.
% A single spaced quote (say) is done by surrounding singlespace with quote.
\newenvironment{singlespace}{%
\vskip \baselineskip
\setstretch {\setspace@singlespace}%
\vskip -\baselineskip
}{%
\par
}
% GT (c/o Mark Olesen), Wed 15 April 1998.
\newenvironment{singlespace*}{%
\setstretch {\setspace@singlespace}%
\vskip -\baselineskip
}{%
\vskip -0.5\baselineskip
}
% 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
% In order to use \newenvironment, while easily using same code for
% end of each environment, the code that used to be in \endspacing has
% been moved into a new (but internal) macro, \restore@spacing.
\newcommand{\restore@spacing}{%
\par
\vskip \parskip
\vskip \baselineskip
\endgroup
\vskip -\parskip
\vskip -\baselineskip
}
\newenvironment{spacing}[1]{%
\par
\begingroup % moved from \endspacing by PGBR 29-1-91
\setstretch {#1}%
}{%
\restore@spacing
}
% one and a half spacing is 1.5 x pt size
\newenvironment{onehalfspace}{%
\onehalfspacing
}{%
\restore@spacing
}
% double spacing is 2 x pt size
\newenvironment{doublespace}{%
\doublespacing
}{%
\restore@spacing
}
% 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)
%
% GT: The \belowdisplayskip line was mistyped; now fixed, courtesy of
% David Hull.
%
% GT: Brett Parnell has addressed EMSH's concern by replacing
% \baselinestretch by \displayskipstretch in displays, as follows.
\everydisplay\expandafter{%
\the\everydisplay
\abovedisplayskip \displayskipstretch\abovedisplayskip
\belowdisplayskip \displayskipstretch\belowdisplayskip
\abovedisplayshortskip \displayskipstretch\abovedisplayshortskip
\belowdisplayshortskip \displayskipstretch\belowdisplayshortskip
}
\endinput
%%% EOF.