如何将下面的代码转换为自定义形状?
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\tikzset{
every text node part/.style={align=center},
brackets/.style={decorate,decoration={brace,amplitude=2pt}},
}
\node[] (A) {A\\B\\C};
\draw[brackets] (A.north east) -- (A.south east);
\draw[brackets] (A.south west) -- (A.north west);
\end{tikzpicture}
\end{document}
答案1
我有以下解决方案,可以转移事情发生的点。我认为必须在节点的内容中进行构造,而不是在节点样式本身中进行构造。
\documentclass[11pt, border=1cm]{standalone}
\usepackage{amssymb, amsmath}
\usepackage{tikz}
\begin{document}
\newcommand{\bnode}[1]{$\displaystyle\left\{\begin{matrix}#1\end{matrix}\right\}$}
\begin{tikzpicture}
\path (0, 0) node[draw, circle, outer sep=1ex] (A) {};
\path (3, 0) node (B) {\bnode{A\\B\\C}};
\path (A) edge (B);
\end{tikzpicture}
\end{document}