Changes

Jump to navigation Jump to search
76 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).
<texcode>\setuppapersize[A4]</texcode>
== Pre-defined paper sizes Predefined Paper Sizes ==
Both 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:
* <tt>letter<; ISO (EN/tt>, <tt>ledger</tt>, <tt>tabloid</tt>, <tt>legal</tt>, <tt>folio</tt>, and <tt>executive</tt> DIN) sizes from the North American paper standard;: :* sizes <tt>A0</tt> &ndash; <tt>A10</tt>, <tt>B0</tt> &ndash; <tt>B10</tt>, series A and <tt>C0</tt> &ndash; <tt>C10</tt> from the A, B, and C series of the from ISO-216 standard;(e.g. "A4"):* envelope: serie C 0–10, plus DL:* sizes <tt>RA0</tt> &ndash; <tt>RA4</tt> and <tt>SRA0</tt> &ndash; <tt>SRA4</tt> from the series RA and , SRA series of 0–4, from ISO-217 paper standard;:* sizes <tt>ISO-based "2 A0" (double A0), "4 A0", "C6/C5</tt>", A3plus; US sizes:* letter, ledger, tabloid, legal, folio, executive, A, <tt>DL</tt>B, and <tt>E4</tt> from ISO-269 standard envelope sizes;C:* <tt>envelope: "envelope 9</tt> &ndash" (10, 11, 12, 14), monarch, check, DL, E4; <tt>envelope 14</tt> Swedish sizes from the American postal standard;:* sizes <tt>G5</tt> and <tt>E5</tt> from the Swedish SIS-014711 standard. These are used for Swedish theses;; Screen sizes:* size <tt>CD</tt> for CD covers;4:3 ratio: S3–6 (width 300–600 pt):* size <tt>S3</tt> &ndash; <tt>S6</tt>1:1 ratio: S33, <tt>S8</tt>S44, <tt>SM</tt>S55, and <tt>SW</tt> for screen sizesS66 (300 &times; 300 pt etc. These sizes are useful for presentations. <tt>S3</tt> ):* 8:5 ratio: SM (720 &ndashtimes; <tt>450 pt), they have the same height as S6</tt> and <tt>S8</tt> have an aspect :* 16:9 ratio of 4:3. <tt>S3</tt> is 300pt wide, <tt>S4</tt> is 400pt wide, and so on. <tt>S6</tt> is almost as wide as a <tt>A4</tt> paper. <tt>SM</tt> and <tt>SW</tt> are for medium and wide screens(800 &times; 450 pt), they have the same height as <tt>S6</tt>;* a few more paper sizes, which I will not mention here. See <tt>page-lay.mkiCD (i|v120 &times; 120 mm)</tt> for details.CD Covers
Plus keywords oversized (plus 1.5 cm), doublesized, doubleoversized, undersized (minus 1.5 cm). For definitions, see {{src|page-lay.mkii}} and {{src|page-lay.mkiv}}. == 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 <{{cmd>|definepapersize</cmd>}}. For example, <tt>A4</tt> paper is defined as:
<texcode>\definepapersize [A4] [width=210mm,height=297mm]</texcode>
<texcode>\definepapersize[main] [A4]
\definepapersize[extra][A4,landscape]</texcode>
One way to change document size is to permanently change the paper size using <{{cmd>|setuppapersize</cmd> }} and then revert back using <{{cmd>|setuppapersize</cmd>}}.
<texcode>% Set the default paper size
\stoptext</texcode>
The <{{cmd>|page</cmd> }} before <{{cmd>|setuppapersize</cmd> }} is necessary as <{{cmd>|setuppapersize</cmd> }} 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 <{{cmd>|setuppapersize</cmd>}}, a convenient alternative is to use <{{cmd>|adaptpapersize</cmd>}}, which automatically reverts back to the existing paper size after ''one'' page. This is illustrated by the following example.
<texcode>\setuppapersize[main]
Page 4. Portrait \page
\stoptext</texcode>
As with <{{cmd>|setuppapersize</cmd>}}, always use an explicit <{{cmd>|page</cmd> }} before <{{cmd>|adaptpapersize</cmd>}}.
= 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 <{{cmd>|setuppapersize</cmd>}}:
<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 <{{cmd>|definepapersize</cmd>}}. 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:ConTeXt-IssuesLayout]]

Navigation menu