我想学习使用 TikZ 键入字符串图表。更详细地说,我想使用 tikz 键入下图。这可能吗?如果可以,如何操作或最重要的要素是什么?
答案1
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{positioning,intersections}
\begin{document}
\begin{tikzpicture}
\node (B1) {B};
\node[right=1cm of B1] (B2) {B};
\node[right=2cm of B2] (B3) {B};
\node[below=5cm of B3] (B6) {B};
\node[left=1cm of B6] (B5) {B};
\node[left=1.2cm of B5] (B4) {B};
\draw (B3) -- (B6) coordinate[pos=0.3] (H1);
\draw[-latex,name path=path1] (B1)--++(0,-3cm)coordinate[pos=0.3] (H3) arc[start angle=-180,end angle=0,radius=0.8] to
[out=90,in=225] (H1) ;
\draw (B2) to[out=-90,in=90] (B5);
\path[name path=path2] (B4)--++(0,4cm);
\path[name intersections={of=path1 and path2,by=H2}];
\draw (B4)--(H2) node[circle,fill]{};
\draw (H3)to[out=0,in=90]++(0.5,-0.5)node[draw,below]{x};
\end{tikzpicture}
\end{document}
编辑:只是为了好玩:没有交叉点。
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node (B1) {B};
\node[right=1cm of B1] (B2) {B};
\node[right=2cm of B2] (B3) {B};
\node[below=5cm of B3] (B6) {B};
\node[left=1cm of B6] (B5) {B};
\draw (B3) -- (B6) coordinate[pos=0.3] (H1);
\draw[-latex] (B1)--++(0,-3cm)coordinate[pos=0.3] (H3) arc[start angle=-180,end angle=0,radius=0.8]
coordinate[midway](H2) to [out=90,in=225](H1) ;
\node at (H2|-B5) (B4) {B};
\draw (B2) to[out=-90,in=90] (B5);
\draw (B4)--(H2);
\draw (H3)to[out=0,in=90]++(0.5,-0.5)node[draw,below]{x};
\foreach \i in {2,3} \draw[fill] (H\i) circle(2pt);
\end{tikzpicture}
\end{document}