In interrupting edge in automata, a simple way to interrupt an edge is given. It is simple and helpful, iff the background happens to be white (or at least a determined single color). Is there a way to achieve this effect when the background is a gradient/indeterminate?
Asked
Active
Viewed 90 times
2
1 Answers
2
This is a task for the reverse clip trick, see e.g. here for a very similar application.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{automata, arrows}
\begin{document}
\begin{figure}[htb]
\centering
\begin{tikzpicture}[->,>=stealth', node distance=3.6cm]
\shade[left color=red,right color=blue,middle color=magenta,shading angle=30]
(-1,-1) rectangle (4,4);
\node[state] (1) {1};
\node[state] (0) [above right of=1] {2};
\path (0) to[bend left] node[midway](C) {01} (1);
\clip (C.north east) rectangle (C.south west)
(current bounding box.south west) -| (current bounding box.north east)
-| cycle;
\draw (0) to[bend left] (1);
\end{tikzpicture}
\end{figure}
\end{document}
You can also make this a style for the node, see this post. (Note, though, that the use path key there differs from the one recently added to TikZ.)Please see here for an experimental library that contains style for this and similar styles.

draw=noneor just\pathto place the node, you can then draw to and from the node. However, you might not get as smooth a curve as you'll have two curves in that case. – cfr Oct 09 '19 at 15:04