# How to put (or simulate putting) two "align" environments next to each other?

I am having trouble with the align environment. I wrote the following code almost works, but not quite:

\begin{align*}
\min_{x, y} \ &2x + 4y          &      & \min     \    &9x^2 + 2y  \\
\text{s.t.} \ &2x^2 - 4y \le 7  & \iff & \text{s.t.} \ &2x^2 - 4y \le 7 \\
&3x+2y \ge 4      &      &               &3x+2y \ge 4
\end{align*}


Output:

I like how the problem looks on the left side. But on the right, the spacing is wrong. How can I make the problem on the right look like the one on the left?

Thank you very much!

• you are missing a & in every row before the second block so &&\min, &&\text , && Nov 17, 2022 at 8:59
• @DavidCarlisle Thanks a lot. What is actually going on when you put & vs &&? From my understanding, when you make an align environment, the & are used to separate "columns". So it seems to me that && just makes an empty column. Nov 17, 2022 at 16:53
• align columns are like an array with {rl@{\quad}rl@{\quad}rl...) you want to arrange each a&=b equation is in a rl pair so they align towards the =, You had got out of sync so a&=b aligned as l@{\quad}r so the equation is pulled apart. Nov 17, 2022 at 17:02
• @DavidCarlisle So if you put A & B & C & D, LaTeX assumes that there is an equal sign between A, B and between C, D, i.e. you are trying to display A = B C = D? Nov 17, 2022 at 17:44
• @DavidCarlisle Ah okay. I didn't know that aling assumes that some &'s are for equal signs, and some are to separate columns. I thought they all &'s separate columns. Thank you so much! Nov 17, 2022 at 17:56

Something like this?

\documentclass{article} % or some other suitable document class
\usepackage{amsmath}    % for 'alignat*' environment
\begin{document}
\begin{alignat*}{3}
\min_{x, y}\ &2x + 4y         &&                &        \min\ &9x^2 + 2y  \\
\text{s.t.}\ &2x^2 - 4y \le 7 &&\qquad\iff\qquad& \text{s.t.}\ &2x^2 - 4y \le 7 \\
&3x+2y \ge 4     &&                &              &3x+2y \ge 4
\end{alignat*}
\end{document}

• Thank you very much. What is actually going on when you put & vs &&? From my understanding, when you make an align environment, the & are used to separate "columns". So it seems to me that && just makes an empty column. Nov 17, 2022 at 16:53
• see my comment under the question re && @user56202 Nov 17, 2022 at 17:25