答案1
看起来原始图形是用 Asymptote 绘制的。这是 TikZ 版本。在我看来,TikZ 绘图的一般原则是将node
s 和pic
s 放在 s 旁边path
。所以这段代码很好地说明了这个原则。
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
[arcarr/.pic={\draw[-stealth,red] (-.3,0) arc(180:0:.3);}]
\def\b{2}
\draw[thick] (0,0)
--(0,2*\b) pic[midway]{arcarr} node[midway,right=3mm]{$\Gamma$}
--(\b,2*\b) pic[midway,rotate=-90]{arcarr} node[midway,below=3mm]{$\Gamma$}
--(\b,0) pic[midway,xscale=-1]{arcarr} node[midway,left=3mm]{$\Gamma$};
\draw[gray] (0,-.2)--(0,-.7) (\b,-.2)--(\b,-.7);
\draw[gray,<->] (0,-.5)--+(0:\b) node[midway,above,black]{$b$};
\end{tikzpicture}
\end{document}
答案2
使用一些宏。
\documentclass[tikz, border=20]{standalone}
\newcommand{\hquotnum}[3]{
\draw[|<->|] (0,-1 -| #1) -- (0,-1 -| #2) node[midway,above]{$#3$};}
\def\rd{5mm}
\newcommand{\rquotGamma}[4]{\draw[->] ([xshift=-\rd]$(#1)!0.5!(#2)$) arc[start angle=200,end angle=-20,radius=\rd] node[below #3]{{\Large$#4$}};}
\usetikzlibrary{calc,arrows.meta,bending}
\begin{document}
\begin{tikzpicture}[>={Latex[length=4mm,width=1.5mm,bend]}]
\draw[very thick] (0, 0) coordinate (a) -- (0, 6) coordinate (b) -- (5, 6) coordinate (c) -- (5, 0) coordinate (d);
\draw[very thick] (8, 0) coordinate (e) -- (8, 3) coordinate (f) -- (13, 3) coordinate (g) -- (13, 0) coordinate (h);
\fill ($(f)!0.5!(g)$) coordinate (p) circle[radius=2pt] node[above]{$P$};
\hquotnum{a}{d}{b}
\hquotnum{d}{e}{\frac{b}{2}}
\hquotnum{e}{p}{\frac{b}{2}}
\hquotnum{e}{p}{\frac{b}{2}}
\def\cshift{10mm}
\draw[|<->|] ([xshift=\cshift]c) -- ([xshift=\cshift]c |- f) node[midway,right]{$b$};
\rquotGamma{a}{b}{right}{\Gamma}
\begin{scope}[rotate=90,xscale=-1]
\rquotGamma{b}{c}{right}{\Gamma}
\end{scope}
\begin{scope}[xscale=-1]
\rquotGamma{c}{d}{left}{\Gamma}
\end{scope}
\rquotGamma{e}{f}{right}{}
\begin{scope}[rotate=90,xscale=-1]
\rquotGamma{p}{g}{right}{}
\end{scope}
\begin{scope}[xscale=-1]
\rquotGamma{g}{h}{left}{}
\end{scope}
\end{tikzpicture}
\end{document}