在图形循环上添加带标签的箭头

在图形循环上添加带标签的箭头

我有一个环,对于环的每个边缘,我想添加一个带有特定标签的定向箭头。我该怎么做?

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\begin{document}

\tikzset{
    nodo/.style = {minimum size=0.8cm}}
\begin{tikzpicture}

\def \n {8}
\def \radius {3cm}
\def \margin {8} % margin in angles, depends on the radius

\node[nodo,draw, circle] at ({360/\n * (0)}:\radius) (x) {x};
\draw[-, >=latex] ({360/\n * (0)+\margin}:\radius) 
    arc ({360/\n * (0)+\margin}:{360/\n * (1)-\margin}:\radius);

\foreach \s in {2,...,\n}
{
  \node[nodo,draw, circle] at ({360/\n * (\s - 1)}:\radius) {};
  \draw[-, >=latex] ({360/\n * (\s - 1)+\margin}:\radius) 
    arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);
}
\end{tikzpicture}
\end{document}

答案1

欢迎来到 TeX.SX!基于您的代码的方法可能是:

\documentclass{article}
\usepackage{tikz}
\begin{document}

\tikzset{
    nodo/.style = {minimum size=0.8cm}}
\begin{tikzpicture}

\def \n {8}
\def \radius {3cm}
\def \margin {8} % margin in angles, depends on the radius

\foreach \s in {1,...,\n} {
  \node[nodo,draw, circle] at ({360/\n * (\s - 1)}:\radius) {\ifnum\s=1 x\fi};
  \draw ({360/\n * (\s - 1)+\margin}:\radius) 
    arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);
  \draw[<-, >=latex] ({360/\n * (\s - 1)+\margin}:{\radius+1cm}) 
    arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:{\radius+1cm});
  \node at ({360/\n * (\s - 0.5)}:\radius+1.5cm) {$M$};
}

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

纯粹为了比较,这里有一个元帖子版本。

\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path node_circle, base_circle, arro_circle, mlab_circle;
node_circle = fullcircle scaled 8mm;
base_circle = fullcircle scaled 6cm;
arro_circle = fullcircle scaled 8cm;
mlab_circle = arro_circle rotated 22.5 scaled 1.1;
numeric r; r = 3/16;
draw base_circle;
for i=0 upto 7:
    fill node_circle shifted point i of base_circle withcolor white;
    draw node_circle shifted point i of base_circle;
    drawarrow subpath (i + 1 - r, i + r) of arro_circle withcolor 2/3 blue;
    label("$M$", point i of mlab_circle);
endfor
label("$x$", point 0 of base_circle);
endfig;
\end{mplibcode}
\end{document}

编译它lualatex得到以下内容:

在此处输入图片描述

答案3

像这样(我制作了一些化妆品......):

在此处输入图片描述

代码:

\documentclass{article}
\usepackage{tikz}
\begin{document}
    
    \tikzset{
        nodo/.style = {minimum size=1.6cm}}
    \begin{tikzpicture}[scale=2]
        
        \def \n {8}
        \def \radius {3cm}
        \def \raggio {3.4cm}
        \def \margin {8} % margin in angles, depends on the radius
        
        \foreach \s in {1,...,\n}
        {
            \node[nodo,draw, circle] at ({360/\n * (\s - 1)}:\radius) {\bfseries \Large \s};
            \draw[line width=2pt, -latex] ({360/\n * (\s - 1)+\margin}:\radius) 
            arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);
        }
        \foreach \s in {1,...,\n}
        {
        %   \node[nodo,draw, circle] at ({360/\n * (\s - 1)}:\radius) {};
            \draw[cyan,line width=2pt, -latex] ({360/\n * (\s - 1)+\margin}:\raggio) 
            arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\raggio) node[red,pos=.5,fill=white] () { \bfseries \large M};
        }
    \end{tikzpicture}
\end{document}

相关内容