3

How can I reproduce this in latex?

Operative research linear optimisation problem

So far I have tried:

\begin{align*}
    &min z(x) = c^Tx\\
    & \text{s.v.} &\\ \begin{split}
         & Ax \geq b \\
        & x \geq 0
    \end{split}
\end{align*}

but I can't get the secondo offset (after text) to force the following equation to align. Any suggestion on how to align at different offset like here?

3
  • Is this \begin{align*} min z(x) &= c^Tx\\ \intertext{s.v.} \begin{split} Ax &\geq b \\ x &\geq 0 \end{split} \end{align*} you expected?
    – MadyYuvi
    Commented Aug 13 at 6:08
  • @MadyYuvi Not quite. The text should be aligned to the first line, while the inequation should be aligned to an offset as big as the end of the text Commented Aug 13 at 6:16
  • Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem.
    – cabohah
    Commented Aug 13 at 7:01

2 Answers 2

3

You might want to make an environment out of this.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\subj}{\textit{s.v.}}

\begin{document}

\begin{equation*}
\begin{split}
 &\! \min z(x)=c^Tx \\
 &\subj \\
 &\qquad\begin{aligned}
   Ax &\ge b \\
   x  &\ge 0
  \end{aligned}
\end{split}
\end{equation*}

\end{document}

enter image description here

1

Here are two possible solutions. The first, which employs a single align* environment, aligns the = symbol in row 1 with the \geq symbols in rows 3 and 4. The second solution, which does not perform such a "global" alignment and instead performs pairwise alignments, employs two separate aligned environments inside a gather* environment.

enter image description here

\documentclass{article} 
\usepackage{amsmath} % for 'gather*' and 'aligned' environments
\begin{document}

\begin{align*}
\min z(x) &= c^T\!x \\
\textit{s.v.}\qquad& \\
Ax &\geq b \\
x  &\geq 0
\end{align*}

\begin{gather*}
\begin{aligned} % perform left-alignment of rows 1 and 2
&\min z(x) = c^T\!x \\
&\,\textit{s.v.}
\end{aligned}\\
\begin{aligned} % align rows 3 and 4 on '\geq' symbols
Ax &\geq b \\
x  &\geq 0
\end{aligned}
\end{gather*}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .