/
tb101mahajan.txt
executable file
·237 lines (162 loc) · 7.62 KB
/
tb101mahajan.txt
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
% Paper setup
% Aditya Mahajan
% adityam (at) ieee (dot) org
Basic setup
===========
Setting paper size
------------------
Plain \TEX{} and \LATEX{} were primarily developed in the US. So, they default to
letter paper, which is the standard paper size in the US. \CONTEXT{} was developed
in the Netherlands. So, it defaults to A4 paper, which is the
standard paper size in Europe (and almost everywhere else in the world).
Changing paper size is easy. for letter size use:[^syntax]
\setuppapersize[letter]
Similarly, to get A4 paper, use:
\setuppapersize[A4]
[^syntax]: The syntax used here only works with \CONTEXT{} versions newer than
February 2011. Before that, you had to use
\setuppapersize[letter][letter]
to get letter sized paper. You may wonder why we need to repeat the paper size
twice. In most cases, these are the same. You only need to use different
arguments if you want to print on a bigger paper and trim it later (see
the section on print size for details).
Pre-defined paper sizes
-----------------------
Both `A4` and `letter` are predefined paper sizes. \CONTEXT{} predefines
many other commonly used paper sizes. These include:
- `letter`, `ledger`, `tabloid`, `legal`, `folio`, and `executive` sizes from
the North American paper standard;
- sizes `A0` -- `A10`, `B0` -- `B10`, and `C0` -- `C10` from the A, B, and C
series of the ISO-216 standard;
- sizes `RA0` -- `RA4` and `SRA0` -- `SRA4` from the RA and SRA series of
ISO-217 paper standard;
- sizes `C6/C5`, `DL`, and `E4` from ISO-269 standard envelope sizes;
- `envelope 9` -- `envelope 14` sizes from the American postal standard;
- sizes `G5` and `E5` from the Swedish SIS-014711 standard. These are used for
Swedish theses;
- size `CD` for CD covers;
- size `S3` -- `S6`, `S8`, `SM`, and `SW` for screen sizes. These sizes are
useful for presentations. `S3` -- `S6` and `S8` have an aspect ratio of
$4:3$. `S3` is 300pt wide, `S4` is 400pt wide, and so on. `S6` is almost
as wide as a `A4` paper. `SM` and `SW` are for medium and wide screens; they
have the same height as `S6`;
- a few more paper sizes, which I will not mention here. See
`page-lay.mki(i|v)` for details.
Defining new paper sizes
-------------------------
The predefined paper sizes in \CONTEXT{} cannot fit all needs. To define a new
paper size, use
\definepapersize[exotic]
[width=50mm, height=100mm]
which defines a paper that is 50mm wide and 100mm high; the name of this paper
is _exotic_ (we could have used any other word). All predefined paper sizes are
defined using `\definepapersize`. For example, `A4` paper is defined as:
\definepapersize [A4] [width=210mm,height=297mm]
Use this new paper size like any of the predefined paper sizes. For example, to
set the paper size to 50mm x 100mm paper, use
\setuppapersize[exotic]
Orientation
-----------
Most of the popular paper sizes default to a portrait orientation. To get
landscape orientation, use
\setuppapersize[letter,landscape]
Changing paper setup mid-document
=======================================
Normally, the paper size is set up once---in the environment file---and doesn't
need to be changed later. But, occasionally, changing paper size mid-document is
needed; for example, to insert a table or a figure in landscape mode.
There are two ways to change the paper size mid-document.
To illustrate those, let us first define two paper sizes for convenience:
\setuppapersize[main] [A4]
\setuppapersize[extra][A4,landscape]
One way to change the document size mid-document is simply to call
% Set the default paper size
\setuppapersize[main]
\starttext
% ...
% text with main paper size
% ...
\page \setuppapersize[extra]
% ...
% pages in landscape mode
% ...
\page \setuppapersize[main]
% ...
% back to main paper size
% ...
\stoptext
The `\page` before `\setuppapersize` is necessary as `\setuppapersize` changes
the size of the current page.
Often times, a different paper size is needed only for one page. Rather than
manually switching the paper size back and forth using `\setuppapersize`, a
convenient alternative is to use `\adaptpapersize`, which automatically reverts back to the
existing paper size after _one_ page. For example:
\setuppapersize[main]
\starttext
Page 1. Potrait \page
Page 2. Potrait \page
\adaptpapersize[extra]
Page 3. Landscape \page
Page 4. Potrait \page
\stoptext
As with `\setuppapersize`, always use an explicit `\page` before
`\adaptpapersize`.
Setting print size
==================
Occasionally you may want to print on a larger paper than the actual page size.
This could be because you want to print to the edge of the page---so you
print on a large paper and crop later---or because the page size that you are
using is not standard.
For example, suppose you want to print an `A5` page on a
`A4` paper (and crop later). For that, you need to specify that the paper size
is `A5` but the _print paper_ size is `A4`. This information is specified with
the two argument version of the `\setuppapersize`:
\setuppapersize[A5][A4]
Changing page location
----------------------
By default, this places the `A5` page on the top left corner of the `A4` paper.
To place the `A5` page in the middle of the `A4` paper use:
\setuppapersize[A5][A4]
\setuplayout[location={middle,middle}]
Other possible values for `location` are: `{top,left}`, `{top,middle}`,
`{top,right}`, `{middle,right}`, `{middle,left}`, `{bottom,left}`,
`{bottom,middle}`, and `{bottom,right}`. Since `{middle, middle}` is the most
commonly used value, it has a shortcut---`location=middle`.
If you use `{*,left}` or `{*,right}` and print double-sided, then also add
`duplex` as an option; for example `location={duplex,top,left}`. This ensures
that the page paper is moved appropriately on even pages.
Crop marks
---------
To get crop marks (also called cut marks):
\setuplayout[marking=on]
By default, the page numbers are also included with the crop marks.
To get additional information like job name, current date and time along with
the crop marks, use
\setuplayout[marking=text]
If you want just the crop marks, and no other text, use
\setuplayout[marking=empty]
Defining page and print size combinations
-----------------------------------------
It is convenient to define paper-size/print-paper-size combination for later
reuse. These are also defined using `\definepapersize`. For example, suppose you
want to define two paper-size/print-paper-size combinations: `A4` paper on `A4`
print paper for normal work flow, and `A4` paper on `A3` print paper for the
final proofs. For that, use the following:
\definepapersize[regular][A4][A4]
\definepapersize[proof] [A4][A3]
You can then combine these paper sizes with modes:[^modes]
\setuppapersize[regular]
\doifmode{proof}{\setuppapersize[proof]}
[^modes]: See the previous article on _Conditional Processing_ in this series,
a slightly modified version of which is available on the ConTeXt wiki
<http://contextgarden.net/Modes>
Then, when you compile the document in the normal manner, you will get `A4`
paper on `A4` print paper; if you compile the document with `--mode=proof`, then
you will get a `A4` paper on `A3` print paper.
Conclusion
==========
Paper setup is one of the most basic requirements for creating your own
style. In this article, I explained the basics of paper setup, deliberately
leaving out more advanced setups that are described in the _Page Design_
chapter[^page] of the new ConTeXt manual.
[^page]: <http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf>