3

Is there a node suffix for the corners of a node?

I'd like the brace in this example to go from the lower-left corner of the first box to the lower-right corner of the last.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,patterns,decorations.pathreplacing}
\begin{document}
    \tikzstyle{frame} = [rectangle, draw, fill=blue!20,
        text width=4em, text centered, minimum height=3em, node distance=3cm]
    \begin{tikzpicture}
        \node [frame] (f1) {$f_1$};
        \node [frame, right of=f1] (f2) {$f_2$};
        \node [frame, right of=f2] (f3) {$f_3$};
        \draw [decoration={brace,mirror},decorate] (f1.center) -- (f3.center);
    \end{tikzpicture}
\end{document}

MWE

  • 6
    The corners are compass points: south west is the lower left. – Andrew Stacey Apr 26 '13 at 9:57
4

Use south east and south west anchors (details on page 308 of TikZ manual):

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,patterns,decorations.pathreplacing}
\begin{document}
    \tikzstyle{frame} = [rectangle, draw, fill=blue!20,
        text width=4em, text centered, minimum height=3em, node distance=3cm]
    \begin{tikzpicture}
        \node [frame] (f1) {$f_1$};
        \node [frame, right of=f1] (f2) {$f_2$};
        \node [frame, right of=f2] (f3) {$f_3$};
        \draw [decoration={brace,mirror},decorate] (f1.south west) -- (f3.south east);
    \end{tikzpicture}
\end{document}

Result:

enter code here

  • 2
    If you have an unknown number of boxes you would like to underbrace, you can also use fit library of tikz which will create a box for you encompassing any number of given boxes (then, you can use south west and south east on this box). – Jean-Christophe Dubacq Apr 26 '13 at 11:18

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.