1
\documentclass{standalone}

\usepackage{mathtools}

\begin{document}
    \begin{math}
        \varepsilon\coloneqq\frac{E_0}{E}
        \implies
        \left.
        \begin{aligned}[t]
            \varepsilon E&=E_0\\
            E_0&=k\frac{q}{r^2}
        \end{aligned}
        \right\}
    \end{math}
\end{document}

a brace that at the top encompasses more than the aligned environment

How do I make the brace only be as long as necessary for the equations in the aligned environment? I wish to keep the rest of the formatting.

tambre
  • 223
  • 1
  • 11
  • How will the brace look like then? –  May 21 '19 at 14:14
  • 1
    @JouleV Like in Steven's answer. – tambre May 21 '19 at 14:21
  • Then the baseline will change... I do not understand the mathematical meaning in all that –  May 21 '19 at 14:24
  • @JouleV I want to show that the top equation is a variation of the more common form. The bottom is another equation and I want the brace to show I'm combining those two (result not shown here). If I leave [t] out from aligned then things look nice, but it seems as if the left-most equation implies the equation system. – tambre May 21 '19 at 14:36
  • Then your question is asking how to have a cases environment where the brace is at the right. It is already answered in –  May 21 '19 at 14:40
  • 4
  • @JouleV I'm not dealing with cases. Additionally, the cases environment has undesirable spacing and requires me to manually enter mathmode for the other side of the equation. Furthermore, I'd presumably have to use a similar hack as in the solution to get it to line up as wanted. – tambre May 21 '19 at 15:06
  • I do not use cases, see my answer. Also, LaTeX is designed for mathematics, so please use it mathematically. Hacking should be always avoided –  May 21 '19 at 15:07

2 Answers2

3

A mathematically correct solution. Please use LaTeX mathematically. It is not supposed to deal with workarounds.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
\left.\begin{aligned}
\varepsilon\coloneqq\frac{E_0}{E}\implies\varepsilon E&=E_0\\
E_0&=k\frac{q}{r^2}
\end{aligned}\right\}a=b
\]
\end{document}

enter image description here

  • This is definitely much simpler and semantically better. Surprised I didn't think to put the implies part in the environment itself. – tambre May 21 '19 at 15:15
2

The problem is that the brace wants to be centered around the math axis. Thus, one option is to change the math axis of the preceding material by way of \vcenter.

Maybe this?

\documentclass[border=3pt]{standalone}

\usepackage{mathtools}

\begin{document}
    \begin{math}
        \left.
        \vcenter{\hbox{$\displaystyle
        \varepsilon\coloneqq\frac{E_0}{E}
        \implies
        \begin{aligned}[t]
            \varepsilon E&=E_0\\
            E_0&=k\frac{q}{r^2}
        \end{aligned}
        $}}
        \right\}
    \end{math}
\end{document}

enter image description here

Here's an alternative approach in which the right brace is scaled to the content height, using the scalerel package:

\documentclass[border=3pt]{standalone}

\usepackage{mathtools,scalerel}

\begin{document}
    \begin{math}
        \varepsilon\coloneqq\frac{E_0}{E}
        \implies
        \scaleleftright{.}{
        \begin{aligned}[t]
            \varepsilon E&=E_0\\
            E_0&=k\frac{q}{r^2}
        \end{aligned}
        }{\Biggr\}}
    \end{math}
\end{document}

enter image description here