Changes

Jump to navigation Jump to search
1,354 bytes removed ,  06:32, 16 April 2021
m
no edit summary
In plain TeX, controlling indentation is accomplished by configuring < [[Visuals]]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.
In plain TeX, controlling indentation Indentation in ConTeXt is simplea bit different: The user sets a value for <tt>parindent</tt>it mostly does not rely on the presence of blank lines, and each new paragraph is indented by that valuebut uses {{cmd|setupindenting}} to manage general indentation, unless explicitly begun with the <ttcode>noindentindentnext=yes/no/auto</ttcode>. Environments can provide a <tt>noindent<key on environments to enable/tt> at the end of their definitionsdisable indentation after them, and if the user wants {{cmd|indentation}} and {{cmd|noindentation}} to overrule that, he can add manually force/disable an explicit <tt>indent</tt> at the beginning of the next paragraph. For the most part, LaTeX follows the same conventionindentation.
SoThe commands {{cmd|indent}}, {{cmd|noindent}}, {{cmd|indenting}}, understanding indentation in plain TeX and LaTeX boils down to this: set a value {{cmd|noindenting}} are present for <tt>parindent</tt>historical reasons, and start a new paragraph (i.e., leave an empty line) whenever you want indentation. For example, LaTeX usually does but should not indent the first line after a sectioning command. If you want to indent the first line after a sectioning command you use the <code>indentfirst</code> package (which is part of the required LaTeX bundle)be used. If you want to indent the paragraph after an environmentEspecially, you leave a blank line after the end of the environment; if you do they should not want to indent after the end of an environment, you do not leave a blank line. It takes a while to get used to, but the rules are easy to remember be confused with {{cmd|indentation}} and eventually you do not need to even think about indentation; it becomes a matter of habit. {{cmd|noindentation}}
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 it, the reason is that Hans Hagen, the author of ConTeXt, 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, this style means that the '== Setting up indentation after empty lines' paradigm of plain TeX and LaTeX cannot be used for indentations. So, ConTeXt provides an alternative. As with other things in ConTeXt, this alternative is consistent and easy to configure; but if you are used to other TeX formats it takes some time to get comfortable with it. the whole document ==
== 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>''first'' next</code>: turn indentation of first paragraph on/off. Can be overridden by environments with <code>indentnext=yes/no/auto</code>.
* <code>odd even</code>: indent odd/even lines in \obeylines scopes
* <code>normal</code>: what does this do?the globally defined size of indent. Useful when used as the values of the `indenting` key of different environments.
=== 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[[Category: {{cmd|indenting}} and {{cmd|noindenting}}. {{cmd|indenting}} is similar to {{cmd|setupindenting}} and is provided for backward compatibility; {{cmd|noindenting}} is equivalent to <tt>{{cmd|setupindenting}}[noBasics]]</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.
419

edits

Navigation menu