TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.