Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is very similar to a lot of other questions but I haven't found one that EXACTLY replicates the problem I'm having. I have the following:

\begin{align*}
  &\text{minimize} &R_k + \sum_jr_{jk}^+ + r_{jk}^- &\\
  &\text{subject to} &R_k + r_{jk}^+ \geq \hat{\gamma_{jk}}X_jk, &\forall j ,k\\
  & &R_k + r_{jk}^- \geq -\hat{\gamma_{jk}}X_jk, &\forall j,k \\
  & &R_k, r_{jk}^+, r_{jk}^- \geq 0 &\forall j,k
\end{align*}

Ultimately I want my output to have the text line up in the "first column", the R_k values to line up in the second column, and all the forall statements to line up in the third. Note that none of the lines have all three items (i.e. the last two should have some leading white space).

Right now my output has the text and the forall's lining up but the R_k terms are scattered. Any help is appreciated

share|improve this question

migrated from stackoverflow.com Jul 15 '13 at 21:05

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Jul 15 '13 at 21:22

1 Answer 1

up vote 5 down vote accepted

In the align and align* environments, columns are alternately justified right, left, right, left, etc. If you want two adjacent columns to both be aligned left (or right), use && rather than & to separate them. This might be closer to what you're looking for:

\begin{align*}
 & \text{minimize}   && R_k + \sum_jr_{jk}^+ + r_{jk}^-             &&             \\
 & \text{subject to} && R_k + r_{jk}^+ \geq  \hat{\gamma_{jk}}X_jk, && \forall j,k \\
 &                   && R_k + r_{jk}^- \geq -\hat{\gamma_{jk}}X_jk, && \forall j,k \\
 &                   && R_k,  r_{jk}^+, r_{jk}^- \geq 0             && \forall j,k
\end{align*}
share|improve this answer
    
This is perfect. Thanks! –  sedavidw Jul 15 '13 at 1:20

Your Answer

 
discard

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.