TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

a^2 + b^2 = ab \tag{$(a \in \{z,y,x,w,v,u\},\ b \neq 0)$}\\
\text{centered fine}\tag{short}

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

share|improve this question
up vote 2 down vote accepted

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):




  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) \\


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):



  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) \\

share|improve this answer
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.

share|improve this answer

Does this do anything like what you want?



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


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.