Skip to content

Instantly share code, notes, and snippets.

@resilar
Last active October 8, 2019 12:20
Show Gist options
  • Save resilar/7f2df0c6f7fcc4852da2656a1a965bc0 to your computer and use it in GitHub Desktop.
Save resilar/7f2df0c6f7fcc4852da2656a1a965bc0 to your computer and use it in GitHub Desktop.
The *correct* way to typeset optimization problems in LaTeX
% Output: http://i.imgur.com/88G3s9V.png
\begin{equation}
\begin{split}
& \text{\large Primal} \\
\text{min } & \sum_{j=1}^s x_j + Bz \\
\text{s.t. } &
\begin{aligned}[t]
x_j + z &\ge 1 & \forall j = 1,2,\dots,s \\
x_j &\ge 0 & \forall j = 1,2,\dots,s \\
z &\ge 0
\end{aligned}
\end{split}
\qquad
\begin{split}
& \text{\large Dual} \\
\text{max } & \sum_{j=1}^s y_j \\
\text{s.t. } &
\begin{aligned}[t]
y_j &\le 1 & \forall j = 1,2,\dots,s \\
\Sigma_{j=1}^s y_j &\le B \\
y_j &\ge 0 &\forall j = 1,2,\dots,s
\end{aligned}
\end{split}
\end{equation}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment