我有以下 TikZ 代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
% -------------------
\begin{document}
\begin{tikzpicture}
% triangle
\node (a) [draw, regular polygon, regular polygon sides=3, minimum size=6cm,
label=corner 1:$a$, label=corner 2:$b$, label=corner 3:$c$] at (0, 0) {};
% dotted axis
\foreach \x in {1, 2, 3}{
\draw [darkgray, dashed, shorten <=-0.4cm, shorten >=-0.4cm](a.center) -- (a.side \x);
\draw [darkgray, dashed, shorten <=-0.37cm, shorten >=-0.37cm](a.center) -- (a.corner \x);
}
% indicating sense of rotation
\draw [x=0.07cm, y=0.3cm, -stealth, rotate=90] (a.corner 1) + (0.2, -0.15cm) arc (-150:150:1);
\draw [x=0.07cm, y=0.3cm, -stealth, rotate=-150] (a.corner 2) + (0.2, -0.15cm) arc (-150:150:1);
\draw [x=0.07cm, y=0.3cm, -stealth, rotate=-30] (a.corner 3) + (0.2, -0.15cm) arc (-150:150:1);
\end{tikzpicture}
\end{document}
生成如下图片:
我怎样才能将三个角标签隔开,使它们不位于其他线的顶部?
答案1
标签只是节点,因此它们可以理解所有常见的键,例如anchor
,shift
等等。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
% -------------------
\begin{document}
\begin{tikzpicture}
% triangle
\node (a) [draw, regular polygon, regular polygon sides=3, minimum size=6cm,
label={[anchor=south west,yshift=1mm]corner 1:$a$},
label={[yshift=-1mm]corner 2:$b$},
label={[yshift=-1mm]corner 3:$c$}] at (0, 0) {};
% dotted axis
\foreach \x in {1, 2, 3}{
\draw [darkgray, dashed, shorten <=-0.4cm, shorten >=-0.4cm](a.center) -- (a.side \x);
\draw [darkgray, dashed, shorten <=-0.37cm, shorten >=-0.37cm](a.center) -- (a.corner \x);
}
% indicating sense of rotation
\draw [x=0.07cm, y=0.3cm, -stealth, rotate=90] (a.corner 1) + (0.2, -0.15cm) arc (-150:150:1);
\draw [x=0.07cm, y=0.3cm, -stealth, rotate=-150] (a.corner 2) + (0.2, -0.15cm) arc (-150:150:1);
\draw [x=0.07cm, y=0.3cm, -stealth, rotate=-30] (a.corner 3) + (0.2, -0.15cm) arc (-150:150:1);
\end{tikzpicture}
\end{document}