Hi everybody,
The LaTeX amsmath package provides an \intertext command to interrupt one of its math alignment modes. You can use it to insert text between stages in a long sequence of equalities. For instance:
First, we use the half-angle identity for $\sin^2(x)$:
\begin{align*}
\int \sin^4(x)\,dx
&= \int\left(\sin^2(x)\right)^2\,dx
= \int\left(\frac{1 - \cos(2x)}{2}\right)^2 \,dx
\\ &= \int\frac{1 - 2 \cos (2x) + \cos^2(2x)}{4} \,dx
\\ &= \int\left(
\frac{1}{4}
- \frac{1}{2} \cos(2x)
+ \frac{1}{4} \cos^2(2x)\right)\,dx
\\
\intertext{Now we use the half-angle identity for $\cos^2(2x)$:}
&= \int\left(
\frac{1}{4}
- \frac{1}{2} \cos(2x)
+ \frac{1}{4} \cdot\frac{1+\cos(4x)}{2}\right)\,dx
\\ &= \int\left(
\frac{3}{8}
- \frac{1}{2} \cos(2x)
+ \frac{1}{8}\cos(4x)\right)\,dx
\\
\intertext{Now we just do it!}
&= \frac{3}{8}x - \frac{1}{4} \sin(2x)
+ \frac{1}{32}\sin(4x) + C
\end{align*}
The output looks like this:
I'm trying to do the same thing in PreTeXt. I don't know how to “interrupt” a <md> element to drop back into paragraphs. If I end the <dm> element, it forgets the column widths. So I put it back in using some \phantom commands. Here is my best effort:
<p>
First, we use the half-angle identity for <m>\sin^2(x)</m>:
<md>
<mrow> \int \sin^4(x)\,dx\amp= \int\left(\sin^2(x)\right)^2\,dx = \int\left(\frac{1 - \cos(2x)}{2}\right)^2 \,dx</mrow>
<mrow> \amp = \int\frac{1 - 2 \cos (2x) + \cos^2(2x)}{4} \,dx </mrow>
<mrow> \amp = \int\left( \frac{1}{4} - \frac{1}{2} \cos(2x) + \frac{1}{4} \cos^2(2x)\right)\,dx</mrow>
</md>
Now we use the half-angle identity for <m>\cos^2(2x)</m>:
<md>
<mrow> \phantom{\int \sin^4(x)\,dx} \amp = \int\left( \frac{1}{4} - \frac{1}{2} \cos(2x) + \frac{1}{4} \cdot\frac{1+\cos(4x)}{2}\right)\,dx </mrow>
<mrow> \amp = \int\left( \frac{3}{8} - \frac{1}{2} \cos(2x) + \frac{1}{8}\cos(4x)\right)\,dx</mrow>
</md>
Now we just do it!
<md>
<mrow> \phantom{\int \sin^4(x)\,dx} \amp = \frac{3}{8}x - \frac{1}{4} \sin(2x) + \frac{1}{32}\sin(4x) + C </mrow>
</md>
We did some small <m>u</m>-substitutions on the <m>2x</m> and <m>4x</m> terms.
</p>

It's pretty close, but you'll notice the equals signs in each block are not aligned. That's because while the left-hand sides have the same width in each block (thanks to \phantom), the widest right-hand side varies.
A hacky LaTeX way to do this would be to find the widest right-hand side, and use a combination of \phantom and \rlap to make sure each right-hand side was at least as wide as that widest column. Or maybe there's a better LaTeX way. But is there a PreTeXt way?
Best,
Matthew
--
Matthew Leingang (he/his)
Clinical Professor of Mathematics
Assistant Director of Undergraduate Studies
Department of Mathematics
Courant Institute of Mathematical Sciences
New York University