我已经创建了一个矩形,但就是找不到如何从南侧(靠近东南角)向东侧(也靠近东南角)绘制弯曲箭头的解决方案。
\documentclass[12pt,twoside,a4paper]{report}
\usepackage{a4}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings,arrows,backgrounds,calendar,matrix,mindmap,patterns,shadows,trees,positioning}
\begin{document}
\begin{tikzpicture}[auto, node distance=1cm,
block_small/.style ={rectangle, draw=black, thick, fill=white, text centered, text width=4em, minimum height=4em}]
\node [block_small, xshift=-3.3cm] (A) {A} ;
\node [block_small,right of=A, xshift=3.3cm] (B) {B} ;
\begin{pgfonlayer}{background}
% Rectangle
\path (A.west |- A.north)+(-0.45,0.45) node (a) {};
\path (B.south -| B.east)+(0.45,-0.45) node (b) {};
\path[draw=black!50, dashed] (a) rectangle (b);
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
我已经在这上面花了太多时间,希望有人可以帮忙!
答案1
你可以用合身库。只需将其放入
fit=(a1)(a2)...(an)
新节点的选项中,inner sep=<length>
您就可以控制到所有已安装节点的距离。这计算库可以让你做一些事情,比如
($(a)+(0,1)$)
从节点 a 向上 1 个单位的位置。你可以用它做类似的事情“从南侧(靠近东南角)”对于弯曲的箭头,您可以使用操作
to[out=<deg>,in=<deg>,looseness=<val>]
。如果您不喜欢这个箭头,您还可以指定更多中间点。如果箭头的起点和终点与拐角的距离相同,您也可以使用arc
。圆弧通过以下方式指定arc (start angle:end angle:radius)
代码
\documentclass[12pt,twoside,a4paper]{report}
\usepackage{tikz}
\usetikzlibrary{calc,fit,arrows}
\begin{document}
\begin{tikzpicture}
[ auto, node distance=1cm,
block_small/.style ={rectangle, draw=black, thick, fill=white, text centered, text width=4em, minimum height=4em}
]
\node [block_small, xshift=-3.3cm] (A) {A} ;
\node [block_small,right of=A, xshift=3.3cm] (B) {B} ;
% Rectangle
\node[fit=(A)(B),dashed,draw,inner sep=0.45cm] (Box) {};
\draw[-stealth] ($(Box.south east)+(-0.5,0)$) to[out=270,in=0,looseness=5] node[below right] {$\pi$} ($(Box.south east)+(0,0.5)$);
\draw[-stealth] ($(Box.south west)+(0.5,0)$) arc (360:90:0.5);
\end{tikzpicture}
\end{document}