我正在准备一个像这样的图:
但我无法从绿色形状的中点画出到另一个节点的曲线(如图所示)。还有 A 和 C 节点下的支撑。如何实现?
这些应该与颜色无关,并且文本(带有文本的这条线)应该像线一样弯曲。
我到目前为止已经尝试过:
\documentclass[statementpaper,11pt,twoside]{memoir}
\setlrmarginsandblock{0.75in}{0.75in}{*} %left-right
\setulmarginsandblock{1.0in}{1.0in}{*} %top-bottom
\checkandfixthelayout
\usepackage{tikz}
\usetikzlibrary{fit,positioning,hobby}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node (a) {A};
\node [above right=of a] (b) {B};
\node [right=of a] (c) {C};
\node [below=of c] (d) {D};
\draw[thick, green] ([shift={(-3mm,-3mm)}]a.south west) to[closed, curve through={(a.south east) .. (b.south east) .. ([shift={(+3mm,+3mm)}]b.north east)..(b.north west)..(a.north west)}] cycle;
\end{tikzpicture}
\end{center}
\end{document}
答案1
像这样吗?
\documentclass[statementpaper,11pt,twoside]{memoir}
\setlrmarginsandblock{0.75in}{0.75in}{*} %left-right
\setulmarginsandblock{1.0in}{1.0in}{*} %top-bottom
\checkandfixthelayout
\usepackage{tikz}
\usetikzlibrary{fit,positioning,hobby}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{center}
\begin{tikzpicture}
\node (a) {A};
\node [above right=of a] (b) {B};
\node [right=of a] (c) {C};
\node [below=of c] (d) {D};
\draw[thick, green] ([shift={(-3mm,-3mm)}]a.south west) to[closed, curve through={(a.south east) .. (b.south east) .. ([shift={(+3mm,+3mm)}]b.north east) ..(b.north west)..(a.north west)}] cycle;
\draw[->,orange,thick,postaction={decorate,decoration={raise=1ex,text along path,text align=center,text={Your bent text}}}] ([shift={(+3mm,+3mm)}]b.north east) to[out=20,in=20] (d) ;
\draw [red,thick,decorate,decoration={brace,amplitude=5pt,mirror,raise=1ex}]
(a.west) -- (c.east) node[midway,yshift=-1.5em]{both items};
\end{tikzpicture}
\end{center}
\end{document}