我想在两个节点的右侧制作一个支架,但我不想将它连接到该支架上,而是想要一些额外的空间。对于起始位置,我的解决方案似乎效果很好,但出于某种原因,结束位置不受影响。我做错了什么,我该怎么做?
\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}