0

My question is quite similar to a previous question on inserting a right brace around a set of equations. However, I do not wish to wrap the brace around the entire aligned environment yet I would like to maintain the same alignment throughout.

I would like to avoid a tikz-based solution if possible.

Any help would be appreciated.

Edit: This example demonstrates that I lose the alignment I would like once I attempt to span some of the equations with a right brace.

\documentclass{beamer}
\usepackage{amsmath}
\begin{document}
\begin{frame} \frametitle{An ILP Approach}
A 0-1 model:
\begin{align*}
  \onslide<2->{
  \mathrm{maximize} \quad & \sum_{e \in E} w_e y_e  \\
  }
  \onslide<3->{
  \text{subject to} & \\
  \left.\begin{aligned}
  x_{il} + x_{jl} + y_e &\leq 2 \\
  x_{il} - x_{jl} &\leq  y_e  \\
  x_{jl} - x_{il} &\leq  y_e  \\
\end{aligned}\right\} \text{for} e \in E, l \in [k]\\
  }
  \onslide<4->{
  \sum_{l \in [k]} x_{il} & = 1 & i \in V \\
  }
  x_{ul}&\in \{0,1\} &\quad \forall u \in V, l \in [k] \\
  y_e &\in \{0,1\} &e \in E
\end{align*}
\end{frame}

\end{document}

healyp
  • 343
  • 3
    Could you post a small compilable example of what you've tried? – Bernard Jun 15 '20 at 20:57
  • You wrote, "I do not wish to wrap the brace around the entire aligned environment yet I would like to maintain the same alignment throughout." This isn't easy to parse. Please provide more information about what it is you do want to achieve. – Mico Jun 15 '20 at 21:29
  • Hope my MWE does a better job of explaining my problem :-). – healyp Jun 15 '20 at 21:40
  • How the part with the right brace should be aligned is still not clear to me. Could you post a sketch of what you'd like to have? – Bernard Jun 15 '20 at 21:57
  • Imagine the \left.\begin{aligned} and \end{aligned}\right\} \text{for} e \in E, l \in [k] lines were commented out. I then wanted to plant a \rbrace that spanned the three \leq inequalities. Thanks for your patience. – healyp Jun 16 '20 at 06:54

1 Answers1

2

Edit: It seems that you looking for the following (showed is only last slide):

enter image description here

\documentclass{beamer}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,
                calligraphy,
                tikzmark}
\tikzset{
B/.style = {decorate,
            decoration={calligraphic brace, amplitude=4pt,
            raise=1pt},
            thick,
            pen colour=black}
        }

\begin{document} \begin{frame} \frametitle{An ILP Approach} A 0-1 model: \begin{align} \uncover<2->{ \mathrm{maximize} \quad & \sum\limits_{e \in E} w_e y_e\[2ex] } \uncover<3->{ \text{subject to} \quad & \ x_{il} + x_{jl} + y_e &\leq \tikzmarknode{A}{2} \ x_{il} - x_{jl} &\leq y_e \ x_{jl} - x_{il} &\leq \tikzmarknode{B}{y_e} \[2ex] } \uncover<4->{ \sum\limits_{l \in [k]} x_{il} & = 1 \text{ for } i \in V \ } x_{ul} & \in {0,1}, \quad \forall u \in V, l \in [k] \ y_e & \in {0,1}, \quad e \in E \begin{tikzpicture}[overlay, remember picture] \draw[B] (A.north -| B.east) -- node[right=3mm] {$e \in E, l \in [k]$} (B.south east); \end{tikzpicture} \end{align} \end{frame} \end{document}

Note: in comparison to your MWE observe that now the aligned environment is removed, right curly braces is drawn by help of tikz package and its library tikzmark and in MWE is only one ampersand per row. Hopeful they are now correct positioning (before math symbols to which you like to have aligned your equations). Also instead of onslide is used \uncover macro.

Showed result appear after two compilation.

Zarko
  • 296,517
  • This was what I wanted to avoid: the alignment of the relational symbols \leq, = and \in is lost once the inner aligned environment is introduced. – healyp Jun 16 '20 at 10:04
  • @healyp, this is not clear from your question. See edited answer, if now it is as you like to have. – Zarko Jun 16 '20 at 10:52