Changes

Jump to navigation Jump to search
107 bytes added ,  12:35, 8 June 2020
no edit summary
{{Todo | Merge with [[PaperSizes]] and [[Layout]] }}
 
Paper setup is one of the most basic requirements for creating your own style. In this article, the basics of paper setup are explained; the more advanced setups are described in the [http://context.aanhet.net/svn/contextman/context-reference/en/co-pagedesign.pdf Page Design] chapter of the new ConTeXt manual.
= Basic setup =
== Setting paper size ({{cmd|setuppapersize}}) ==
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. To get , for letter paper, use:<ref>The syntax used here only works with ConTeXt versions newer than February 2011. In earlier versionsBefore that, you had to use
<texcode>\setuppapersize[letter][letter]</texcode>
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).
</ref>:
<texcode>\setuppapersize[letter]</texcode>
<texcode>\setuppapersize[A4]</texcode>
== Pre-defined paper sizes ==
Both == Predefined Paper Sizes == Beyond <tt>A4</tt> and <tt>letter</tt> are predefined paper sizes. , ConTeXt predefines many other commonly used paper sizes(see [[Paper sizes|Paper sizes page]] for actuals dimensions in mm). These include: ; ISO (EN/DIN) sizes: :* series A and B, from ISO-216 standard (e.g. "A4"):* envelope: serie C 0–10, plus DL:* series RA, SRA 0–4, from ISO-217 standard;:* ISO-based "2 A0" (double A0), "4 A0", "C6/C5", A3plus; US sizes:* letter, ledger, tabloid, legal, folio, executive, A, B, C:* envelope: "envelope 9" (10, 11, 12, 14), monarch, check, DL, E4; Swedish sizes:* sizes <tt>G5</tt> and <tt>E5</tt> from SIS-014711 standard. These are used for Swedish theses;; Screen sizes:* 4:3 ratio: S3–6 (width 300–600 pt):* 1:1 ratio: S33, S44, S55, S66 (300 &times; 300 pt etc.):* 8:5 ratio: SM (720 &times; 450 pt), they have the same height as S6:* 16:9 ratio: SW (800 &times; 450 pt), they have the same height as S6; CD (120 &times; 120 mm) for CD Covers
* <tt>letter</tt>, <tt>ledger</tt>, <tt>tabloid</tt>, <tt>legal</tt>, <tt>folio</tt>, and <tt>executive</tt> sizes from the North American paper standard;* sizes <tt>A0</tt> &ndash; <tt>A10</tt>, <tt>B0</tt> &ndash; <tt>B10</tt>, and <tt>C0</tt> &ndash; <tt>C10</tt> from the A, B, and C series of the ISO-216 standard;* sizes <tt>RA0</tt> &ndash; <tt>RA4</tt> and <tt>SRA0</tt> &ndash; <tt>SRA4</tt> from the RA and SRA series of ISO-217 paper standard;* sizes <tt>C6/C5</tt>, <tt>DL</tt>, and <tt>E4</tt> from ISO-269 standard envelope sizes;* <tt>envelope 9</tt> &ndash; <tt>envelope 14</tt> sizes from the American postal standard;* sizes <tt>G5</tt> and <tt>E5</tt> from the Swedish SIS-014711 standardPlus keywords oversized (plus 1. These are used for Swedish theses;* size <tt>CD</tt> for CD covers;* size <tt>S3</tt> &ndash; <tt>S6</tt>5 cm), <tt>S8</tt>doublesized, <tt>SM</tt>doubleoversized, and <tt>SW</tt> for screen sizesundersized (minus 1. These sizes are useful for presentations5 cm). <tt>S3</tt> &ndash; <tt>S6</tt> and <tt>S8</tt> have an aspect ratio of 4:3. <tt>S3</tt> is 300pt wideFor definitions, <tt>S4</tt> is 400pt wide, and so onsee {{src|page-lay. <tt>S6</tt> is almost as wide as a <tt>A4</tt> paper. <tt>SM</tt> mkii}} and <tt>SW</tt> are for medium and wide screens; they have the same height as <tt>S6</tt>;* a few more paper sizes, which I will not mention here. See <tt>{{src|page-lay.mki(i|v)</tt> for detailsmkiv}}.
== Defining new paper sizes ({{cmd|definepapersize}})==
The predefined paper sizes in ConTeXt cannot fit all needs. To define a new paper size, use
<texcode>\definepapersize[exotic]
[width=50mm, height=100mm]</texcode>
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 <tt>\{{cmd|definepapersize</tt>}}. For example, <tt>A4</tt> paper is defined as:
<texcode>\definepapersize [A4] [width=210mm,height=297mm]</texcode>
Normally, the paper size is set up once&mdash;in the environment file&mdash;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:
<texcode>\setuppapersizedefinepapersize[main] [A4]\setuppapersizedefinepapersize[extra][A4,landscape]</texcode>One way to change document size is to permanently change the paper size using <tt>\{{cmd|setuppapersize</tt> }} and then revert back using <tt>\{{cmd|setuppapersize</tt>}}.
<texcode>% Set the default paper size
\stoptext</texcode>
The <tt>\{{cmd|page</tt> }} before <tt>\{{cmd|setuppapersize</tt> }} is necessary as <tt>\{{cmd|setuppapersize</tt> }} 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 <tt>\{{cmd|setuppapersize</tt>}}, a convenient alternative is to use <tt>\{{cmd|adaptpapersize</tt>}}, which automatically reverts back to the existing paper size after ''one'' page. This is illustrated by the following example.
<texcode>\setuppapersize[main]
\starttext
Page 1. Potrait Portrait \pagePage 2. Potrait Portrait \page
\adaptpapersize[extra]
Page 3. Landscape \page
Page 4. Potrait Portrait \page
\stoptext</texcode>
As with <tt>\{{cmd|setuppapersize</tt>}}, always use an explicit <tt>\{{cmd|page</tt> }} before <tt>\{{cmd|adaptpapersize</tt>}}.
= 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&mdash;so you print on a large paper and crop later&mdash;or because the page size that you are using is not standard. For example, suppose you want to print an <tt>A5</tt> page on a an <tt>A4</tt> paper (and crop later). For that, you need to specify that the paper size is <tt>A5</tt> but the ''print paper'' size is <tt>A4</tt>. This information is specified using the two argument version of the <tt>\{{cmd|setuppapersize</tt>}}:
<texcode>\setuppapersize[A5][A4]</texcode>
== 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 <tt>\{{cmd|definepapersize</tt>}}. For example, suppose you want to define two paper-size/print-paper-size combinations: <tt>A4</tt> paper on <tt>A4</tt> print paper for normal work flow, and <tt>A4</tt> paper on <tt>A3</tt> print paper for the final proofs. For that, use the following:
<texcode>\definepapersize[regular][A4][A4]
\doifmode{proof}{\setuppapersize[proof]}</texcode>
Then, when you compile the document in the normal manner, you will get <tt>A4</tt> paper on <tt>A4</tt> print paper; if you compile the document with <tt>--mode=proof</tt>, then you will get a <tt>A4</tt> paper on <tt>A3</tt> print paper.
 
= Fitting pages to their content =
 
ConTeXt has three commands that create a page that is exactly large enough to fit its contents.
 
* {{cmd|startTEXpage}} — start a page that fits its contents exactly. Or has some extra space around the edges, if you specify offset.
* {{cmd|startpagefigure}} — start a page just large enough to fit a figure, possibly with some text underneath
* {{cmd|startMPpage}} — start a page just large enough to fit its MetaPost contents
= Notes =
<references />
 
[[Category:Layout]]

Navigation menu