装饰节点没有被放置在它们应该所在的圆上

装饰节点没有被放置在它们应该所在的圆上

我“放置”了一些节点在圆形路径上,但它们没有出现在正确的位置,甚至不在圆圈上。

出了什么问题?

在此处输入图片描述

\begin{document}

\usepackage{tikz, pgfplots}

\usetikzlibrary{arrows, decorations.markings, calc, fadings,  decorations.pathreplacing, patterns,decorations.pathmorphing, positioning}

\begin{document}
\begin{center}
   \begin{tikzpicture}[line join = round, line cap = round, >=triangle 45]
     \filldraw[blue, opacity = .3] (0,0) circle (2cm);
     \draw[dashed] (-4,0) -- (5,0);
     \begin{scope}[decoration = {markings, mark = at position 0.25 with {\arrow{>}},
       mark = at position 0.75 with {\arrow{>}},
       mark = at position 0.2 with {\node[draw, circle, inner sep = .05cm, fill = white
       , scale = .75] {1};}, }]
       \draw[postaction = decorate] (0,0) circle (2.5cm);
       \filldraw[black] (2.5,0) circle (.05cm);
       \node[scale = .75] at (2.7,.2) {$A$};
     \end{scope}
     \begin{scope}[decoration = {markings, mark = at position 0.25 with {\arrow{>}},
       mark = at position 0.75 with {\arrow{>}},
       mark = at position 0.2 with {\node[draw, circle, fill = white, inner sep = .05cm, scale = .75]
       {2};},
       mark = at position 0.35 with {\filldraw[black] circle (.05cm);}, } ]
       \draw[postaction = decorate] (0,0) circle (3.75cm);
     \end{scope}
       \filldraw[black] (3.75,0) circle (.05cm);
       \node[scale = .75] at (3.95,.2) {$B$};
       \filldraw[black] (-3.75,0) circle (.05cm);
       \node[scale = .75] at (-3.95,.2) {$C$};
   \end{tikzpicture}
 \end{center}
 \end{document}

答案1

多次使用该mark选项时,应给出位置上升命令:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, decorations.markings, calc, fadings,  decorations.pathreplacing, patterns,decorations.pathmorphing, positioning}

\begin{document}
\begin{center}
   \begin{tikzpicture}[line join = round, line cap = round, >=triangle 45]
     \filldraw[blue, opacity = .3] (0,0) circle (2cm);
     \draw[dashed] (-4,0) -- (5,0);
     \begin{scope}[decoration = {markings, 
       mark = at position 0.2 with {\node[draw, circle, inner sep = .05cm, fill = white,   scale = .75] {1};},
       mark = at position 0.25 with {\arrow{>}},
       mark = at position 0.75 with {\arrow{>}}
      }]
       \draw[postaction = decorate] (0,0) circle (2.5cm);
       \filldraw[black] (2.5,0) circle (.05cm);
       \node[scale = .75] at (2.7,.2) {$A$};
     \end{scope}
     \begin{scope}[decoration = {markings, 
       mark = at position 0.2 with {\node[draw, circle, fill = white, inner sep = .05cm, scale = .75] {2};},
       mark = at position 0.25 with {\arrow{>}},
       mark = at position 0.35 with {\filldraw[black] circle (.05cm);}, 
       mark = at position 0.75 with {\arrow{>}}
       }]
       \draw[postaction = decorate] (0,0) circle (3.75cm);
     \end{scope}
       \filldraw[black] (3.75,0) circle (.05cm);
       \node[scale = .75] at (3.95,.2) {$B$};
       \filldraw[black] (-3.75,0) circle (.05cm);
       \node[scale = .75] at (-3.95,.2) {$C$};
   \end{tikzpicture}
 \end{center}
 \end{document}

在此处输入图片描述

直接引用自章节30.5 任意标记(第 328 页)pgfmanual

可以多次提供标记选项,这样会应用多个标记。但是,在这种情况下,路径上的位置必须按递增顺序排列。也就是说,不允许(并且会导致混乱)路径上较早的标记跟在路径上较晚的标记后面。

相关内容