Changes

Jump to navigation Jump to search
1,425 bytes removed ,  08:11, 12 April 2019
no edit summary
In plain TeX, controlling indentation is simple: The user sets a value for <tt>parindent</tt>, and each new paragraph is indented by that value, unless explicitly begun with <tt>noindent</tt>. Environments can provide a <tt>noindent</tt> at the end of their definitions, and if the user wants to overrule that, he can add an explicit <tt>indent</tt> at the beginning of the next paragraph. For the most part, LaTeX follows the same convention.
So, understanding indentation Indentation in plain TeX and LaTeX boils down to thisConTeXt are a bit different: set a value for <tt>parindent</tt>, and start a new paragraph (i.e., leave an empty line) whenever you want indentation. For example, LaTeX usually it mostly does not indent rely on the first line after a sectioning command. If you want presence of blank lines, but uses {{cmd|setupindenting}} to indent the first line after a sectioning command you use manage general indentation, the <code>indentfirstindentnext=yes/no/auto</code> package (which is part of the required LaTeX bundle). If you want key on environments to indent the paragraph enable/disable indentation after an environmentthem, you leave a blank line after the end of the environment; if you do not want and {{cmd|indentation}} and {{cmd|noindentation}} to indent after the end of manually force/disable an environment, you do not leave a blank line. It takes a while to get used to, but the rules are easy to remember and eventually you do not need to even think about indentation; it becomes a matter of habit.
Indentations in ConTeXt are a bit different; and sometimes difficult to understand. In this article I hope to explain how ConTeXt does indentations. First, let's understand why ConTeXt does indentations differently; why does it not simply follow the time-tested approach of plain TeX and LaTeX? The way I understand itcommands {{cmd|indent}}, the reason is that Hans Hagen{{cmd|noindent}}, the author of ConTeXt{{cmd|indenting}}, prefers ''spaced out'' markup &mdash; surrounding each environment by empty lines &mdash; which makes it easy to see where an environment starts and ends while reading the source file. However{{cmd|noindenting}} are present for historical reasons, this style means that the 'indentation after empty lines' paradigm of plain TeX and LaTeX cannot but should not be used for indentations. SoEspecially, ConTeXt provides an alternative. As they should not be confused with other things in ConTeXt, this alternative is consistent {{cmd|indentation}} and easy to configure; but if you are used to other TeX formats it takes some time to get comfortable with it. {{cmd|noindentation}}
== The basics ===== 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 <tt>{{cmd|setupindenting}}<tt>[...]</tt>. There are three types of keys for this command:
* <code>''no'' yes</code>: turn indentation on/off'
* <code>normal</code>: what does this do?
=== Setting up indentation after an environment ===
{{cmd|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.
</texcode>
=== Setting up indentation inside environments ===
There is one case that is not taken care of by {{cmd|setupindenting}} and the <code>indentnext</code> 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 <code>indenting=</code> key to configure the indentation behaviour of paragraphs inside these environments. This key takes the same arguments as the {{cmd|setupindenting}} command does. An example using {{cmd|setupitemgroup}}:
(double the normal indentation).
\stopitemize
</context>
 
== "indentnext=auto" demo ==
 
<context source = "yes" text="gives:">
\setupindenting[medium,yes]
\setupitemize[indentnext=auto]
 
\startitemize
\item One
\stopitemize
 
This paragraph should be indented - due to the blank line after \type{\stopitemize}.
 
\startitemize
\item Two
\stopitemize
This paragraph should not be indented.
</context>
== 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. Plain TeX (and LaTeX) provide the This is done with {{cmd|indentindentation}} and {{cmd|noindentnoindentation}} . The Plain TeX (and LaTeX) commands for explicitly indenting <tt>\indent</tt> and preventing indenting of a paragraph. These commands <tt>\noindent</tt> are defined in ConTeXt , but are not hooked into the ConTeXt indentation mechanism. Instead, ConTeXt provides {{cmd|indentation}} and {{cmd|noindentation}} which achieve the same effect.
Suppose the default setup for an article is
</context>
== Beware of typos == ConTeXt defines two more commands not commonly used: {{cmd|indentingGetting started navbox}} and {{cmd|noindenting}}. {{cmd|indenting}} is similar to {{cmd|setupindenting}} and is provided for backward compatibility; {{cmd|noindenting}} is equivalent to <tt>{{cmd|setupindenting}}[no]</tt>. Unfortunately, these commands sound very similar to {{cmd|indentation}} and {{cmd|noindentation}}, thus can be easily used by mistake. If you happen to write {{cmd|noindenting}} instead of {{cmd|noindentation}} in a document, it can take a while to debug.
105

edits

Navigation menu