Can someone tell me how to change the line spacing in a latex document.
I've tried what the book suggests (redefining \baselinestretch) but it
doesn't work (in fact \baselinestretch is not defined anywhere , or I can't
find it).
THANKS
For document-wide spacing, \def\baselinestretch{2} in the preamble ought to
set the baselinestretch to 2 (obviously, you can use anything in place of
2). Within a document, \renewcommand{\baselinestretch}{2} ought to do
similarly. However,......
Might I suggest that you look at two very handy style files which allow
switching within the document -- doublespace.sty and setspace.sty.
Doublespace provides support for single and double spacing, while setspace
allows for single, one and a half, and double spacing. Both files have
been made consistent with TeX 3.x and handles floats as well as footnotes
in a single-space mode; doublespace is also consistent with the NFSS (don't
know about setspace in that regard -- sorry). The major difference which
is nice to know about is that doublespace is hard-coded, while setspace is
point-size sensitive w.r.t. how it defines the non-unity baselinestretch.
Both are handy files; sites contemplating any non-default baselinestretch
ought to consider having at least one of these around (once you play with
them, you can see the subtle differences between them, which is why I
suggest both).
To retrieve either or both of the files via e-mail, include the commands:
SENDME STY.DOUBLESPACE
SENDME STY.SETSPACE
in the body of a mail message to FILE...@SHSU.BITNET (FILE...@SHSU.edu).
Alternately, the files are available for anonymous ftp retrieval from
Niord.SHSU.edu (192.92.115.8) in the directory [.STY]
Regards, George
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
George D. Greenwade, Ph.D. Bitnet: BED_GDG@SHSU
Department of Economics and Business Analysis THEnet: SHSU::BED_GDG
College of Business Administration Voice: (409) 294-1266
P. O. Box 2118 FAX: (409) 294-3612
Sam Houston State University Internet: bed...@SHSU.edu
Huntsville, TX 77341 bed_gdg%SHSU....@relay.the.net
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
For document-wide spacing, \def\baselinestretch{2} in the preamble ought to
set the baselinestretch to 2 (obviously, you can use anything in place of
2). Within a document, \renewcommand{\baselinestretch}{2} ought to do
similarly.
You should never use \def in a LaTeX document. Besides, the use of
\renewcommand{\baselinestretch}{2} in the preamble has the correct
effect, whereas this command in a document takes effect only at the
next size change.
Rainer Sch"opf
>In <1992Jan14.1...@bradford.ac.uk> (comp.text.tex, 14 Jan 92
>15:24:40 GMT), G.McCabe <no e-mail address provided> posted:
>> Can someone tell me how to change the line spacing in a latex document.
>> I've tried what the book suggests (redefining \baselinestretch) but it
>> doesn't work (in fact \baselinestretch is not defined anywhere , or I can't
>> find it).
>For document-wide spacing, \def\baselinestretch{2} in the preamble ought to
>set the baselinestretch to 2 (obviously, you can use anything in place of
>2). Within a document, \renewcommand{\baselinestretch}{2} ought to do
>similarly. However,......
You'd have to change the size of the text after changing the
baselinestretch. For example:
.
.
\renewcommand{\baselinestretch}{1.6}
\large
\normalsize
The quick brown fox jumps over the lazy dog.
.
.
> [ ... George suggests using doublespace.sty and setspace.sty, and
> tells where to find them .... ]
Regards,
---
Soh, Kam Hung | h....@trl.oz.au | Telecom Research Laboratories,
| +61 3 253 6638 | POB 249 Clayton, Victoria 3168, Australia
Why not?
I know that \newcommand and \renewcommand do some checking to
make sure that the command to be defined is "definable", and
\renewcommand makes sure that the command already exists while
\newcommand makes sure it doesn't. That's nice.
But if you're sure you know what you're defining, is there
any other reason not to use \def?
It certainly seems to work -- I use it all the time.
And I notice that even the "canonical" style files
article.sty, book.sty, and report.sty are crawling with
\def's -- not a \newcommand to be found. Nor are boxes
allocated with \newsavebox, nor counters with \newcounter;
even environments aren't always defined via \newenvironment.
I've never understood why LaTeX, which supports the allocation
functions of plain TeX such as \newcount and \newbox, and doesn't
seem to react badly to \def, was endowed with a complete set
of duplicate (or at least parallel) commands. They always seemed
to me to be frills: hand-holding alternatives intended for occasional
users but ignored by "power users" -- people who write their own
style files, for example.
Now Rainer says that \def should "never" be used!
I'm not contradicting, just asking: have I missed something?
What's the point?
--Cameron Smith, style file programmer and LaTeX junkie
cam...@symcom.math.uiuc.edu
In article <920116164...@sc.zib-berlin.dbp.de>
sch...@sc.ZIB-Berlin.DE (Rainer Schoepf) writes:
> [...] You should never use \def in a LaTeX document. [...]
>Rainer Sch"opf
Why not?
I know that \newcommand and \renewcommand do some checking to
make sure that the command to be defined is "definable", and
\renewcommand makes sure that the command already exists while
\newcommand makes sure it doesn't. That's nice.
It's not only nice, it's vital! Are you aware of *all* internal
commands so that you can avoid accidentally redefining one? Maybe you
are, but 99% of all LaTeX users are not.
A real life example: Someone wrote:
\def\or{something}
Can you imagine what happened? And how long it took to find out what
the problem was?
But if you're sure you know what you're defining, is there
any other reason not to use \def?
That's the point: you have to be sure. I think you will agree that you
need a great deal of knowledge to be sure -- certainly more than the
casual or even the regular user has.
It certainly seems to work -- I use it all the time.
And I notice that even the "canonical" style files
article.sty, book.sty, and report.sty are crawling with
\def's -- not a \newcommand to be found. Nor are boxes
allocated with \newsavebox, nor counters with \newcounter;
even environments aren't always defined via \newenvironment.
True. I'm not saying this is perfect. My main point is that you should
not use \def or \let in your LaTeX *document*. I agree that you cannot
avoid them in styles files.
Now Rainer says that \def should "never" be used!
I'm not contradicting, just asking: have I missed something?
What's the point?
To the casual user, you have to supply simple answers. :-) Also, we
all tend to copy and modify what we see somewhere. Therefore, I try to
never use \def/\let in a document itself, but rather make a small .sty
file.
--
Rainer Schoepf
Konrad-Zuse-Zentrum ,,Ich mag es nicht, wenn
fuer Informationstechnik Berlin sich die Dinge so frueh
Heilbronner Strasse 10 am Morgen schon so
D-1000 Berlin 31 dynamisch entwickeln!''
Federal Republic of Germany
<Sch...@sc.ZIB-Berlin.de> or <Sch...@sc.ZIB-Berlin.dbp.de>
--------------------------cut here----------------------------------
% Document style option "doublespace"
% -- usage: \documentstyle[...,doublespace,...]{...}
%
% WARNING!
% This option is provided for those who are COMPELLED by powers
% beyond their control to double-space their documents. Known
% powers of this kind include copy-editors and dissertation
% rule-makers in some universities. Double spacing is one of the
% best ways to ruin the appearance of a document and to render
% it difficult to read (in this respect it is equalled only by
% adding too many characters on a line).
%
% 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. (Note that on entering this environment the
% \normalsize command is issued automatically.)
% 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.
%
% 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.
%
% Author: Stephen Page -- sdp...@uk.ac.oxford.prg
% Release date: 6 July 1986, documentation revised 24 September 1986
%
% Known bugs:
% . The \singlespace environment works sometimes (e.g. around titles)
% but not always. Suggestions for a fix are welcomed!
% . 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.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---Set up double spacing
\def\baselinestretch{2}
%---New command "\setstretch" (slightly more mnemonic... and easier to type)
\def\setstretch#1{\renewcommand{\baselinestretch}{#1}}
%---New environment "singlespace".
% The baselinestretch only takes effect at a size change, so do one.
\def\singlespace{\def\baselinestretch{1}\@normalsize}
\def\endsinglespace{}
%---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#1\baselineskip
#2\baselineskip\baselinestretch\baselineskip
\setbox\strutbox\hbox{\vrule height.7\baselineskip
depth.3\baselineskip width\z@}
\normalbaselineskip\baselineskip#3#4}
%---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}\@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}}}
--------------------------cut here----------------------------------
--
***********************************************
マーチン ブス@東京大学生産技術研究所 橋本研
mar...@ics.iis.u-tokyo.ac.jp
***********************************************
--------------------------cut here----------------------------------
% Document style option "doublespace"
[...]
%---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#1\baselineskip
[...]
If you are using LaTeX with NFSS, you can't use this style.
The NFSS contains another definition of \@setsize!!
-bernd
>> In <1992Jan14.1...@bradford.ac.uk> (comp.text.tex, 14 Jan 92
>> 15:24:40 GMT), G.McCabe <no e-mail address provided> posted:
>> > Can someone tell me how to change the line spacing in a latex document.
>> > I've tried what the book suggests (redefining \baselinestretch) but it
>> > doesn't work (in fact \baselinestretch is not defined anywhere , or I can't
>> > find it).
>> For document-wide spacing, \def\baselinestretch{2} in the preamble ought to
>> set the baselinestretch to 2 (obviously, you can use anything in place of
>> 2). Within a document, \renewcommand{\baselinestretch}{2} ought to do
> similarly. However,......
>> Might I suggest that you look at two very handy style files which allow
>> switching within the document -- doublespace.sty and setspace.sty.
These style files may be more "correct" for general consumption, but I
have always had adequate satisfaction using the command
\renewcommand{\baselinestretch}{1.32}\tiny\normalsize within a document
to change spacing. The size changes seem to be necessary to "set" the
new baselinestretch, but you can get any stretch you want and it's
easy to remember or macro-ize.
-BJ
Brian Junker (412) 268 - 8873
Department of Statistics br...@stat.cmu.edu
232 Baker Hall FAX: (412) CMU-STAT
Carnegie Mellon University or (412) 268-7828
Pittsburgh PA 15213