# How to draw a bent line with switch

This is somehow disappointing that latex doesn't have any simple remedy for this!

I want to draw an arrow between two points where there exists a switch in the middle of this arrow. For this I used this code:

\draw [line width=1pt,addarrow] (0,0) to[cspst] (3,0);


This is almost okay but the switch in the middle is not very stylish. Is there any way to make it better?

And when I want to bend this line as follow:

\draw [line width=1pt,addarrow] (0,-2) to[cspst,out=120,in=-20] (3,-2);


it causes the switch to disappear. Any solution?

This is an image for the results of the first and second code:

My code:

\documentclass[12pt]{report}

\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{tikz-cd}
\usetikzlibrary{arrows,decorations.markings,decorations}
\usetikzlibrary{arrows,shapes,calc,positioning}
\tikzstyle{block} = [draw,rectangle, rounded corners, minimum width=1cm, minimum height=0.8cm,text centered, line width=2pt ]
\tikzstyle{arrow} = [thick,->,>=stealth,line width=2pt]
addarrow/.style={decoration={markings, mark=at position 1 with {\arrow{stealth}}},
postaction={decorate}}
}

\begin{document}
\begin{figure}
\begin{tikzpicture}
\draw [line width=1pt,addarrow] (0,0) to[cspst] (3,0);
\draw [line width=1pt,addarrow] (0,-2) to[cspst,out=-20,in=-120] (3,-2);
\end{tikzpicture}
\end{figure}
\end{document}

• You've forgotten to include a class. – cfr Oct 20 '16 at 2:05
• How is addarrow defined? Please test code before posting it! – cfr Oct 20 '16 at 2:06
• @cfr Sorry. Thanks for your comment. I edited the question. – m0_as Oct 20 '16 at 2:20

\documentclass[12pt]{report}
\usepackage{tikz}
\usepackage{circuitikz}
\usepackage{tikz-cd}
\usetikzlibrary{arrows,decorations.markings,decorations}
\usetikzlibrary{arrows,shapes,calc,positioning}
\tikzstyle{block} = [draw,rectangle, rounded corners, minimum width=1cm, minimum height=0.8cm,text centered, line width=2pt ]
\tikzstyle{arrow} = [thick,->,>=stealth,line width=2pt]
\tikzset{addarrow/.style={decoration={markings, mark=at position 1 with {\arrow{stealth}}}, postaction={decorate}} }
\begin{document}
\begin{figure}
\begin{tikzpicture}
\draw [line width=1pt,addarrow] (0,0) to[cspst] (3,0);
\draw [line width=1pt,addarrow] (0,-2)  to[out=-20,in=-120] coordinate[pos=.35] (A) coordinate[pos=.55] (B) (3,-2) ;
\fill[white] ( [yshift=-2mm] A) rectangle ( [yshift=1mm] B);
\draw [line width=1pt] (A) to[cspst] (B);
\end{tikzpicture}
\end{figure}
\end{document}


• Thanks, but the arrow is not there yet. It is a line. – m0_as Oct 20 '16 at 16:28
• This works: \draw [line width=1pt,addarrow] (0,0) to[cspst] (3,0); \draw [->,>=stealth,line width=1pt] (0,-2) to[out=-20,in=-120] coordinate[pos=.30] (A) coordinate[pos=.40] (B) (3,-2) ; \fill[white] ( [yshift=-2mm] A) rectangle ( [yshift=1mm] B); \draw [line width=1pt] (A) to[cspst] (B); – m0_as Oct 21 '16 at 18:51