I'm trying to get some sort of nesting braces for some math notes that I'm typing, this is the code that I'm using:

\documentclass[11pt, oneside, french]{article}
\usetikzlibrary{tikzmark,intersections, decorations.pathreplacing,shapes,snakes}
\begin{tikzpicture}[remember picture, overlay, decoration={brace, amplitude=5pt}]
\foreach \i / \j in {a/0, b/10pt, c/0, d/0, e/0, f/0, g/0, h/0} \coordinate (\i) at ([yshift=\j]{pic cs:\i});
\draw [decorate] (b -| d) -- (c |- b) node[midway,below,yshift=-5pt] {$1 \times n$} coordinate(k);
\draw [decorate] (b -| f) -- (e |- b) node[midway,below,yshift=-5pt] {$n \times n$} coordinate(l);
\draw [decorate] (b -| h) -- (g |- b) node[midway,below,yshift=-5pt] {$1 \times 1$} coordinate(m);
\begin{tikzpicture}[remember picture, overlay, decoration={brace, amplitude=5pt}, yshift=-15pt]
\draw [decorate] (b -| l) -- (k |- b) node[midway,below] {$n \times n$};

This is the output that I'm getting:

enter image description here

I would like to instead have the second brace under the 1 x n and n x n is there any way I can do that? I do have to go even lower to have another brace encompassing the next line which would be 1 x n to be braced with 1 x 1.

If you have any other ideas on how I could accomplish it, maybe without TikZ, I am more than open to suggestions.

Edited to add what was asked in comment.

  • 1
    please extend your code snippet to complete small documnet beginning with \documentclass{...} folowoed by needed packages and your equation, and ending with \end{document} – Zarko Feb 4 '18 at 11:39

Since your MWE is not complete, I can't reproduce your output.

However, tikzmark is useless here, there is \underbrace from \amsmath package which could be also nested.

Maybe this is what you want to achieve (you could also add some \quad where you like or any other kerning, if you want):

            \underbrace{U^{T}}_{1\times n}\cdot\underbrace{A}_{n\times n}
        }_{1\times n}\cdot\underbrace{U}_{n\times 1}
    }_{1\times 1}   

enter image description here

  • This is exactly what I was looking for, thanks you so much, didn't realize you could nest with \underbrace – Sephya Feb 4 '18 at 20:13
  • I love the waterfall of underbrace's <3. – manooooh Oct 9 '18 at 19:01

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.