# [NTG-context] intertext for aligned equations

Wed Mar 29 08:42:33 CEST 2006

<--- On Mar 27, Taco Hoekwater wrote --->

>
>
> Hi,
>
>
>> This seems to be working fine. However, \intertext defined in
>> amsmath.sty seems to be doing  a lot more (I just can't figure out
>> what it is doing?) Can someone suggest how to make the above command
>> more robust on the lines of \intertext?
>
> It inserts a post/pre-display skip&penalty pair around the intertext,
> then creates a \vbox for use a paragraph. The result is (almost) as if
> it the text was part of the 'normal' text flow between two displays.
>
> I cannot tell you if this would work exactly the same as expected in
> ConTeXt (needs further testing), but a context-like solution would
> look like this:
>
> \def\startintertext#1\stopintertext{%
>   \noalign{\dointertext{#1}}\NR}
>
> \unexpanded\def\dointertext#1%
>    {\penalty\postdisplaypenalty
>     \afterdisplayspace  % the matching \before... is not needed
>     \vbox{\forgetall \noindent #1\par}%
>     \penalty\postdisplaypenalty }
>

This does not look good. Consider,

\def\startintertext#1\stopintertext{%
\noalign{\dointertext{#1}}\NR}

\unexpanded\def\dointertext#1%
{\penalty\postdisplaypenalty
\afterdisplayspace  % the matching \before... is not needed
\vbox{\forgetall \noindent #1\par}%
\penalty\postdisplaypenalty }

\startformula \startalign
\NC A_1 \NC= \left| \int_0^1 (x^2 - 3x)\, dx \right|
+ \left| \int_1^2 (x^2 -5x + 6)\, dx \right| \NR
\startintertext
Take limits of both integrals
\stopintertext
\NC \NC = \left| \frac{x^3}{3} - \frac{3}{2} x^2 \right|_0^1
+ \left| \frac {x ^3}{3} - 7 \frac{5}{2} x^2 + 6x \right|_1^2 \NR
\NC \NC = \left| - \frac{7}{6} \right| + \left|\frac{14}{3} -
\frac{23}{6}\right| = \frac{7}{6} + \frac{5}{6} = 2 \NR
\stopalign \stopformula

There is too much space after the intertext and the next line. Can you
provide some magic to reduce this space.

Thanks,