在轮廓中绘制箭头

在轮廓中绘制箭头

我在 Latex 中绘制了这个轮廓:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}
\begin{document}
\begin{figure}
\center
\begin{tikzpicture}[scale=0.4]

% Realachse
    \draw[->] (-12,0) -- (12,0) node[right] {$\text{Re}$};
    
    % Imaginärachse
    \draw[->] (0,-12) -- (0,12) node[above] {$\text{Im}$};
    
    % Beschriftungen
    %\node at (2.2,0) {Realachse};
    %\node at (0,2.2) {Imaginärachse};



\newcommand\g{4}
\newcommand\T{10}
\newcommand\e{0.5}
\newcommand\Rp{1}
\newcommand\Ip{2}
\newcommand\ly{(\T-\Ip-\e)}
\coordinate (A) at (\g,\T);
\coordinate (B) at (-\T+\Rp,\Ip+\e);
\coordinate (C) at (\Rp,\Ip+\e);
\coordinate (D) at (\Rp,\Ip-\e);
\coordinate (E) at (-\T+\Rp,\Ip-\e);
\coordinate (F) at (\g,-\T);

\tikzset
  {decoration=
     {markings,
      mark=at position 0.5 with {\arrow{stealth}}
     },
   plain/.style={line width=0.8pt},
   arrow/.style={plain,postaction=decorate}
  }


\draw (A) -- (F) ;
\draw (B) -- (C);
\draw (D) -- (E);
\draw (\Rp,\Ip+\e) arc (90:-90:\e);
\draw (\g,\T) arc(90:180:\T cm+\Rp cm +\g cm - 2 cm and \T cm - \Ip cm -\e cm);
\draw (\g,-\T) arc(-90:-180:\T cm +\Rp cm +\g cm - 2 cm and \T cm + \Ip cm -\e cm);

\node at (\Rp cm - 5 cm,\Ip cm + 1.1 cm ) {$H^+$};
\node at (\Rp cm - 5 cm,\Ip cm - 1.1 cm ) {$H^-$};
\node at (\Rp cm + 1.3 cm,\Ip  cm ) {$\Omega_1$};
\node at (\Rp cm - 6 cm,\T  cm - 1 cm) {$\Gamma^+$};
\node at (\Rp cm - 6 cm,-\T  cm + 2 cm) {$\Gamma^-$};
\node at (\g cm + 1.5 cm,\T cm ) {$\gamma+iT$};
\node at (\g cm + 1.5 cm,-\T cm ) {$\gamma-iT$};


\end{tikzpicture}
\end{figure}
\end{document}

它运行得很好。然而,

我想在每个 H^+ 和 H^- 线的中间添加箭头 (1) (2) 在椭圆 Gamma+ 和 Gamma- 的中间添加箭头 (3) 并在从 gamma-iT 到 gamma+iT 的右线上添加两个箭头(这样该线通过箭头被三等分。)

箭头的方向也很重要,它们应该是正向的 - 这意味着轮廓的内部应该位于路径方向的左侧。


通过以下不同的轮廓,我以某种方式设法绘制出我想要的箭头,如下所示:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}
\begin{document}
\begin{figure}
    \centering
\begin{tikzpicture}[scale=0.6]
% Realachse
    \draw[->] (-6,0) -- (6,0) node[right] {$\text{Re}$};
    
    % Imaginärachse
    \draw[->] (0,-2) -- (0,4) node[above] {$\text{Im}$};
    
    % Beschriftungen
    %\node at (2.2,0) {Realachse};
    %\node at (0,2.2) {Imaginärachse};

\tikzset
  {decoration=
     {markings,
      mark=at position 0.5 with {\arrow{stealth}}
     },
   plain/.style={line width=0.8pt},
   arrow/.style={plain,postaction=decorate}
  }


\newcommand\g{2}
\newcommand\T{6}
\newcommand\e{0.5}
\newcommand\Rp{1}
\newcommand\Ip{2}
\newcommand\ly{(\T-\Ip-\e)}
\coordinate (A) at (\g,\T);
\coordinate (B) at (-\T+\Rp,\Ip+\e);
\coordinate (C) at (\Rp,\Ip+\e);
\coordinate (D) at (\Rp,\Ip-\e);
\coordinate (E) at (-\T+\Rp,\Ip-\e);
\coordinate (F) at (\g,-\T);
\draw [arrow] (B) -- (C);
\draw [arrow] (D) -- (E);
\draw [line width=0.8pt] (\Rp,\Ip+\e) arc (90:270:\e);
\draw [line width=0.8pt] (-\T+\Rp,\Ip+\e) arc (90:270:\e);

\node at (\Rp cm - 5 cm,\Ip cm + 1.1 cm ) {$H^+$};
\node at (\Rp cm - 5 cm,\Ip cm - 1.1 cm ) {$H^-$};
\node at (\Rp cm - 7.1 cm,\Ip  cm ) {$\Omega_2$};
\node at (\Rp cm + 0.3 cm,\Ip  cm ) {$\Omega_3$};


%\draw  [dash pattern=on 3pt off 2pt] (\Rp,\Ip ) -- (\Rp+4,\Ip );
\end{tikzpicture}
\caption{Die Kontur $\mathcal R$}
\end{figure}
\end{document}

在这种情况下,箭头是负向的,这很好。但是我怎样才能使用我在第二个轮廓中使用的以下箭头制作命令

\tikzset
      {decoration=
         {markings,
          mark=at position 0.5 with {\arrow{stealth}}
         },
       plain/.style={line width=0.8pt},
       arrow/.style={plain,postaction=decorate}
      }

