Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defsetstretch#1{renewcommand{baselinestretch}{#1}}
- % ***************************************
- % * SINGLESPACE ANd DOUBLESPACE *
- % ***************************************
- %-------------------------------------------------------------------------------
- %
- % 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
- %
- % 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
- %
- %
- % 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).
- % . shouldn't @setsize stretch parskip as well?
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %---Set up double spacing
- %defbaselinestretch{1}
- %---New command "setstretch" (slightly more mnemonic... and easier to type)
- defsetstretch#1{renewcommand{baselinestretch}{#1}}
- %---Stretch the baseline BEFORE calculating the strut size. This improves
- % spacing below tabular environments etc., probably...
- % Comments are welcomed.
- def@setsize#1#2#3#4{@nomath#1%
- let@currsize#1baselineskip
- #2baselineskipbaselinestretchbaselineskip
- parskipbaselinestretchparskip
- setboxstrutboxhbox{vrule height.7baselineskip
- depth.3baselineskip widthz@}%
- normalbaselineskipbaselineskip#3#4}
- %---Increase the space between last line of text and footnote rule.
- % This is a very untidy way to do it!
- skipfootins 25pt plus4pt minus4pt
- %---Reset baselinestretch within footnotes and floats. Originally stolen
- % from Stanford thesis style.
- def@xfloat#1[#2]{ifhmode @bsphack@floatpenalty -@Miielse
- @floatpenalty-@Miiifidef@captype{#1}ifinner
- @parmoderr@floatpenaltyz@
- else@next@currbox@freelist{@tempcntacsname ftype@#1endcsname
- multiply@tempcnta@xxxiiadvance@tempcntasixt@@n
- @tfor @tempa :=#2do
- {if@tempa hadvance@tempcnta @nefi
- if@tempa tadvance@tempcnta tw@fi
- if@tempa badvance@tempcnta 4relaxfi
- if@tempa padvance@tempcnta 8relaxfi
- }globalcount@currbox@tempcnta}@fltovffi
- globalsetbox@currboxcolor@vboxnormalcolorvboxbgroup
- defbaselinestretch{1}smallnormalsize
- boxmaxdepthz@
- hsizecolumnwidth @parboxrestore}
- longdef@footnotetext#1{insertfootins{defbaselinestretch{1}footnotesize
- interlinepenaltyinterfootnotelinepenalty
- splittopskipfootnotesep
- splitmaxdepth dpstrutbox floatingpenalty @MM
- hsizecolumnwidth @parboxrestore
- edef@currentlabel{csname p@footnoteendcsname@thefnmark}@makefntext
- {rule{z@}{footnotesep}ignorespaces
- #1strut}}}
- % Stolen from MIT.
- %
- % A single spaced quote (say) is done by surrounding singlespace with quote.
- %
- defsspace{%
- vskipparskip%
- vskipbaselineskip%
- defbaselinestretch{0.65}%
- ifx@currsizenormalsize@normalsizeelse@currsizefi%
- vskip-parskip%
- vskip-baselineskip%
- }
- defendsspace{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)
- %
- defspacing#1{par%
- defbaselinestretch{#1}%
- ifx@currsizenormalsize@normalsizeelse@currsizefi}
- defendspacing{par%
- vskip parskip%
- vskip baselineskip%
- endgroup%
- vskip -parskip%
- vskip -baselineskip%
- begingroup}
- defonehalfspace{spacing{1.5}}
- letendonehalfspace=endspacing
- defdspace{spacing{2}}
- letdspace=endspacing
- % 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 baselinestretchabovedisplayskip%
- belowdisplayskip abovedisplayskip%
- abovedisplayshortskip baselinestretchabovedisplayshortskip%
- belowdisplayshortskip baselinestretchbelowdisplayshortskip}
- % You may freely use, modify, and/or distribute this file, without limitation.
- %%% ======================================================================
- %%% @LaTeX-style-file{
- %%% filename = "setspace.sty",
- %%% codetable = "ISO/ASCII",
- %%% checksum = "11793 546 2608 21972",
- %%% 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.
- %%%
- %%% 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 (BP)
- %%% <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.
- %%%
- %%% GT, Thu 26 Nov 1998: Finally got round to
- %%% fixing the absence of begingroup from
- %%% onehalfspace and doublespace environments.
- %%% Thanks to: Bernd Schandl, Ron Smith,
- %%% Himanshu Gohel, and Kevin Ruland, for bringing
- %%% it to my long overdue attention.
- %%%
- %%% GT, Tue 27 July 1999: On Saturday 24 July
- %%% 1999, Alexander L. Wolf <alw@cs.colrado.edu>
- %%% informed me that the doublespace and
- %%% onehalfspace _macros_ are still at fault.
- %%%
- %%% GT, Fri 3 March 2000: Today Stefano
- %%% Lacaprara of Italy brought my attention to
- %%% the need to extend the commands and macros
- %%% to point sizes other than 10, 11 and 12.
- %%% Since there's no general formula for the
- %%% line stretch values in terms of point size,
- %%% and they vary only slightly between 10, 11
- %%% and 12 pt, and furthermore the values were
- %%% presumably optimised specifically for the
- %%% Computer Modern fonts, i've chosen to use
- %%% the 10 pt values as the generic defaults.
- %%%
- %%% GT, Fri 1 December 2000: George Pearson
- %%% requested package options for the three
- %%% common spacings.
- %%%
- %%% 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 {2000/12/01}
- def fileversion {6.7}
- ProvidesPackage {setspace}[filedatespacefileversionspace
- Contributed and Supported LaTeX2e package]
- typeout {Package: `setspace' fileversionspace <filedate>}
- % BP: add nodisplayskipstretch option and setdisplayskipstretch command.
- newcommand{displayskipstretch}{baselinestretch}
- newcommand{setdisplayskipstretch}[1]{renewcommand{displayskipstretch}{#1}}
- DeclareOption{nodisplayskipstretch}{setdisplayskipstretch{1.0}}
- % GT: add George Pearsons' suggested options.
- DeclareOption{singlespacing}{AtEndOfPackage{singlespacing}}
- DeclareOption{onehalfspacing}{AtEndOfPackage{onehalfspacing}}
- DeclareOption{doublespacing}{AtEndOfPackage{doublespacing}}
- ProcessOptions
- % GT: Sat 28 Sep 1996: Widely using newcommand, renewcommand, and
- % newenvironment, instead of def.
- % ** Line space commands.
- newcommand{setstretch}[1]{%
- defbaselinestretch{#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]{%
- defsetspace@singlespace{#1}%
- }
- % Here's the default single line spacing value.
- SetSinglespace{1}
- newcommand{singlespacing}{%
- setstretch {setspace@singlespace}% normally 1
- vskip baselineskip % Correction for coming into singlespace
- }
- newcommand{onehalfspacing}{%
- setstretch{1.25}% default
- ifcase @ptsize relax % 10pt
- setstretch {1.25}%
- or % 11pt
- setstretch {1.213}%
- or % 12pt
- setstretch {1.241}%
- fi
- }
- newcommand{doublespacing}{%
- setstretch {1.667}% default
- 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 baselinestretchbaselineskip
- parskip baselinestretchparskip
- setboxstrutbox hbox{%
- vrule height.7baselineskip
- depth.3baselineskip
- widthz@}%
- skipfootins baselinestretchskipfootins
- normalbaselineskipbaselineskip#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.
- %skipfootins 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 !
- letlatex@xfloat=@xfloat
- def@xfloat #1[#2]{%
- latex@xfloat #1[#2]%
- defbaselinestretch{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.
- longdef@footnotetext#1{%
- insertfootins{%
- % GT: Next line added. Hook desired here!
- defbaselinestretch {setspace@singlespace}%
- reset@fontfootnotesize
- interlinepenaltyinterfootnotelinepenalty
- splittopskipfootnotesep
- splitmaxdepth dpstrutbox floatingpenalty @MM
- hsizecolumnwidth
- @parboxrestore
- protected@edef@currentlabel{%
- csname p@footnoteendcsname@thefnmark
- }%
- color@begingroup
- @makefntext{%
- rulez@footnotesepignorespaces#1@finalstrutstrutbox}%
- color@endgroup}}
- % Minipage footnotes.
- longdef@mpfootnotetext#1{%
- globalsetbox@mpfootinsvbox{%
- unvbox @mpfootins
- % GT: Next line added. Hook desired here!
- defbaselinestretch {setspace@singlespace}%
- reset@fontfootnotesize
- hsizecolumnwidth
- @parboxrestore
- protected@edef@currentlabel{%
- csname p@mpfootnoteendcsname@thefnmark}%
- color@begingroup
- @makefntext{%
- rulez@footnotesepignorespaces#1@finalstrutstrutbox}%
- 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.5baselineskip
- }
- % 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}{%
- begingroup
- onehalfspacing
- }{%
- restore@spacing
- }
- % double spacing is 2 x pt size
- newenvironment{doublespace}{%
- begingroup
- 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.
- everydisplayexpandafter{%
- theeverydisplay
- abovedisplayskip displayskipstretchabovedisplayskip
- belowdisplayskip displayskipstretchbelowdisplayskip
- abovedisplayshortskip displayskipstretchabovedisplayshortskip
- belowdisplayshortskip displayskipstretchbelowdisplayshortskip
- }
- endinput
- %%% EOF.
Add Comment
Please, Sign In to add comment