This is a follow-up question to: Is eqnarray really obsolete?
The background is that I want to follow the general advice to avoid eqnarray. However, while working on old documents still containing eqnarray (here, my use case is working on the conference version of a paper when preparing an extended version for a journal), I encountered two situations in my previous question linked above where I did not find an obvious way to obtain an output that had at least the same quality as when using eqnarray but using different environments like align. For the first of these two situations (namely a sequence of proof steps where equations are successively applied to a term), one answer suggested to use array instead of eqnarray while the other answer suggested using a combination of align and \mathclap. However, here I have another problem when using either solution to replace the use of eqnarray. The following code contains 5 versions of the same sequence of proof steps, the first using eqnarray, the second and third using the first suggested solution from the previous question, and the fourth and fifth the second suggested solution from the previous question:
\documentclass{article}
\usepackage{array}
\usepackage{mathtools}
\begin{document}
\begin{eqnarray*}
f(x,y,z) & = & \frac{g(x,y,z)}{h(x,y,z)}\\
& = & \left\lfloor\frac{\frac{\frac{x}{z}}{y}+\frac{y}{z}}{\frac{z}{y} + \frac{y}{x}}\right\rfloor\\
& \stackrel{(\mathit{condition1})}{=} & \left\lfloor\frac{\frac{a}{b}+\frac{\frac{c}{a}}{b}}{\frac{c}{a} + \frac{b}{a}}\right\rfloor\\
& \stackrel{(\mathit{condition2})}{=} & 42
\end{eqnarray*}
{\renewcommand{\arraystretch}{1.5}
\[\begin{array}{@{} r @{\;} >{{}} c <{{}} @{\;} l @{}}
f(x,y,z) & = & \frac{g(x,y,z)}{h(x,y,z)}\\
& = & \left\lfloor\frac{\frac{\frac{x}{z}}{y}+\frac{y}{z}}{\frac{z}{y} + \frac{y}{x}}\right\rfloor\\
& \stackrel{(\mathit{condition1})}{=} & \left\lfloor\frac{\frac{a}{b}+\frac{\frac{c}{a}}{b}}{\frac{c}{a} + \frac{b}{a}}\right\rfloor\\
& \stackrel{(\mathit{condition2})}{=} & 42
\end{array}\]
\renewcommand{\arraystretch}{1}}
{\renewcommand{\arraystretch}{2}
\[\begin{array}{@{} r @{\;} >{{}} c <{{}} @{\;} l @{}}
f(x,y,z) & = & \frac{g(x,y,z)}{h(x,y,z)}\\
& = & \left\lfloor\frac{\frac{\frac{x}{z}}{y}+\frac{y}{z}}{\frac{z}{y} + \frac{y}{x}}\right\rfloor\\
& \stackrel{(\mathit{condition1})}{=} & \left\lfloor\frac{\frac{a}{b}+\frac{\frac{c}{a}}{b}}{\frac{c}{a} + \frac{b}{a}}\right\rfloor\\
& \stackrel{(\mathit{condition2})}{=} & 42
\end{array}\]
\renewcommand{\arraystretch}{1}}
\begingroup
\advance\thickmuskip by 5mu
\begin{align*}
f(x,y,z) & = \frac{g(x,y,z)}{h(x,y,z)}\\
& = \left\lfloor\frac{\frac{\frac{x}{z}}{y}+\frac{y}{z}}{\frac{z}{y} + \frac{y}{x}}\right\rfloor\\
& \stackrel{\mathclap{(\mathit{condition1})}}{=} \left\lfloor\frac{\frac{a}{b}+\frac{\frac{c}{a}}{b}}{\frac{c}{a} + \frac{b}{a}}\right\rfloor\\
& \stackrel{\mathclap{(\mathit{condition2})}}{=} 42
\end{align*}
\endgroup
\begingroup
\advance\thickmuskip by 30mu
\begin{align*}
f(x,y,z) & = \frac{g(x,y,z)}{h(x,y,z)}\\
& = \left\lfloor\frac{\frac{\frac{x}{z}}{y}+\frac{y}{z}}{\frac{z}{y} + \frac{y}{x}}\right\rfloor\\
& \stackrel{\mathclap{(\mathit{condition1})}}{=} \left\lfloor\frac{\frac{a}{b}+\frac{\frac{c}{a}}{b}}{\frac{c}{a} + \frac{b}{a}}\right\rfloor\\
& \stackrel{\mathclap{(\mathit{condition2})}}{=} 42
\end{align*}
\endgroup
$(\mathit{condition1})$ holds since the sky is red and $(\mathit{condition2})$ because this is the answer.
\end{document}
The output looks as follows:
eqnarray:
array:
arraywith higher stretch factor:
align:
alignwith higher\thickmuskip:
The problems in this example are the following:
The relation symbols used in each step may have a different horizontal length but should be aligned below each other in a centered way. Therefore, the usual AMS environments do not work in an obvious way since they only offer left- or right-aligned columns. The second solution tries to overcome this problem by using
\mathclap, but then the space between the relation symbols and everything else must be adjusted manually (as seen in the last version).When using
array, the vertical space between each line is "set" manually by adjusting the value of\arraystretch. While in the previous question a value of1.5was "the right" value, here the same value leads to overlapping lines. So with the first solution, the vertical space needs to be adjusted manually for each case separately.Another problem when using
arrayis that the fractions seem to be compressed.
Is there a way to achieve an output of at least the quality of version 1 without the need to manually adjust values for different cases of such proof step sequences and without using eqnarray?










=. I think you can get an equally clear presentation (if not better, since the spacing is consistent) using this layout... – Werner Jan 18 '16 at 05:56=symbols saves some space in such cases. – cryingshadow Jan 18 '16 at 05:58(condition1)or(condition2)over=, I'll use(1)or(2)and describe that after the entire construction. – Werner Jan 18 '16 at 06:00eqnarrayis still a hidden hero. Go for it then. – Werner Jan 18 '16 at 06:05eqnarrayshould generally be avoided. The story written here is true: I tried to removeeqnarraybut stumbled over this situation (of course with a bigger and more meaningful example). I would actually be happy if there was an easy way of solving such things - then I would not need to worry whether any of the problems witheqnarraylike incompatibilities will cause a problem sooner or later when I continue to work with such things... – cryingshadow Jan 18 '16 at 06:10