4

Is there any way to add braces around a system of equations? Say I want to add braces around:

a=x+2y+3z

b=6x+y+2z

c=5x+3y+z

The best example I could find of how I want the braces to look is the "2d,3d,4th,5th,6th" thing here:

enter image description here

In other words, they need to be curly braces and appear on both sides. They also need to enclose the whole system.

Thanks!

4

Here are two possibilities, depending on what you mean by "curly".

The first type of brace grows wider the taller it gets; however, in this case, I have limited its maximum width to 3ex.

The second type of brace will never grow wider, but only taller.

EDITED to add \stackMath to perform stacks in math mode.

\documentclass{article}
\usepackage{scalerel}
\usepackage[usestackEOL]{stackengine}
\stackMath
\begin{document}
\[
\scaleleftright[3ex]{\{}
{\Centerstack{a=x+2y+3z\\
b=6x+y+2z\\
c=5x+3y+z}}
{\}}
\quad
\left\{ 
\Centerstack{a=x+2y+3z\\
b=6x+y+2z\\
c=5x+3y+z}
\right \}
\]
\end{document}

enter image description here

If you had a curly-brace glyph that was more to your liking from a different (importable) font, it could be used in the first method presented below.

For example, here we use the brace from the mathdesign package.

\documentclass{article}
\usepackage{scalerel}
\usepackage[usestackEOL]{stackengine}
\stackMath
\usepackage[utopia]{mathdesign}
\begin{document}
\[
\scaleleftright[3ex]{\{}
{\Centerstack{a=x+2y+3z\\
b=6x+y+2z\\
c=5x+3y+z}}
{\}}
\quad
\left\{ 
\Centerstack{a=x+2y+3z\\
b=6x+y+2z\\
c=5x+3y+z}
\right \}
\]
\end{document}

enter image description here

As a follow up for the OP, the mathdesign braces may be solely obtained (as \textbraceleft and \textbraceright) using the method of egreg at Import curly brackets from MathDesign (Utopia).

In the MWE below, I only import it as such. So the left hand \scaleleftright uses it, while the right-hand solution uses the default LaTeX brace. However, by uncommenting the additional code provided, these curly braces will become the default math brace.

In either case, however, the rest of the mathdesign glyphs are not imported.

