On Thu, Jul 5, 2012 at 12:44 AM, Rogers, Michael K
<mroge02@emory.edu> wrote:
XML documents should form a tree, so a structure like
\startA % <A>
\startB % <B>
\stopA % </A>
\stopB % </B>
won't translate to XML.
Grouping in TeX follows the same restrictions, and \start... and \stop... behave like \begingroup and \endgroup. The \stop... is supposed to restore the state before the corresponding \start... (at least I assume so -- \endgroup works that way). One cannot
stop A in the middle of B and return to the state before \startA without also stopping B. So one should put \stopB before \stopA, not after it.
It depends.
\starttext
\long\def\startA#1\stopA{<\low{A}#1>\low{A}}
\long\def\startB#1\stopB{<\low{B}#1>\low{B}}
\startA
textAA
\startB
textAB
\stopA
textBB
\stopB
\stoptext
is ok (not the context way, btw: real code is more complex).
The meaning of this can be
content of \startA..\stopA = textAA ⋃ textAB
content of \startB..\stopB = textAB ⋃ textBB
\startA..\stopA ⋂ \startB..\stopB = textAB
If we are describing programs, textAB can be the common code between the function A and B.