[Tex/LaTex] Right-aligned constraints for equation

equationshorizontal alignment

I'm looking to write an equation (using gather), with some constraints on the right-hand side.

Ideally, I'd like the equations to be horizontally-aligned with one another (i.e. have centers line-up vertically in a given equation grouping), and the constraints following similar behaviour, but at the right-hand-side of the page, inside the right-margin.

edit:The equation alignment should also be consistent with the rest of the document.

The following is an example of (almost) the kind of behaviour I'm looking for, using the \tag command, but note that the length of the first tag has moved the first equation, and that the tags are right-aligned as opposed to centred in some abstract column near the right-hand side. Here's a minimal example:

\documentclass[reqno]{amsart}
\begin{document}
\begin{gather}
a^2 + b^2 = ab \tag{$(a \in \{z,y,x,w,v,u\},\ b \neq 0)$}\\
\text{centered fine}\tag{short}
\end{gather}
\end{document}

I'm happy to redefine \tag as long as it's not going to affect any of the equation-numbering elsewhere.

Best Answer

If the longest constraint needs to be flushed to the right margin, you could use a tabular* environment with two centered columns; something along these lines (change the lengths according to your needs):

\documentclass[reqno]{amsart}
\usepackage{array}

\newlength\MyIndent
\setlength\MyIndent{10em}

\begin{document}

\vspace{\abovedisplayskip}
\noindent\begin{tabular*}{\textwidth}{@{\hspace{\MyIndent}}>{$}c<{$}@{\extracolsep{\fill}}
    >{$}c<{$}@{}}
  a^2 + b^2 = ab & (a \in \{z,y,x,w,v,u\},\ b \neq 0) \\
  a + b = c & (a \in \{z,y\},\ b = 0) \\
\end{tabular*}\par
\vspace{\belowdisplayskip}

\end{document}

If the longest constraint doesn't need to be flushed to the right margin, a simple array environment will do the job (change the lengths according to your needs):

\documentclass[reqno]{amsart}

\begin{document}

\[
\begin{array}{@{\hspace{7em}}c@{\hspace{3em}}c}
  a^2 + b^2 = ab & (a \in \{z,y,x,w,v,u\},\ b \neq 0) \\
  a + b = c & (a \in \{z,y\},\ b = 0) \\
\end{array}
\]

\end{document}