
我想在兩個節點的右側製作一個大括號,但我不希望將其附加到,但我想要一些額外的空間。對於起始位置,我的解決方案似乎運作良好,但由於某種原因,結束位置不受影響。我做錯了什麼以及我該怎麼做?
\documentclass{memoir}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, positioning, arrows.meta, decorations.pathreplacing}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\node (foo) [draw, minimum width=6 em]
{Foo};
\node (bar) [draw, minimum width=6 em, below=of foo]
{Bar};
\draw [thick, decorate, decoration={brace, amplitude=6pt}] (foo.north east) + (1ex,1ex) -- (bar.south east) + (1ex, -1ex) node(foobar) [midway, xshift=3em] {FooBar};
\end{tikzpicture}
\end{document}
答案1
您不需要任何移位或這些計算,而只需新增raise=<length>
到大括號選項即可。
輸出
程式碼
\documentclass{memoir}
\usepackage{tikz}
\usetikzlibrary{calc, shapes.geometric, positioning, arrows.meta, decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\node (foo) [draw, minimum width=6 em]
{Foo};
\node (bar) [draw, minimum width=6 em, below=of foo]
{Bar};
\draw [thick, decorate, decoration={brace, amplitude=6pt, raise=5pt}] (foo.north east) -- (bar.south east) node(foobar) [midway, xshift=3em] {FooBar};
\end{tikzpicture}
\end{document}