5

This code gives a single side brace for the vector (shown in black in image below).How can I modify this code to get two side braces (as shown in pink picture below) instead of single

enter image description here

    $${\bf x} = \left.\left( 
                                  \begin{array}{c}
                                         x_1\\
                                         \vdots\\
                                         x_{n_1}\\
                                         x_{n_1+1}\\
                                         \vdots\\
                                         x_n
                                  \end{array}
                            \right)
                        \right\}n
$$
7

There may be easier ways, but here it is with stacks.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\stackMath
\begin{document}
\[
{\bf x} = \left( 
                                  \begin{array}{c}
                                         x_1\\
                                         \vdots\\
                                         x_{n_1}\\
                                         x_{n_1+1}\\
                                         \vdots\\
                                         x_n
                                  \end{array}
                            \right)
\setstackgap{L}{1.2\normalbaselineskip}
\vcenter{\hbox{\stackunder[1pt]{%
  \left.{\Centerstack{\\ \\}}\right\}n_1%
}{
  \left.{\Centerstack{\\ \\}}\right\}n_2%
}}}
\]
\end{document}

enter image description here

If the braces need to be asymmetric:

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\stackMath
\begin{document}
\[
{\bf x} = \left( 
                                  \begin{array}{c}
                                         x_1\\[-6pt]
                                         \vdots\\[-6pt]
                                         x_{n_1}\\
                                         x_{n_1+1}\\[6pt]
                                         \vdots\\[6pt]
                                         x_n
                                  \end{array}
                            \right)
\setstackgap{L}{1.2\normalbaselineskip}
\vcenter{\hbox{\stackunder[2pt]{%
  \left.{\Centerstack{\\}}\right\}n_1%
}{
  \left.{\Centerstack{\\ \\ \\}}\right\}n_2%
}}}
\]
\end{document}

enter image description here

  • +1 for Asymmetric braces. So good to have a general solution – NAASI Sep 27 '16 at 16:26
3

You can create this using a number of well-placed arrays and some \vphantoms:

enter image description here

\documentclass{article}

\newcommand{\noleftdelimiter}{\left.\kern-\nulldelimiterspace}

\begin{document}

\[
  \setlength{\arraycolsep}{0pt}
  \mathbf{x} = \noleftdelimiter
    \left( 
      \begin{array}{c}
        \begin{array}{c}
          x_1 \\ \vdots \\ x_{n_1}
        \end{array} \\
        \begin{array}{c}
          x_{n_1+1} \\ \vdots \\ x_n
        \end{array}
      \end{array}
    \right)
  \right\}
  n
  ~ % Some space
  \begin{array}{c}
    \noleftdelimiter
    \vphantom{\begin{array}{c}
      x_1 \\ \vdots \\ x_{n_1}
    \end{array}}
    \right\} n_1 \\
    \noleftdelimiter
    \vphantom{\begin{array}{c}
      x_{n_1+1} \\ \vdots \\ x_n
    \end{array}}
    \right\} n_2
  \end{array}
\]

\end{document}

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.