5

I have a question concerning how to add a curly brace at the right side of three lines in an align-environment. The following is an example of what I'm speaking about:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath,amsthm, amsfonts,amssymb, enumerate}

\begin{document}
\begin{align}
&\rlap{\textbf{Optimization model}}
\nonumber \\
&                  && z=\sum_{i\in I} x_i\cdot y_i \cdot z_i \rightarrow \max
\nonumber \\
&\text{s.t.} && x_i \le b_i, 
             &  i\in I, \\
&            && x_i \le y_i,
             &  i \in I,  \\
&            && y_i \le z_i,
             &  i\in I,  \\
&            && z_i \le x_i,
             & i\in I, \\
&            && x_i, y_i, z_i \in \mathbb{R}_{+},
             & i\in I. 
\end{align}
\end{document}

There are five lines of constraints (after the "s.t."). I would like to make a curly brace over the first parts of the second, third and fourth line (i.e. over x_i \le y_i, y_i \le z_i and z_i \le x_i) and write a single "i \in I" in the right of this brace. I hope it was possible to understand it.

Can you please tell my how to achieve this? (The general style of this align-environment should not be changed.)

PS: Here is a picture of how it should look like: curly brace in the right of the first parts of lines 2 up to 4

  • I added a picture of how it should look like. (not very nice, but one should understand what is meant there) – Phil Jan 14 '15 at 10:03
3

With help of mathtools package you can use rcases environment.:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath,amsthm, amsfonts,amssymb}
\usepackage{mathtools}% <-- new package for rcases

% for show just the equation ...
\usepackage[active,displaymath,tightpage]{preview}
    \setlength\PreviewBorder{1em}


\begin{document}
\begin{align}
&\rlap{\textbf{Optimization model}}
\nonumber \\
&                  && z=\sum_{i\in I} x_i\cdot y_i \cdot z_i \rightarrow \max
\nonumber \\
&\text{s.t.} && x_i \le b_i,                        &  i\in I, \\
&            && %\!\!% first approximation of  misalignment compensation ...
                \negthickspace% for compensation of rcases misalignment
                \begin{rcases}  
                x_i    \le y_i \\
                y_i    \le z_i \\
                z_i    \le x_i
                    \end{rcases}                    & i\in I, \\
&            && x_i, y_i, z_i \in \mathbb{R}_{+},   & i\in I.
\end{align}
\end{document}

Hope that this is what you like to achieve. enter image description here

Edit: Better alignment is achieved if you instead of \!\! you use \negthickspace. It is approximately \mkern-5mu as suggest Bernard in his answer. The picture is replaced with new, where this \negthickspace is used. Use of alignat instead of align is probably more correct selection, but final result is the same.

  • You probably didn't notice, but the equations are slightly mis-aligned... – yo' Jan 14 '15 at 10:17
  • Yo', I nted this. I try (in hurry) to fix misalignment with \!. The result is not perfect ... but can be improved (I left this to OP). Later (when I will have more time) iI will return to this problem and try to find its cause. – Zarko Jan 14 '15 at 10:41
3

A slight improvement with the alignedat environment and a better alignment of the constraints:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath,amsthm, amsfonts,amssymb}
\usepackage{mathtools}%

\begin{document}

\begin{alignat}{3}
&\rlap{\textbf{Optimization model}}
\nonumber \\
& & &z=\sum_{i\in I} x_i\cdot y_i \cdot z_i \mathrlap{\rightarrow \max} & &
\nonumber \\
&\text{s.t.}\qquad & &x_i \le b_i, & i\in I, \\
& && \mkern-5mu\begin{rcases}
 x_i \le y_i \\
 y_i \le z_i \\
 z_i \le x_i
 \end{rcases} & i\in I, \\
& && x_i, y_i, z_i \in \mathbb{R}_{+}, & i\in I.
\end{alignat}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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