2

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?

  • 2
    If you 'draw' the path first with draw=none or just \path to 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 9 at 15:04
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}

enter image description here

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.

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.