In TikZ, within the context of automata, I would like to draw a loop without arrow in order to be able to highlight a path in an automaton, as shown by the following example (which highlight a path without any loop). For standard arc (i.e. arcs between two distinct states) I just draw two arcs:

  • first a thick colored arc without any arrow at its end
  • second a standard arc

but this does not work for loops.

\usepackage{tikz} \usetikzlibrary{shapes,arrows,automata,backgrounds,matrix,decorations,trees}



    \begin{tikzpicture}[shorten >=1pt,auto,node distance=18mm,semithick]
      \node[initial,initial text= ,initial distance=10mm,state,fill=MyYellowlight]  (s00)               {$s_{00}$};
      \node[state,fill=MyYellowlight]                               (s11) [right of=s00]    {$s_{11}$};
      \node[state,fill=MyYellowlight]                               (s12) [right of=s11]    {$s_{12}$};
      \node[state,fill=MyYellowlight]                               (s21) [below of=s12]    {$s_{21}$};
      \node[state,fill=MyYellowlight]                               (s31)    [below of=s21] {$s_{31}$};
      \node[accepting,state,fill=MyYellowlight]                     (s41) [below of=s31]    {$s_{41}$};
      \node[accepting,state,fill=MyYellowlight]                     (s51)    [left of=s41]  {$s_{51}$};
      \node[accepting,state,fill=MyYellowlight]                     (s61)    [left of=s51]  {$s_{61}$};
      (s00) edge [line width=4pt,orange!70]             node {$\bf 3$} (s11)      
      (s00) edge [->,>=stealth']                        node {} (s11)      
      (s11) edge [line width=4pt,orange!70]             node {$\bf 3$} (s12)
      (s11) edge [->,>=stealth']                        node {} (s12)
      (s12) edge [->,>=stealth',loop above]             node {$3$} (s12)
      (s12) edge [->,>=stealth']                        node [left] {$4$} (s21)
      (s12) edge [->,>=stealth',bend left]              node [right, very near end] {$5$} (s31)
      (s12.325) edge [line width=4pt,orange!70,bend left]   node {$\bf 6$} (s41)
      (s12.325) edge [->,>=stealth', bend left]         node {} (s41)
      (s21) edge [->,>=stealth']                        node [left] {$5$} (s31)
      (s21) edge [->,>=stealth',bend right]             node [left] {$6$} (s41)
      (s31) edge [->,>=stealth']                        node [left] {$6$} (s41)
      (s41) edge [->,>=stealth',loop right]             node {$6$} (s41)
      (s41) edge [->,>=stealth']                        node [above] {$7$} (s51)
      (s41) edge [line width=4pt,orange!70,bend left]       node {$\bf 8$} (s61)
      (s41) edge [->,>=stealth', bend left]             node {} (s61)
      (s51) edge [->,>=stealth']                        node [above] {$8$} (s61);
\caption{Automaton of the \ctrrefself{increasing\_global\_cardinality} constraint of the {\bf Example} slot: the path corresponding to the solution $\langle {\color{orange!70}\bold{3}},{\color{orange!70}\bold{3}},{\color{orange!70}\bold{6}},{\color{orange!70}\bold{8}}\rangle$ is depicted by thick orange arcs}

1 Answer 1


You can use a separate path to draw the highlight, and change the every loop style for that path to draw a thick coloured line, and then draw the arrow afterwards. I also added some styles for the highlight lines and arrows.

Minimal example:


\begin{tikzpicture}[shorten >=1pt,auto,node distance=18mm,semithick,
 highlight/.style={line width=4pt,orange!70},
   \node[initial,initial text= ,initial distance=10mm,state]  (s00)  {$s_{00}$};
   \node[state] (s11) [right of=s00]    {$s_{11}$};
   \path [every loop/.style={highlight}, % draw highlights
     (s11) edge [loop above]  (s11)
     (s00) edge node {$\mathbf{3}$} (s11);
   \path % draw normal paths
     (s00) edge [MyArrow]            node {} (s11)
     (s11) edge [MyArrow,loop above]  node {$3$} (s11);

enter image description here


Don't use \bf, \it etc. as they are deprecated. use \bfseries, \itshape instead, see Does it matter if I use \textit or \it, \bfseries or \bf, etc. and Will two-letter font style commands (\bf, \it, …) ever be resurrected in LaTeX?. For mathmode however, use \mathbf{...}

  • 1
    @NicolasBeldiceanu if this has resolved the issue, please consider accepting the answer (after a suitable amount of time, perhaps to allow other answers) by clicking on the green check mark. Welcome to the group :)
    – cmhughes
    Oct 22, 2012 at 2:33

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.