7

I have the following automata in tikz.

\documentclass{article}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{automata, arrows}

\begin{document}

\begin{figure}[htb]
  \centering
  \begin{tikzpicture}[->,>=stealth', node distance=3.6cm]
    \node[state] (1) {1};
    \node[state] (0) [above right of=1] {2};

    \path (0) edge[bend left] node {01} (1);


  \end{tikzpicture}
\end{figure}

\end{document}

I would like to ``interrupt'' the edge where the label is present. I know it is possible to put the edge label beside the edge but this is not exactly what I need.

0

1 Answer 1

8

A way of doing this is to simply fill the node with white, which will cover the line:

\path (0) edge[bend left] node[fill=white] {01} (1);

(This doesn't actually create a gap in the line though, so it only works fine when the background actually is white.)

enter image description here

Complete code:

\documentclass{article}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{automata, arrows}

\begin{document}

\begin{figure}[htb]
  \centering
  \begin{tikzpicture}[->,>=stealth', node distance=3.6cm]
    \node[state] (1) {1};
    \node[state] (0) [above right of=1] {2};

    \path (0) edge[bend left] node[fill=white] {01} (1);


  \end{tikzpicture}
\end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .