\documentclass{amsart}
{\catcode`\z\active
\global\def\activate{\catcode`\z\active\defz{active}z}}
\begin{document}
{\activate z} %1
\begin{equation}\activate z\end{equation} %2
\begin{align}\activate z\end{align} %3
{\activate\begin{align}z\end{align}} %4
\end{document}
(1) and (2) behave as I would expect, printing out 'activeactive' (in a displayed equation, for (2)). However, (3) prints out 'activez', and I can't figure out why.
EDIT: (4) also behaves as I would expect, printing out 'active' before the align, and then another 'active' inside the align. Is the align environment (unlike, say, the equation environment) reading its body as an argument?

\activateor\verbetc will not work. – David Carlisle Mar 08 '15 at 21:32\ba\ea. The body is set twice to do measurement and layout tests. – David Carlisle Mar 08 '15 at 21:48\activateproblem was solved, you'd need to repeat it in every align cell. – egreg Mar 08 '15 at 22:15{align}environments, and I wanted my=to act automatically as alignment points, so I used\let\equal==\catcode\=\active\def={&{}\equal}(there should be a backtick in there, but it confuses MathJax). Doing this once before the{align}seems to work. (As I was looking up the restriction DavidCarlisle quoted, I came across thebreqnpackage, which looks like it tries to do such trickiness automatically. Is this package recommended for use? There are indications in various places that it should be considered experimental.) – LSpice Mar 08 '15 at 22:26\catcodeso that MathJax doesn't see it. – LSpice Mar 08 '15 at 22:49\newcommand\foo{..}...\foothen that is normal supported use and any system can understand it, if you use low level catcode assignments that change the underlying syntax then typically non-tex systems like mathjax or tex4ht will have problems, and many tex based journal submission requirements would not allow it as if you allow such things you basically lose control over anything the document is doing so it is so much harder for a journal class to force a house style. (actually this particular automatic&is fairly benign, but checking it's benign is hard...) – David Carlisle Mar 08 '15 at 23:05