Text blocks/Tutorials

Unofficial ConTeXt Wiki mirror

Last modified: 2025-10-08

This tutorial will provides you an overview of the different main possibilities or main features for text blocks formatting. Each topic has (or should have…) also one or more more detailed pages for further customization and exploitation of options and features.

Alignment and indentation

Spacings

Indentation

Alignment

Use \startalignment[option1,…], based on \setupalign[option1,…]

For a one line content, you can use \leftaligned, \midaligned, \rightaligned:

To right-align the final words of an otherwise left-aligned line, see \wordright.

Usual sets of text blocks

Lists of items

The usual itemized or bullet lists with \startitemize.

Descriptions

Descriptions allows text blocks with text labels, such as definitions, with \definedescription[Name] which allows the use of \startName \stopName.

Enumeration

An enumeration is similar in principle to a description, but each text block is numbered, with \defineenumeration[Name] which allows the use of \startName \stopName. For example, for exercises:

Narrower

The instances of \startnarrower ... \stopnarrower are used for text with a smaller width than the main text. It can be indented on one or both sides.

Frames

The command \framed{content} or \startframed\stopframed, are used for adding frames, backgrounds and styling to a segment of text.

Usually we start with option align=normal to activate line breaking.

Quotes

Here you need \startquotation for quotation at block text level.

Columns

Columns is a complex features, which can be manage at the level of the text blocks, or of the whole document (currently at Text_blocks/Environments/Columns#Column_Sets.


TODO: create this page Document layout and layers/Columns (See: To-Do List)


To keep things simple, you can start with \startcolumns

Typing (verbatim)

Within ConTeXt's typing environment (between \starttyping and \stoptyping) everything is considered as text to type, commands have no effect.

\starttyping environment have quite a range of built-in options for formatting the verbatim text.

\starttyping[option=xml]
<?xml version="1.0" encoding="UTF-8"?>
<text>
  <para>hello world</para>
</text>
\stoptyping

Verses

The usual way to set verse in ConTeXt is to enclose it in \startlines \stoplines, which ensures that each new line in the code produces a line break in the compiled output. Additionally, \startlines has some arguments that can be used to configure how the lines of text look, such as their indentation patterns. As usual in ConTeXt, these arguments can be separated and applied throughout the document with \setuplines (and optionally \definelines).

Text background

To setup blocks of text,with a specific background, allowed to flow over the pages, you will need \definetextbackground[MyTextBackEnv] and the associated \definetextbackground[MyTextBackEnv]].

And you can also take benefit of MetaPost and MetaFun features.