Input and compilation/Overview of basic commands

From Wiki
Jump to navigation Jump to search

There are three main types of commands in ConTeXt:

  1. start-stop: To apply something to some text, enclose the text in \startsomething \stopsomething.
  2. setup: To configure something for the rest of the document, use \setupsomething.
  3. define: To create a named customization of something, use \definesomething.

Many commands don’t fit into one of these types, but here are some that do. For brevity, throughout this list \startsomething is shorthand for \startsomething \stopsomething.

Structure-related commands

These commands relate to the structure of a document.

Text formatting and decoration commands

These commands relate to how text is displayed, without repositioning the text (much).

  • \definehighlight and \setuphighlight: These allow you to define and configure different ways of highlighting text.
  • \defineframed, \setupframed: Use these to define and configure ways to place frames around single paragraphs of text. Note that this doesn’t break across pages.
  • \defineframedtext and \setupframedtext: Use these to define and configure ways to place frames around multiple paragraphs of text. Note that this doesn’t break across pages.
  • \definetextbackground and \setuptextbackground: Use these to define and configure ways to place frames around multiple paragraphs of text, in a way that will break across pages.
  • \definemathframed and \setupmathframed: Use these to define and configure ways to place frames around symbols within mathematics. (\definemathframed does not seem to be documented at this point, so it may or may not be implemented.)
  • \defineblank and \setupblank: These allow you to configure empty vertical space to insert in your document with \blank.
  • \definehspace: This allows you to configure empty horizontal space to insert in your document with \hspace.
  • \setupwhitespace: Use this to set the default amount of vertical space between paragraphs.
  • \setupinterlinespace: Use this to set the default amount of vertical space between lines within paragraphs.
  • \definelines and \setuplines: These allow you to define regions in which a new line in code really does mean a new line in the compiled output. As described in the Verse page, this is particularly suitable for typesetting poetry.
  • \definetyping and \setuptyping: A typing region is a region in which you are typesetting verbatim text, such as computer code. These commands allow you to define and configure such regions.
  • \definetype and \setuptype: type is inline text that you are typesetting verbatim, such as computer code. These commands allow you to define and configure such regions.

Layout and design commands

These commands relate to how text is laid out on the page, and possibly involve moving or positioning the text.

  • \definepapersize and \setuppapersize: Use these commands to define paper sizes and to set a document’ paper size.
  • \definelayout and \setuplayout: These allow you to define page layouts (which include the margins) and to set a document’s page layout. See the Document layout page for further details.
  • \setuppagenumbering: Use this to set how a document's pages are to be numbered. This setting is valid starting from where the \setuppagenumbering is issued, so to set the numbering for the whole document, put this command at the start.
  • \definelayer and \setuplayer: A layer is ConTeXt’s way to allow for absolute positioning on a page. These commands allow you to define and configure layers. See the Document layout and layers/Layers section for more information.
  • \setupcolors: This command allows you to set configure how color will be used in the document. See the Color page for more information.
  • \definecolor: Use this to give a name to a specific color.
  • \definecolorgroup: Use this to give a number to a group of colors.
  • \definepalet and \setuppalet: Use these to define and activate color palettes that can then be switched among throughuout the document. See the documentation for \setuppalet for further information.
  • \defineoverlay: overlays are predefined snippets that you can stack on each other. This command allows you to create overlays. See the Overlays page for further information.
  • \definecombination and \setupcombination: A combination is an alignment of several images. Use these commands to define and customize combinations. See the Combinations page for further information.


Utility commands

These commands have various functions that don’t relate directly to text formatting and design.

  • \defineconversion: Use this command to define a conversion, or way of transforming text, such as to upper-case or from a to (a). Then you can use such a conversion within various commands, such as \setupitemize.
  • \convertnumber: Use this command to convert numbers from one form to another, such as from Arabic numerals to lower-case Roman numerals.
  • \setupscale: A scale is a way of scaling text. This command allows you to customize the way that text is scaled with the \scale command. There is a similar \setuprotate for configuring rotations.