\documentclass{article}
\usepackage{scalerel}
\usepackage[usestackEOL]{stackengine}
\stackMath
%\usepackage[utopia]{mathdesign}
\DeclareSymbolFont{mdsymbols}     {OMS}{mdput}{m}{n}
\DeclareSymbolFont{mdlargesymbols}{OMX}{mdput}{m}{n}
% TO GET ALL BRACES REPLACED WITH THE mathdesign BRACE
%\DeclareMathDelimiter{\lbrace}
%   {\mathopen}{mdsymbols}{"66}{mdlargesymbols}{"08}
%\DeclareMathDelimiter{\rbrace}
%   {\mathclose}{mdsymbols}{"67}{mdlargesymbols}{"09}
%
% TO JUST IMPORT mathdesign BRACES AS \textbraceleft and \textbraceright
\renewcommand{\textbraceleft}{%
  {\fontfamily{mdput}\fontencoding{OMS}\selectfont\char"66}}
\renewcommand{\textbraceright}{%
  {\fontfamily{mdput}\fontencoding{OMS}\selectfont\char"67}}
\begin{document}
\[
\scaleleftright[3ex]{$\textbraceleft$}
{\Centerstack{a=x+2y+3z\\
b=6x+y+2z\\
c=5x+3y+z}}
{$\textbraceright$}
\quad
\left\{ 
\Centerstack{a=x+2y+3z\\
b=6x+y+2z\\
c=5x+3y+z}
\right \}
\]
\end{document}

enter image description here

  • Thank you so much! The second one looks great, but I'm using the amspackage. Is it still possible to use it? (Sorry if it's obvious, I'm new to TeX) – user45220 Feb 20 '15 at 16:36
  • @user45220 Generally, there is nothing that prevents the use of two packages at the same time. Sometimes, with font packages however, the importation of replacement glyphs replaces more than was desired. Sometimes, in those case, a single or several glyphs can be imported from a font, rather than the whole font as a replacement. Are you able to get an acceptable answer using both the mathdesign package and the amsmath package? – Steven B. Segletes Feb 20 '15 at 16:43
  • Thank you for the detailed response! Unfortunately, I just tried to use the two packages in conjunction but as you said it replaced all of the other symbols as well (including the font). Any ideas? – user45220 Feb 20 '15 at 16:49
  • 1
    @user45220 See my follow up. – Steven B. Segletes Feb 20 '15 at 17:00
  • 1
    @user45220 Peter correctly pointed out that my stacks were in text, not math mode. Adding \stackMath to the preamble fixes that, and I have edited my answer to reflect that correction. – Steven B. Segletes Feb 20 '15 at 17:09
9

here's an approach that takes advantage of some matrix structures from amsmath.

the braces aren't as slinky as the ones shown in your visual, but they do stretch automatically to accommodate what's stacked inside.

i avoided the left-hand element since i didn't want to fiddle with the different levels of roots (and you didn't say that was relevant); however, in a "chain" like this, the left element is just the mirror image of what's on the right.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
 \text{is the }
 \begin{Bmatrix}
  2\mathrm{d}\\3\mathrm{d}\\4\mathrm{th}\\5\mathrm{th}\\6\mathrm{th}
 \end{Bmatrix}
 \text{ root of }
 \left\{
 \begin{matrix}
  a,\\a,\\a,\\a,\\a,
 \end{matrix}
 \right.
\]
\end{document}

output of example code

  • Beautiful! I really like how you used the cover image I posted for the example. Looks fab. – user45220 Feb 20 '15 at 16:38
7

You can easily do that with the rcases environment from mathtools.

Another, cleaner solution is to use @Gonzalo Medina's code to define an lrcases environment, and its displaystyle version, dlrcases.

The following codes presents both solutions:

    \documentclass[pdf]{article}
    \usepackage{mathtools}
\usepackage{xcolor}
\usepackage{pstricks} 

    \makeatletter
    \newcases{dlrcases}{\quad}{%
      $\m@th\displaystyle{##}$\hfil}{$\m@th\displaystyle{##}$\hfil}{\lbrace}{\rbrace}
    \newcases{lrcases}{\quad}{%
      $\m@th{##}$\hfil}{{##}\hfil}{\lbrace}{\rbrace}
    \makeatother

\newcommand\oldstyleroot[2][]{%
{\let\sqrtsign\surd\sqrt[#1]{#2}}}

    \begin{document}

     \[ \oldstyleroot[3]{\frac a b}\begin{rcases}
        \sqrt a \\ \sqrt[3]a\\ \sqrt[4] a\\ \sqrt[5]a\\ \sqrt[6]a \end{rcases}
      \text{ is the }
      \begin{cases}
        \begin{rcases}
        2\mathrm{d} \\3\mathrm{d}\\4\mathrm{th}\\5\mathrm{th}\\6\mathrm{th}
        \end{rcases}
      \end{cases}
      \hskip-1em
      \text{root of }
      \begin{cases}
        a, \\a,\\a,\\a,\\a,
      \end{cases}
    \]
    \vskip 0.5cm
     \[ \begin{rcases}
        \sqrt a \\ \sqrt[3]a\\ \sqrt[4] a\\ \sqrt[5]a\\ \sqrt[6]a \end{rcases}
      \text{ is the }
      \begin{dlrcases}
        2\mathrm{d} \\3\mathrm{d}\\4\mathrm{th}\\5\mathrm{th}\\6\mathrm{th}
      \end{dlrcases}
      \text{root of }
      \begin{cases}
        a, \\a,\\a,\\a,\\a,
      \end{cases}
    \]

   \[\begin{pspicture}
 \begin{aligned}
 \sqrt a\pnode[0.25em,2ex](0,0){A}\\ \sqrt[3]a & \\ \sqrt[4] a & \\ \sqrt[5]a & \\ \sqrt[6]a \pnode[0.25em,-0.5ex](0,0){B} \end{aligned}
 \text{ is the }
 \begin{cases}
 \begin{rcases}
 2\mathrm{d} \\3\mathrm{d}\\4\mathrm{th}\\5\mathrm{th}\\6\mathrm{th}
 \end{rcases}
 \end{cases}
 \hskip-1em
 \text{root of }
 \begin{cases}
 a, \\a,\\a,\\a,\\a,
 \end{cases}
\makebox[3cm]{\psbrace(B)(A){}}
\end{pspicture}
 \]
    \end{document} 

enter image description here

  • Thank you so much! Do you know how to make them curly/curvy like the one in the picture by any chance? – user45220 Feb 20 '15 at 16:55
  • 2
    Not really. In pstricks-add is defined a \psbrace command that looks more like the picture, but it might be more complex to make it work in this context. I'll try to see it. There's also the problem of using surds (with no horizontal line). – Bernard Feb 20 '15 at 17:03
  • 1
    @Matemáticos Chibchas: I'm sorry, the code shouldn't display a surd. This is only a kind of pretty display obtained from a special configuration of my editor for better readibility of maths formulae in the source code, which is nevertheless saved of normal code (similarly, Greek letters in formulae are displayed as real Greek letters, but saved as \alpha, &c.). And no, the surd symbol is not easily obtained from the keyboard: in the configuration file of my editor I had to use its unicode number. – Bernard Mar 31 '17 at 22:42

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.