I think you are confusing the ConTeXt style with the Knuth style. The ConTeXt style is to use \start<whatever>
and \stop<whatever>
, as opposed to the Knuth style of \<whatever>
and \end<whatever>
. And, something that is perhaps not that well known, in ConTeXt \start[<whatever>]
... \stop[<whatever]
gets mapped to \start<whatever>
... \stop<whatever>
(similar to \begin{<whatever>}
and \end{<whatever}
getting mapped to \<whatever>
and \end<whatever>
in LaTeX).
But when it comes to readability of macros, I find the ConTeXt way of defining macros to be much more readable that LaTeX's. For example, this is how I will define the summary environment in ConTeXt:
\definenarrower
[summarynarrower]
[left=3em,
right=3em,
after={\blank[big]\endgraf},
]
\defineenumeration
[summary]
[before={\startsummarynarrower[middle]},
after=\stopsummarynarrower,
headstyle=bold,
width=fit,
distance=1em,
text={Summary},
number=no,
location=serried,
style={\setupinterlinespace[11pt]},
]
Except for location=serried
, you can read the rest of the definition and understand what it does even if you have no experience in defining ConTeXt macros. That is, you can read a macro written by someone else (or by a younger you!) and understand what it does. That is much more important that the difference between \begin{...}
and \start....
.
This definition may then be used as:
\starttext
\startsummary
In olden times when wishing still helped one, there lived a
king whose daughters were all beautiful, but the youngest was
so beautiful that the sun itself, which has seen so much, was
astonished whenever it shone in her face. Close by the king's
castle lay a great dark forest, and under an old lime-tree in the
forest was a well, and when the day was very warm, the
king's child went out into the forest and sat down by the side
of the cool fountain, and \unknown
\stopsummary
\stoptext
or if you prefer the LaTeX style:
\starttext
\start[summary]
In olden times when wishing still helped one, there lived a
king whose daughters were all beautiful, but the youngest was
so beautiful that the sun itself, which has seen so much, was
astonished whenever it shone in her face. Close by the king's
castle lay a great dark forest, and under an old lime-tree in the
forest was a well, and when the day was very warm, the
king's child went out into the forest and sat down by the side
of the cool fountain, and \unknown
\stop[summary]
\stoptext
In principle, a similar key-value interface is possible in LaTeX; in fact, some LaTeX packages like TikZ already provide such an interface, and, IIUC, having such a key-value driven interface is one of the objectives of LaTeX3. But I find the ConTeXt interface to be much more consistent.
EDIT Some other ConTeXt specific ideas for maintaining code readability
Use \start<...>
and \stop<...>
version of \section
and \enumeration
commands and indent all environments.
ConTeXt allows you to use
\startchapter[title=,label=...,ref=...,mark=...]
....
\stopchapter
instead of the traditional \chapter
commands. The same is also true for commands defined using \defineneumeration
and \definedescription
. If you always use the \start...
\stop...
version of the block level commands, and indent each nested level by 2 or 4 spaces, the source code is much easier to use
Use empty lines after environments In plain TeX and LaTeX, an empty line means an end of paragraph. Strictly speaking, this is not true in ConTeXt. Whether the \stop...
ends a paragraph or not depends on the setting of the indentnext
key. Thus, if you set \setupformulas[indentnext=yes]
or \setupformulas[indentnext=no]
, then
some text
\startformula
....
\stopformula
some text
and
some text
\startformula
....
\stopformula
some text
are equivalent. Almost all block environments in ConTeXt accept indentnext
key. I personally prefer the latter version because it is easy to determine the end of a block when visually scanning the source code. (If you really want the plain TeX type of behaviour of empty line determining the end of paragraph, then use indentnext=auto
).
Use full names when defining environments and macros: Try no to add extra cognitive load on the reader (i.e. you!) by using macro names like \infty
instead of \infinity
and multline
instead of multiline
. The slightly shorter macro names may speed up the tex processing, but it considerably slows down the reader and writer as well.
\def\document#1\enddocument{...}
:)