Changes

Jump to navigation Jump to search
1,331 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.
So, understanding indentation in plain TeX and LaTeX boils down to this: 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 does not The commands {{cmd|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). If you want to indent the paragraph after an environment}}, you leave a blank line after the end of the environment; if you do not want to indent after the end of an environment{{cmd|noindent}}, you do not leave a blank line. It takes a while to get used to{{cmd|indenting}}, 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 {{cmd|noindenting}} are a bit different; and sometimes difficult to understand. In this article I hope to explain how ConTeXt does indentations. Firstpresent for historical reasons, let's understand why ConTeXt does indentations differently; why does it but should 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 'indentation after empty lines' paradigm of plain TeX and LaTeX cannot 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}}
== 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 ==
(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