5

Consider the following code:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows.meta,shapes.misc,decorations.pathmorphing,calc}

% http://tex.stackexchange.com/questions/123760/draw-crosses-in-tikz
\tikzset{
  branch point/.style={cross out,draw=black,fill=none,minimum size=2*(#1-\pgflinewidth),inner sep=0pt,outer sep=0pt}, 
  branch point/.default=5
}
\tikzset{
  branch cut/.style={
    decorate,decoration=snake,
    to path={
      (\tikztostart) -- (\tikztotarget) \tikztonodes
    },
    execute at begin to={{
      \draw[thick,green!60!black,-{Stealth[]}] ($(\tikztostart)!.8!-10:(\tikztotarget)$) -- ($(\tikztostart)!.8!10:(\tikztotarget)$) node[scale=.8,pos=.7,above left] {$\times (-1)$};
    }}
  }
}

\begin{document}
\begin{tikzpicture}[x=90pt,y=90pt]
\begin{scope}[shift={(2,0)}]
  % Axes
  \draw[thin,gray,->] (-1,0) -- (1,0) node[right] {$x$};
  \draw[thin,gray,->] (0,-1) -- (0,1) node[above] {$y$};
  % Branch point
  \draw[thick] (0,0) node[branch point,draw=red,thick] {};
  % Branch cut
  \draw[thick,red,branch cut] (0,0) to (140:1.2);
\end{scope}
\end{tikzpicture}
\end{document}

Here is its output.

Output of the code above

I want to bend the green arrow like this:

What I really want

I have attempted the following, without success:

  • Replacing the -- in the execute at begin to block with edge [bend right] results in a TeX capacity exceeded, sorry [grouping levels=255] error.
  • to [bend right] results in the same error.
  • Adding the bend right option to the \draw command does nothing.

How can I do this?

7

You could use control points:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows.meta,shapes.misc,decorations.pathmorphing,calc,bending}

% http://tex.stackexchange.com/questions/123760/draw-crosses-in-tikz
\tikzset{
  branch point/.style={cross out,draw=black,fill=none,minimum size=2*(#1-\pgflinewidth),inner sep=0pt,outer sep=0pt}, 
  branch point/.default=5
}
\tikzset{
  branch cut/.style={
    decorate,decoration=snake,
    to path={
      (\tikztostart) -- (\tikztotarget) \tikztonodes
    },
    execute at begin to={{\draw[thick,green!60!black,-{Stealth[]}] ($(\tikztostart)!.8!-10:(\tikztotarget)$) .. controls +(-20pt,5pt) and +(-5pt,2pt) .. ($(\tikztostart)!.8!10:(\tikztotarget)$) node[scale=.8,pos=.7,above left] {$\times (-1)$};
    }}
  }
}

\begin{document}
\begin{tikzpicture}[x=90pt,y=90pt]
\begin{scope}[shift={(2,0)}]
  % Axes
  \draw[thin,gray,->] (-1,0) -- (1,0) node[right] {$x$};
  \draw[thin,gray,->] (0,-1) -- (0,1) node[above] {$y$};
  % Branch point
  \draw[thick] (0,0) node[branch point,draw=red,thick] {};
  % Branch cut
  \draw[thick,red,branch cut] (0,0) to (140:1.2);
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
  • Great suggestion! The hard-coded control points do not work well when I rotate the branch cut (the red snake line), so I've cooked up some calculation to get them just right. See my answer below. – Alberto Garcia-Raboso Nov 4 '15 at 19:09
  • @AlbertoGarcia-Raboso Nice! – Gonzalo Medina Nov 4 '15 at 23:50
3

Following Gonzalo Medina's suggestion of using a Bézier curve, I modified my code to get the arrow in the shape of a parabola and with an angle of 30 degrees between the arrow and the line joining the two endpoints (I don't know about the parabola, but that 30 degree angle is what bend right is supposed to do).

The advantage is that I can now draw branch cuts (the red snake lines) in other angles — the hard-coding of the control points in his answer does not give the expected effect at those other angles.

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows.meta,shapes.misc,decorations.pathmorphing,calc,bending}

\tikzset{
  branch point/.style={cross out,draw=black,fill=none,minimum size=2*(#1-\pgflinewidth),inner sep=0pt,outer sep=0pt}, 
  branch point/.default=5
}
\tikzset{
  branch cut/.style={
    decorate,decoration=snake,
    to path={
      (\tikztostart) -- (\tikztotarget) \tikztonodes
    },
    execute at begin to={{
      \coordinate (A) at ($(\tikztostart)!.8!-10:(\tikztotarget)$);
      \coordinate (B) at ($(\tikztostart)!.8!10:(\tikztotarget)$);
      \coordinate (AB/3) at ($(A)!1/3!(B)$);
      \coordinate (2AB/3) at ($(A)!2/3!(B)$);
      \coordinate (C) at ($(AB/3)!2/(3*sqrt(3))!-90:(B)$);
      \coordinate (D) at ($(2AB/3)!4/(3*sqrt(3))!-90:(B)$);
      \draw[thick,green!60!black,-{Stealth[]}] (A) .. controls (C) and (D) .. (B) node[scale=.8,pos=.9,above left] {$\times (-1)$};
    }}
  }
}

\begin{document}
\begin{tikzpicture}[x=90pt,y=90pt]
\begin{scope}[shift={(2,0)}]
  % Axes
  \draw[thin,gray,->] (-1,0) -- (1,0) node[right] {$x$};
  \draw[thin,gray,->] (0,-1) -- (0,1) node[above] {$y$};
  % Branch point
  \draw[thick] (0,0) node[branch point,draw=red,thick] {};
  % Branch cut
  \draw[thick,red,branch cut] (0,0) to (20:1.2);
  \draw[thick,red,branch cut] (0,0) to (140:1.2);
  \draw[thick,red,branch cut] (0,0) to (-90:1);
\end{scope}
\end{tikzpicture}
\end{document}

Several branch cuts!

Now I'll play with pgfkeys to be able to adjust some parameters (like the position of the label).

| improve this answer | |
1

I would draw this picture far more simply. Probably because I don't know or not be able to figured out story behind it ... Of course, it is hard coded:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{arrows.meta,bending,calc,decorations.pathmorphing,shapes.misc}

\begin{document}
    \begin{tikzpicture}[
    x=90pt, y=90pt,
    decoration = snake
                        ]
% Axes
\path[draw=gray,->]    
    (-1,0) edge node[pos=1,right] {$x$} (1,0)
    (0,-1)  --  (0,1) node[above] {$y$};
% first wave + cross
\draw[red,thick,decorate] (140:1.2) -- (0,0) 
        node[draw,minimum size=1pt,cross out] {};
% arc
\draw[draw=teal,thick,-{Stealth[flex]}] (130:0.9) arc (130:150:0.9) 
        node[above left,inner sep=1pt] {$x(-1)$};
% second wave
\draw[red,thick,decorate] (30:1.2) -- (0,0);
% arc
\draw[draw=teal,thick,-{Stealth[flex]}] (20:0.9) arc (20:40:0.9)
        node[above right,inner sep=1pt] {$x(-1)$};
    \end{tikzpicture}
\end{document}

which gives:

enter image description here

| improve this answer | |
  • I have to draw quite a few of these, so I wanted a way to automatize things. I did something very similar to what you write to draw the second diagram in the original post. – Alberto Garcia-Raboso Nov 5 '15 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.