use package mathtools
. There is also a drcases
environment
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
\begin{rcases*}
E = m c^2 & foo \\
\int x-3\, dx & barbaz
\end{rcases*} y=f(x)
\]
\end{document}
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.
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.
Best Answer
Here is an example using the infamous
\tikzmark
macro applied to the example from How to typeset gotos and labels using LaTeX pseudocode environments?.Usage:
\tikzmark{right}
. Here I used the end of the headerprocedure Euclid(a,b) as the
right` node. Hence the horizontal position of the brace.\tikzmark{top}
.\tikzmark{bottom}
.\AddNote{<top node>}{<bottom node>}{<right node>}{<text>}
.These node names
top
,bottom
, andright
are arbitrary so if you have multiple places in the same algorithm where you want to place such notes, you can use different node names. Just pass them to the\AddNote
macro.Notes:
Further Enhancements:
\AddNote
could accept additional formatting parameters for the text of the node, and line color selection. Currently this is hard coded to usedred
andtext width=2.5cm
.References:
\tikzmark
is from Adding a large brace next to a body of text.Here are a few similar applications using
\tikzmark
:Curly brace to insert something into an equation? Like an inverted underbrace
Adding Arrows to Lines Drawn in TikZ
Code: