0

I am using tikz to make a flow diagram of a matrix appending rows. For the last matrix I want to add curly braces on the right and top of the matrix with texts. Below is my code which can add curly brace and text to the right:

\documentclass[12pt]{article}
\usepackage{multirow,graphics,graphicx,supertabular}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing,calc,positioning}

\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
    \node (B) {
    $\begin{bmatrix}
        1 & 0 & \dots & 1 \\
        2 & 0 & \dots & 1 
     \end{bmatrix}$};
    \node[left=3.5cm of B] (A) {
    $\begin{bmatrix}
        1 & 0 & \dots & 1 
     \end{bmatrix}$};
    \node[right=3.5cm of B] (C){
    $\begin{rcases}\displaystyle
     \begin{bmatrix}
        1 & 0 & \dots & 1 \\
        2 & 0 & \dots & 1 \\
        3 & 1 & \dots & 4 
     \end{bmatrix}
     \end{rcases}
     \text{$N_{\mathrm{conf}}$}$};
    \draw[->] (A)--(B) node[midway, above,font=\small] {
    $+\begin{bmatrix}
        1 & 0 & \dots & 3
      \end{bmatrix}$};
    \draw[->] (B)--(C) node[midway, above,font=\small] {
    $+\begin{bmatrix} 
        1 & 0 & \dots & 3
      \end{bmatrix}$};
\end{tikzpicture}
\caption{Flow diagram of the matrix.}
\label{bootstrap_flowchart}
\end{figure}
\end{document}

But I am expecting to get something like this enter image description here I don't know how to add the curly brace and the text "Columns" on top of the matrix. Any suggestions?

2 Answers 2

2

--adding the code

\draw[decorate, ultra thick] ($(C.north west)+(2ex,0pt)$) -- 
   ($(C.north east)-(9ex,0pt)$) node[above=3pt,midway] {some text};

should produce the brace required

--in the preamble add calligraphy

  \usetikzlibrary{matrix,decorations.pathreplacing,calc,positioning,calligraphy}

enter image description here

\documentclass[12pt]{article}
\usepackage{multirow,graphics,graphicx,supertabular}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{matrix,decorations.pathreplacing,calc,positioning,calligraphy}

\begin{document}
\begin{figure}[h]
\centering
   \begin{tikzpicture}[decoration={calligraphic brace,amplitude=6pt}]
    \node (B) {
    $\begin{bmatrix}
        1 & 0 & \dots & 1 \\
        2 & 0 & \dots & 1 
     \end{bmatrix}$};
    \node[left=3.5cm of B] (A) {
    $\begin{bmatrix}
        1 & 0 & \dots & 1 
     \end{bmatrix}$};
    \node[right=3.5cm of B] (C){
    $\begin{rcases}\displaystyle
     \begin{bmatrix}
        1 & 0 & \dots & 1 \\
        2 & 0 & \dots & 1 \\
        3 & 1 & \dots & 4 
     \end{bmatrix}
     \end{rcases}
     \text{$N_{\mathrm{conf}}$}$};
    \draw[->] (A)--(B) node[midway, above,font=\small] {
    $+\begin{bmatrix}
        1 & 0 & \dots & 3
      \end{bmatrix}$};
    \draw[->] (B)--(C) node[midway, above,font=\small] {
    $+\begin{bmatrix} 
        1 & 0 & \dots & 3
      \end{bmatrix}$};
     \draw[decorate, ultra thick] ($(C.north west)+(2ex,0pt)$) -- ($(C.north east)-(9ex,0pt)$) node[above=3pt,midway] {some text};

\end{tikzpicture}
\caption{Flow diagram of the matrix.}
\label{bootstrap_flowchart}
\end{figure}
\end{document}
1

Just surround the matrix with the command \overbrace as follows:

\documentclass[12pt]{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
    \begin{bmatrix}
        1 & 0 & \dots & 1
    \end{bmatrix} 
    \xrightarrow{+ \begin{bmatrix}
                        1 & 0 & \dots & 3
                   \end{bmatrix}} 
    \begin{bmatrix}
        1 & 0 & \dots & 1 \\
        2 & 0 & \dots & 1 
    \end{bmatrix}
    \xrightarrow{+ \begin{bmatrix}
                        1 & 0 & \dots & 3
                   \end{bmatrix}} 
    \overbrace{\begin{bmatrix}
        1 & 0 & \dots & 1 \\
        2 & 0 & \dots & 1 \\
        3 & 1 & \dots & 4 
     \end{bmatrix}}^{\text{Columns}}     
\end{align*}

\end{document}

Note that it is not necessary to use Tikz, and you can use the command \xrightarrow to generate an arrow and write anything above or below it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .