Modifying \everydisplay causes the align* environment to stop working

Internall, align uses alignment displays, described p. 190 of the TeXbook as follows:

TeX also allows "alignment displays" [...] An alignment display is created by commands of the general form

$$ <assignments> \halign{ <alignment> } <assignments> $$

where the <assignments> [...] do not produce any math lists.

But \textstyle is not an assignment: in fact, it starts a math list. So \halign is not alone in that equation anymore, and TeX complains.

Now a solution: since align builds a construction like $\displaystyle ...$ internally, we can redefine the size using \let\displaystyle\textstyle.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\let\displaystyle\textstyle

An example of aligned equations,
\begin{align}
\sum_{i=1}^N \frac{x^2}{2} + \frac{y^2}{2} &= \frac{\sqrt{z^{\frac{2}{3}}}}{2}
&\frac{\sqrt{z^{\frac{2}{3}}}}{2} &= \sum_{i=1}^N \frac{x^2}{2} + \frac{y^2}{2} 
\\
\frac{\sqrt{z^{\frac{2}{3}}}}{2} &= \sum_{i=1}^N \frac{x^2}{2} + \frac{y^2}{2} 
&\sum_{i=1}^N \frac{x^2}{2} + \frac{y^2}{2} &= \frac{\sqrt{z^{\frac{2}{3}}}}{2}
\end{align}
which seem to work.

But the \verb|equation| environment won't:
\begin{equation}
\frac{\sqrt{z^{\frac{2}{3}}}}{2} = \sum_{i=1}^N \frac{x^2}{2} + \frac{y^2}{2} 
\end{equation}

\end{document}

You might prefer saving the definition before using \let\olddisplaystyle\displaystyle in case you need it.


A partial workaround is to define some macros that can be used to replace the \[ ... \] and align* environments. Regard the following:

\documentclass[a4paper,reqno]{amsart}

\usepackage{amssymb,amsmath,amsthm,fullpage}

\newcommand{\t}{\textstyle}
\newcommand{\blob}[1]{\[\t#1\]}
\newcommand{\calc}[2]{\begin{align*}\t#1&\t#2\end{align*}}
\newcommand{\nl}{\\&\t}

\begin{document}

\blob{4^x + 5^y = 6^z \quad\mathrm{unless}\quad x = \frac{y}{z}}

\calc{x}{
    =\sum_{i=1}^{10} i^2 \nl
    \leq t^3 + \int_3^9y^a\,\mathrm{d}y
}

\end{document}

This gives displayed mathematics typeset as inline maths, and provides commands that do pretty much what I want and make for readable enough code. For unusual cases where \blob and \calc are not good enough, at least \t is reasonably concise, even if it does have to be just about everywhere.

This isn't a real answer to my question, though. I'd still like to know what the deal is with the original problem...

Tags:

Equations