为不同的自行车道设置不同的箭头位置

为不同的自行车道设置不同的箭头位置

如何为不同的闭合路径(即小圆和半圆)设置不同的箭头位置?

我在环境的开始处添加了箭头设置,显然它适用于所有路径。

\begin{tikzpicture}[>={Latex[length=0.15cm, bend]},
    decoration={markings,
    mark= at position .2 with {\arrow{>}},
    mark= at position .8 with {\arrow{>}},
    }]
\def\bigradius{1.3}


% contour
\filldraw[postaction = {decorate}, thick ,fill=gray!20] 
    (-\bigradius, 0) node[yshift=-8pt]{$R$}  arc (180:0:\bigradius) node[yshift=-8pt]{$-R$} --
    (\bigradius, 0) -- cycle;
\filldraw[postaction = {decorate}, thick, fill=white]
    (0, 0.6) circle (3.8mm);

% axes
\draw[-Latex] (-1.5*\bigradius,0) -- (1.5*\bigradius,0) node[below]{$\Re$} ;
\draw[-Latex] (0,-0.2*\bigradius) -- (0,1.4*\bigradius) node[right]{$\Im$};
\end{tikzpicture}

在此处输入图片描述

答案1

您可以定义一个以箭头位置为参数的样式,然后使用/.list键处理程序来添加多个箭头。我利用这个机会安装了沿路径弯曲的箭头。

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\re}{Re}
\DeclareMathOperator{\im}{Im}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,bending,calc, decorations.markings,hobby}
\begin{document}
\begin{tikzpicture}[>={Stealth[length=0.3cm,bend]},
    % stolen from https://tex.stackexchange.com/a/676562/292811
    bent arrow at/.style={decoration={markings,
        mark=at position {#1*\pgfdecoratedpathlength-0.15cm} with {\coordinate (bent arrow 1);},
        mark=at position {#1*\pgfdecoratedpathlength-0.05cm} with {\coordinate (bent arrow 2);},
        mark=at position {#1*\pgfdecoratedpathlength+0.05cm} with {\coordinate (bent arrow 3);},
        mark=at position {#1*\pgfdecoratedpathlength+0.15cm} with {\coordinate (bent arrow 4);
        \draw[-{Stealth[length=0.3cm,bend]}] (bent arrow 1) to[curve through={(bent arrow 2) .. (bent arrow 3)}]  (bent arrow 4) ;}
    }}]
    \def\bigradius{1.3}
    % contour
    \filldraw[bent arrow at/.list={.15,.4,.7},postaction = {decorate}, thick ,fill=gray!20] 
        (-\bigradius, 0) node[yshift=-8pt]{$R$}  arc (180:0:\bigradius) node[yshift=-8pt]{$-R$} --
        (\bigradius, 0) -- cycle;
    \filldraw[bent arrow at/.list={.5},postaction = {decorate}, thick, fill=white]
        (0, 0.6) circle (3.8mm);
    
    % axes
    \draw[-Latex] (-1.5*\bigradius,0) -- (1.5*\bigradius,0) node[below]{$\re z$} ;
    \draw[-Latex] (0,-0.2*\bigradius) -- (0,1.4*\bigradius) node[right]{$\im z$};
\end{tikzpicture}
\end{document}  

在此处输入图片描述

相关内容