我是 tikz 新手。我需要在工作中使用八边形。我以某种方式设法绘制了一个五边形?
如何绘制八边形,并在里面用箭头设置文字?有没有绘制八边形的命令?
以下是我们目前所尝试过的。
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=1.6]
\draw[ultra thick,color=black,fill=gray!20,text = black] (0,1)--(-0.9510565163,0.309017)--(-0.58778525229,-0.809017)--(0.58778525229,0.809017)--(0.9510565163,0.309017)--cycle;
\end{tikzpicture}
\end{figure}
\end{document}
答案1
像这样吗?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes, positioning}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[octagon/.style=
{shape=regular polygon, regular polygon sides=8, draw, minimum width=.8in}]
\node[octagon] (India) {India};
\node[octagon, below left=of India] (Italy) {Italy};
\node[octagon, below right=of India] (Sweden) {Sweden};
\draw[->] (Italy) -- node [left] {A} (India);
\draw[->] (Sweden) -- node [right] {BC} (India);
\draw[->] (Sweden) -- node [above] {CDE} (Italy);
\end{tikzpicture}
\end{document}