Help:Context

From Wiki
Revision as of 11:46, 14 June 2012 by Esteis (talk | contribs) (Create help page for <context> tag)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The <context> ... </context> tags process their ConTeXt contents on the fly and include the result on the page as an image. Whitespace is cropped out. The following options are available:

  • source=yes displays the source before the output.
  • text="some text" places 'some text' between the source and the output.
  • mode=mkiv ensures Mark IV is used instead of the default Mark II.


Examples

Plain example

Wiki markup Wiki display
<context>
\setupcolors [state=start]
\framed [background=color,
         backgroundcolor=green,
         offset=0.5cm ]{hello world!}
</context>

source=yes

Wiki markup Wiki display
<context source="yes" text="produces">
\setupcolors [state=start]
\framed [background=color,
         backgroundcolor=green,
         offset=0,5cm ]{hello world!}
</context>
\setupcolors [state=start]
\framed [background=color,
         backgroundcolor=green,
         offset=0.5cm ]{hello world!}

produces

mode=mkii and mode=mkiv

Wiki markup Wiki display
<context source="yes">
Version: \contextversionnumber
</context>
Version: \contextversionnumber
<context mode=mkiv source="yes">
% mode=mkiv
Version: \contextversionnumber
</context>
% mode=mkiv
Version:
\contextversionnumber

Displaying multiple pages

\setuppapersize[A10, landscape][A8, landscape]

\setuppaper[nx=2, ny=2]     % arrange pages 2 by 2 (must come before \setuparranging[XY])
\setuparranging[XY]         % arrange pages n by n (across, then down)
\setuppagenumbering[footer] % page numbers are always useful
\showframe[edge]            % Draw line around each page. Prevents overzealous cropping

one \page[yes]
two \page[yes]
three \page[yes]
four