Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

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.