Code: Select all
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections,angles,calc}
\newlength{\bridgeTunnelRadius}\setlength{\bridgeTunnelRadius}{.45ex}%%% when drawing two lines over each other that should not cross, we draw a small bridge or tunnel in form of a half-circle. This length provides the radius of the half-circle.
%%% Bridging Bézier curves, cf. http://tex.stackexchange.com/a/581548 :
\makeatletter
\tikzset{bridge/.code args={#1 over #2}{%
\path[name path=tmp@bridge@path@B] #1;
\tikzset{name intersections={of=#2 and tmp@bridge@path@B, by=tmp@i@0,total=\tmp@i@total}}
\ifnum\tmp@i@total=0
\typeout{These paths do not intersect. No bridge, sorry.}%
\else
\path[name path=tmp@bridge@path@C] (tmp@i@0)
circle[radius=\pgfkeysvalueof{/tikz/bridge radius}];
\tikzset{name intersections={of=tmp@bridge@path@B and tmp@bridge@path@C, by={tmp@i@1,tmp@i@2},total=\tmp@i@total}}
\ifnum\tmp@i@total=2
\begin{scope}
\clip (tmp@i@0) circle[radius=\pgfkeysvalueof{/tikz/bridge radius}]
(current bounding box.south west) |-
(current bounding box.north east) |- cycle;
\draw[bridge-style] #1;
\end{scope}
\path let \p1=($(tmp@i@1)-(tmp@i@2)$),\n1={scalar(int(sign(\x1)))} in
\ifnum\n1=-1
pic [draw,line cap=round, angle radius=\pgfkeysvalueof{/tikz/bridge radius}, bridge-arc] {angle=tmp@i@2--tmp@i@0--tmp@i@1}
\else
pic [draw,line cap=round, angle radius=\pgfkeysvalueof{/tikz/bridge radius}, bridge-arc] {angle=tmp@i@1--tmp@i@0--tmp@i@2}
\fi;
\else
\typeout{Given the bridge radius \pgfkeysvalueof{/tikz/bridge radius},
the path is not suited to construct a nice bridge. No bridge, sorry.}%
\fi
\fi
},bridge radius/.initial=\bridgeTunnelRadius,
bridge style/.code={\tikzset{bridge-style/.style={#1}}},
bridge arc/.code={\tikzset{bridge-arc/.style={#1}}},
bridge style={},bridge arc={}}
\makeatother
\begin{document}
\begin{tikzpicture}
\begin{scope}
\draw[name path=A] (1,0) -- (1,1);
\tikzset{bridge={(3,.5) to node[above,pos=.33333333333333333333333]{\(\mathit{c3}\colon b\)} (0,.5)} over A}
\node at (2,.25) {\(\mathit{c3}\colon b\)};
\end{scope}
\end{tikzpicture}
\end{document}
Crosspost: http://tex.stackexchange.com/questions/587968