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
|
<head>
<title>UK TeX FAQ -- question label chngmargonfly</title>
</head><body>
<h3>Changing margins “on the fly”</h3>
<p/>One of the surprises characteristic of TeX use is that you cannot
change the width or height of the text within the document, simply by
modifying the text size parameters; TeX can’t change the text width
on the fly, and LaTeX only ever looks at text height when starting
a new page.
<p/>So the simple rule is that the parameters should only be
changed in the preamble of the document, i.e., before the
<code>\</code><code>begin{document}</code> statement (so before any typesetting has
happened.
<p/>To adjust text width within a document we define an environment:
<blockquote>
<pre>
\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}
</pre>
</blockquote><p>
The environment takes two arguments, and will indent the left and
right margins, respectively, by the parameters’ values. Negative
values will cause the margins to be narrowed, so
<code>\</code><code>begin{changemargin}{-1cm}{-1cm}</code> narrows the left and right
margins by 1 centimetre.
<p/>Given that TeX can’t do this, how does it work? — well, the
environment (which is a close relation of the LaTeX
<code>quote</code> environment) <em>doesn’t</em> change the text width
as far as TeX is concerned: it merely moves text around inside the
width that TeX believes in.
<p/>The <i>changepage</i> package provides ready-built commands to do
the above; it includes provision for changing the shifts applied to
your text according to whether you’re on an odd (<em>recto</em>) or an
even (<em>verso</em>) page of a two-sided document.
<i>Changepage</i>’s structure matches that of the <i>memoir</i>
class.
<p/>The (earlier) package <i>chngpage</i> provides the same facilities,
but it uses rather different syntax. <i>Changepage</i>’s structure
matches that of the <i>memoir</i> class, and it should be used for
any new work.
<p/>Changing the vertical dimensions of a page is more clumsy still: the
LaTeX command <code>\</code><code>enlargethispage</code> adjusts the size of the current
page by the size of its argument. Common uses are
<blockquote>
<pre>
\enlargethispage{\baselineskip}
</pre>
</blockquote><p>
to make the page one line longer, or
<blockquote>
<pre>
\enlargethispage{-\baselineskip}
</pre>
</blockquote><p>
to make the page one line shorter. The process is (to an extent)
simplified by the <i>addlines</i> package: its <code>\</code><code>addlines</code>
command takes as argument the <em>number</em> of lines to add to the
page (rather than a length): the package documentation also provides a
useful analysis of when the command may (or may not) be expected to
work.
<dl>
<dt><tt><i>addlines.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/addlines.zip">macros/latex/contrib/addlines</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/addlines/">browse the directory</a>)
<dt><tt><i>changepage.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/misc/changepage.sty">macros/latex/contrib/misc/changepage.sty</a>
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=chngmargonfly">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=chngmargonfly</a>
</body>
|