并将其应用于我的第一个轮廓?我的困难是(1)箭头的方向(2)箭头也在椭圆的中间,而不仅仅是直线(3)以及如何在一条直线上制作两个箭头(在本例中从 gamma-iT 到 gamma+iT)。

我在网上搜索了很多,但如果我找到了一个解决方案,就意味着我必须牺牲另一个解决方案。(例如,当我找到方向时,箭头不再居中。)

在此处输入图片描述

答案1

编辑您的问题之后,尽管它仍然不可编译,但还是更清楚一点,您的问题是什么。

要添加箭头,您需要添加到所有段选项的绘图命令中postaction={decorate}

我怀疑,您认为所有箭头的方向都应相同(逆时针?)。我说得对吗?如果是,您需要重写红色部分的绘制命令,因为首先我已经更改了绘制方向:

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings}
\usepackage{amsmath}    % missed in your MWE

\begin{document}
\begin{tikzpicture}[scale=0.4]

% Realachse
    \draw[->] (-12,0) -- (12,0) node[right] {$\text{Re}$};
% Imaginärachse
    \draw[->] (0,-12) -- (0,12) node[above] {$\text{Im}$};

\newcommand\g{4}
\newcommand\T{10}
\newcommand\e{0.5}
\newcommand\Rp{1}
\newcommand\Ip{2}
\newcommand\ly{(\T-\Ip-\e)}
\coordinate (A) at (\g,\T);
\coordinate (B) at (-\T+\Rp,\Ip+\e);
\coordinate (C) at (\Rp,\Ip+\e);
\coordinate (D) at (\Rp,\Ip-\e);
\coordinate (E) at (-\T+\Rp,\Ip-\e);
\coordinate (F) at (\g,-\T);

\tikzset
  {decoration=
     {markings,
      mark=at position 0.5 with {\arrow{stealth}}
     },
   plain/.style={line width=0.8pt},
   arrow/.style={plain,postaction=decorate}
  }


\draw[postaction={decorate}] (F) -- (A) ;
\draw[postaction={decorate}] (B) -- (C);
\draw[postaction={decorate}] (D) -- (E);
\draw[postaction={decorate}] (\Rp,\Ip+\e) arc (90:-90:\e);
\draw[postaction={decorate}] (\g,\T) arc(90:180:\T cm+\Rp cm +\g cm - 2 cm and \T cm - \Ip cm -\e cm);
\draw[postaction={decorate}, red] (\g,-\T) arc(-90:-180:\T cm +\Rp cm +\g cm - 2 cm and \T cm + \Ip cm -\e cm);

\node at (\Rp cm - 5 cm,\Ip cm + 1.1 cm ) {$H^+$};
\node at (\Rp cm - 5 cm,\Ip cm - 1.1 cm ) {$H^-$};
\node at (\Rp cm + 1.3 cm,\Ip  cm ) {$\Omega_1$};
\node at (\Rp cm - 6 cm,\T  cm - 1 cm) {$\Gamma^+$};
\node at (\Rp cm - 6 cm,-\T  cm + 2 cm) {$\Gamma^-$};
\node at (\g cm + 1.5 cm,\T cm ) {$\gamma+iT$};
\node at (\g cm + 1.5 cm,-\T cm ) {$\gamma-iT$};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

这就是你要找的吗?

顺便说一句,你似乎喜欢画出排除函数极点的积分图。复数极点总是以共轭复数对的形式出现……

附录:
经过多次评论和添加图像来确定期望目标后,主要问题似乎是如何绘制(集成)路径。

下面的 MWE 是从头开始编写的,希望足够清晰,代码不需要额外的注释。坐标确定为半径为 90 毫米的圆上的点(可以更改),然后按正确的顺序从坐标 A 沿逆时针方向绘制线条回到节点 A:

让我强调一下,代码现在更短而且更清晰了:

\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,
                ext.arrows
                }
\usepackage{mathtools}    % missed in your MWE
\DeclareMathOperator{\im}{Im}
\DeclareMathOperator{\re}{Re}


\begin{document}
\begin{tikzpicture}[scale=0.4,
arr/.style = {-Straight Barb},
->-/.style = {decoration = {markings,
                mark=at position 0.5 with {\arrow{Centered Stealth}}},
              postaction=decorate, semithick, color=red,
              line cap=round,
              },
lbl/.style = {auto=right, text=black, midway}
                    ]
% axis
\draw[->] (-10,0) -- (9,0) node[right] {$\re$};
\draw[->] (0,-10) -- (0,10) node[above] {$\im$};

% coordinates, determines by polar coordinates on circle
\path   (0,0) -- (4.5,0) coordinate (A);
\path   (0,0) -- ( 60:9) coordinate[label=right:$\gamma + iT$] (B)
              -- (162:9) coordinate (C)
              -- (170:9) coordinate (D)
              -- (300:9) coordinate[label=right:$\gamma - iT$] (E);
\draw[->-] (A) -- (B);
\draw[->-] (B) arc (60:162:9) node[lbl] {$\Gamma^+$};
\draw[->-] (C) -- ++ (10,0)   node[lbl,swap] {$H^-$}
                            coordinate (c);
%
\draw[->-] (c) arc (90:-90:6.1mm) node[lbl, swap] {$\Omega_1$};
%
\draw[->-] (c |- D) -- (D)    node[lbl,swap] {$H^-$};
\draw[->-] (D) arc (170:300:9) node[lbl] {$\Gamma^-$};
\draw[->-] (E) -- (A);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容