From ConTeXt wiki
Revision as of 21:22, 17 July 2014 by Adityam (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

< Visuals

In plain TeX, controlling indentation is simple: The user sets a value for parindent, and each new paragraph is indented by that value, unless explicitly begun with noindent. Environments can provide a noindent at the end of their definitions, and if the user wants to overrule that, he can add an explicit indent at the beginning of the next paragraph. For the most part, LaTeX follows the same convention.

Indentation in ConTeXt are a bit different: it mostly does not rely on the presence of blank lines, but uses \setupindenting to manage general indentation, the indentnext=yes/no/auto key on environments to enable/disable indentation after them, and \indentation and \noindentation to manually force/disable an indentation.

The commands \indent, \noindent, \indenting, and \noindenting are present for historical reasons, but should not be used. Especially, they should not be confused with \indentation and \noindentation


Setting up indentation for the whole document

Indentation involves two things: when to indent, and how much to indent. In ConTeXt, these can be specified using \setupindenting[...]. There are three types of keys for this command:

Setting up indentation after an environment

\setupindenting does not take care of indenting after environments, such as ConTeXt's itemizes, enumerations, definitions, formulas and floats. It also does not take care of indenting after heads such as chapters, sections, and subsections.

The setup command of these environments provides an indentnext key to configure the indentation behaviour after the environment. The indentnext key can take one of three values:

Some examples:

% Do not indent paragraphs after \stopitemize

% indent paragraphs after section heads

% indent the paragraphs after all sectioning heads 

% indent paragraphs after formulas if there is a blank space in between

Setting up indentation inside environments

There is one case that is not taken care of by \setupindenting and the indentnext key: indentation of paragraphs inside multi-paragraph environments such as itemizes, descriptions, and enumerations. By default ConTeXt does not indent such paragraphs. The setup commands of these environments provides an indenting= key to configure the indentation behaviour of paragraphs inside these environments. This key takes the same arguments as the \setupindenting command does. An example using \setupitemgroup:


\item This is an example of a multi|-|paragraph 
      item inside an itemize environment.

      This second paragraph is indented by 40pt
      (double the normal indentation).


Manual indentation

No matter how careful we are with all the settings, there are some cases which cannot be taken care of by automatic indentation, and we have to tell ConTeXt how to indent. This is done with \indentation and \noindentation. The Plain TeX (and LaTeX) commands \indent and \noindent are defined in ConTeXt, but are not hooked into the indentation mechanism.

Suppose the default setup for an article is

\setupitemgroup [itemize] [indentnext=no]

Now, if we want to indent after an itemize, starting the next paragraph with \indent does not work; to get indentation we have to say \indentation. For example,


\setupindenting [big,yes]
\setupitemgroup [itemize] [indentnext=no]

    \item A dummy list with \type{indentnext=no}...
    \item test the \tex{indent} command

\indent This paragraph is not indented, because \tex{indent} does not work.

    \item Another dummy list with \type{indentnext=no}...
    \item test the \tex{indentation} command

\indentation This paragraph will be indented, because we used \tex{indentation}.



Personal tools
External Help