在 TikZ 圆圈上放置文字和箭头

在 TikZ 圆圈上放置文字和箭头

我从以下 MWE 中得到了下面的图:

\documentclass{article}
\usepackage{tikz}
\usepackage{etoolbox}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{center}

\begin{tikzpicture}[scale=5.3,cap=round,>=latex]
\def\Radius{.5cm}

\draw (0cm,0cm) circle[radius=\Radius];

\begin{scope}[
    -{Stealth[round, length=8pt, width=8pt, bend]},
    shorten >=4pt,
    very thin,
  ]
    \draw (\Radius, 0) arc(-3:3:\Radius);
    \draw (-\Radius, 0) arc(180+3:180-3:\Radius);
  \end{scope}

  % draw the points 
  \fill[radius=.7pt]
    (90:\Radius) circle[] node[above left] {$\tau =$ 0 fm}
    (10:\Radius) circle[] node[above right] {$\tau \sim$ 0.6 fm}
    (-43:\Radius) circle[] node[below right] {$\tau \sim$ 1 fm}
    (170:\Radius) circle[] node[below left] {$\tau \sim$ 2 fm}
  ;

  \def\Item#1#2(#3:#4){%
    \path[
      decoration={
        text along path,
        text={text1},
        text={some text},
        text={some other text},
        text align=center,
      },
      decorate,
    ]
      (#3:\Radius-#2) arc(#3:#4:\Radius-#2)
    ;
  }
  \Item A 1pt (90:10)
  \Item B 1pt (10:-43)
  \Item C 1pt (-43:-170)
  %\Item D 2pt (60:0)
\end{tikzpicture}
    
\end{center}
\end{document}

这给了我:在此处输入图片描述 但我想要两个圆圈,圆圈中心有一些文字,90-180 度象限中只有一个箭头,最后不同的文本代替“text3”,并将它们全部放置在弧线沿线和纸张的南侧。任何帮助都将不胜感激。

答案1

您的问题不太清楚(请参阅我在问题下方的评论)。到目前为止,我猜您是在寻找这样的答案:

在此处输入图片描述

\documentclass[border=3.141592mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                bending,
                decorations.markings, decorations.text}

\newlength{\R}\setlength{\R}{2cm}

\begin{document}
\begin{tikzpicture}[
  C/.style = {circle, draw, 
              double,double distance=1mm, % <--- ??
              minimum size=#1, align=center},
decoration = {text effects along path, reverse path,
              text={\i},
              text align=center,
              raise=3pt,
             },
dot/.style = {circle, fill, minimum size =1mm,
              label=#1, node contents={}},
->-/.style = {decoration={markings,
              mark=at position 0.8 with {\arrow{Stealth[angle=60:5pt 3]}},
              raise=0pt},
              postaction={decorate}},
                    ]
\foreach \i/\sa/\ea [count=\j] in {{}/170/90, alpha/10/90, beta/-43/10, gamma/170/317}
{
\path   [thin, draw=blue, text=orange,    % <--- new
         postaction={decorate},           % <--- changed
         text effects={text along path}]  % <--- new
        (\sa:\R) arc (\sa:\ea:\R);
}
\path   [->-]  
        (170:\R) arc (170:317:\R);
\path   ( 90:\R) node[dot={$\tau=0$} fm]
        ( 10:\R) node[dot=right:$\tau \sim 0.6$ fm]
        (-43:\R) node[dot=right:$\tau \sim 1$ fm]
        (170:\R) node[dot= left:$\tau \sim 2$ fm];
% circle in center
\node[C=21mm]   {where\\should I\\be???};
\end{tikzpicture}
\end{document}

答案2

如果我正确理解了您的问题,您不希望打印两个箭头,而希望更改文本。要做到这一点,如果我正确理解了您的问题,您只需要修改宏 \Item,使其第一个参数 #1(我不理解其用途)成为放置文本的参数。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usepackage{etoolbox}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{bending}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{center}

\begin{tikzpicture}[scale=5.3,cap=round,>=latex]
\def\Radius{.5cm}

\draw (0cm,0cm) circle[radius=\Radius];

\begin{scope}[%tips=proper,
    -{Stealth[round, length=8pt, width=8pt, bend]},
    shorten >=4pt,
    very thin,
  ]
    \draw (\Radius, 0) arc(-3:3:\Radius) (-\Radius, 0) arc(180+3:180-3:\Radius);%<- one path only give only one arrow
  \end{scope}

  % draw the points 
  \fill[radius=.7pt]
    (90:\Radius) circle[] node[above left] {$\tau =$ 0 fm}
    (10:\Radius) circle[] node[above right] {$\tau \sim$ 0.6 fm}
    (-43:\Radius) circle[] node[below right] {$\tau \sim$ 1 fm}
    (170:\Radius) circle[] node[below left] {$\tau \sim$ 2 fm}
  ;

  \def\Item#1#2(#3:#4){%
    \path[
      decoration={
        text along path,
        text={#1},%<- make the text the first paramater of your macro
%        text={text2},
%        text={text3},
        text align=center,
      },
      decorate,
    ]
      (#3:\Radius-#2) arc(#3:#4:\Radius-#2)
    ;
  }
  \Item {text 1} 1pt (90:10)
  \Item {text 2} 1pt (10:-43)
  \Item {text3} 1pt (-43:-170)
  %\Item D 2pt (60:0)
\end{tikzpicture}
    
\end{center}
\end{document}

相关内容