This question led to a new package:
conteq
I am writing a paper with multiple chains of equations or inequalities, with optional explanations. Depending on the size of the equations, I use one of
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Short style:
\begin{align*}
lhs1 &= rhs1 && \text{expl1} \\
&\le rhs2 \\
&= rhs3 && \text{expl3}
\end{align*}
Medium style:
\begin{align*}
lhs1 &= rhs1 \\
&\phantom{{}={}} \text{expl1} \\
&\le rhs2 \\
&= rhs3 \\
&\phantom{{}={}} \text{expl3}
\end{align*}
Large style:
\begin{align*}
&\phantom{{}={}} lhs1\\
&= rhs1 \\
&\phantom{{}={}} \text{expl1} \\
&\le rhs2 \\
&= rhs3 \\
&\phantom{{}={}} \text{expl3}
\end{align*}
\end{document}
This looks nice, but is not convenient to switch between. So I’d like to have three environments eqchains, eqchainm and eqchainl that produce the appropriate output, given an input in this form:
\begin{eqchain?}
lhs1 &= rhs1 & expl1 \\
\le rhs2 \\
= rhs3 & expl3
\end{eqchain?}
(Of course, the & can be some other symbol). Bonus points if the styling of the explanation can be modified by redefining a macro, e.g. \newcommand{\eqchainexpl}[1]{\text{\{ \textit{#1} \}}.
And, if that was possible, I’d like to have an environment eqchain that automatically selects the right environment using the following heuristics: If lhs1 and the largest rhs is together smaller than ⅔ of the \linewith, use eqchains. If the lhs1 and the largest rhs is smaller than the \linewidth, use eqchainm. Otherwise use eqchainl. Final bonus points if the explanation is set in a \parbox so that long explanations are wrapped and do not affect the horizontal positioning of the math content.
\\afterlhs1in the "large` example (or you want a layout I find rather strange) – David Carlisle Apr 12 '13 at 08:36\\and a document preamble. – Joachim Breitner Apr 12 '13 at 08:40\phantom{{}={}}use\mathrel{\phantom{=}}– Marco Daniel Apr 12 '13 at 09:23