# Using the stackrel package with & within the align environment

It appears that the stackrel package and the align environment are incompatible. The following example illustrates:

    \documentclass{amsart}
\usepackage{scalerel}
\begin{document}
\begin{align*}
\scaleto{f(\alpha,x,y,z)  = & text{some very long expression which I want to shrink }}{32pt}\\
\scaleto{                 = & text{another very long expression which I want to shrink }}{32pt}
\end{align*}
\end{document}


The error I'm getting is

! Missing } inserted.
<inserted text>
}
l.6 \end{align*}


I want the two = signs to be aligned. Is there a workaround for this?
I am currently using scaleto{\phantom{f(\alpha,x,y,z)} = etc. but it's extremely clumsy and doesn't work very well Thanks for any suggestions

• Also \mbox{a=&b} would give errors. What's your aim? – egreg Dec 9 '18 at 17:41
• align* needs two columns, and you are using one of them (atm I cannot test in a machine). – manooooh Dec 9 '18 at 17:50
• each alignment cell is a group, there are almost no commands that you can use that start in one cell and end in another. You do not say what you expect this code to do, there are no use cases for a one-row align. – David Carlisle Dec 9 '18 at 18:00
• sorry everybody, my mwe was too minimal. I've expanded my question to be more indicative of what I"m trying to do. – Leo Simon Dec 11 '18 at 22:28

You can't have some group spanning the alignment & in align since & itself delineates a group start/end. Instead, you'll have to break the components across &, just like you would \left...\right and other things.

Here's an option.

\documentclass{amsart}

\usepackage{scalerel}

\begin{document}

\begin{align*}
\scaleto{f(\alpha,x,y,z)}{8pt} & \scaleto{{}= \text{some very long expression which I want to shrink}}{8pt} \\
& \scaleto{{}= \text{another very long expression which I want to shrink}}{8pt}
\end{align*}

\end{document}

• thanks @Werner, this works sort of, but the problem is that when you break the line into two pieces, and use the same second argument for both pieces you get wildly different amplifications on both sides of the equality sign, as the following line illustrates \scaleto{f(x)}{32pt} & \scaleto{{}=\left(\frac{\beta}{12}\right)^2}{32pt}. The right hand side is shrunk, and the left hand side is expanded. Is there any way to harmonize both sides except by trial and error? Thanks! – Leo Simon Dec 13 '18 at 0:06
• @LeoSimon: Of course. This only works if the height of either side matches; then the scaling will be the same. To ensure the height of each component matches the tallest, use \vphantom{<stuff>} in the shorter components where <stuff> is the tallest component. So, in your example, \scaleto{f(x)\vphantom{\left(\frac{\beta}{12}\right)^2}}{32pt} & \scaleto{{}=\left(\frac{\beta}{12}\right)^2}{32pt}. – Werner Dec 13 '18 at 0:28
• Thank you, didn't know about vphantom. – Leo Simon Dec 14 '18 at 1:09