# Right-aligned constraints for equation

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.

-

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}

-
Thank you. However, I wanted my equations to look consistent with other equations nearby (horizontal alignment) --- I've edited my question to account for this. – Nick Loughlin Jun 14 '11 at 19:30

As you don't need alignment at relation symbols, but centered alignment, you could use an array environment with c columns.

I considered putting two gathered environments next to each other, however, in contrast to an array, alignment of the baselines would not be guaranteed.

-

Does this do anything like what you want?

\documentclass{minimal}
\usepackage{amsmath}

\begin{document}

$$\begin{cases} a^2 + b^2 = ab, & a \in \{z,y,x,w,v,u\},\ b \neq 0 \\ a + b = 0, & b \neq 0 \end{cases}$$

\end{document}


-