关键字:xshift,yshift,shift
要点:
- 如果xshift或yshift的偏移量值为0,则可以省略。
- 如果x或y方向上某个值为0,则shift可以用更易读的xshift或yshift代替。
- shfit后面的参数要用花括号括起来
这里以正六边形为例,代码:
\begin{tikzpicture}[scale=1]
\coordinate (P1) at (1,0);
\coordinate (P2) at ([shift={+(120:1cm)}] P1);
\coordinate (P3) at ([shift={+(-1,0)}] P2);
\coordinate (P4) at ([shift={+(240:1cm)}] P3);
\coordinate (P5) at ([shift={+(300:1cm)}] P4);
\coordinate (P6) at ([xshift=1cm, yshift=0] P5);
\draw (P1)node [right]{P1}
--(P2)node [above right]{P2}
--(P3)node [above left]{P3}
--(P4)node [left]{P4}
--(P5)node [below left]{P5}
--(P6)node [below right]{P6}
--cycle;
\end{tikzpicture}
效果: