4

I want to have a state-node with a loop, where the arrow tip is customized (here with -triangle 60). How do change the arrow tip a loop uses?

Heres a short example. I expect the loop to have the same arrow tip as the edge from start to end.

\documentclass[a4paper,abstracton,11pt]{scrreprt}
\usepackage{tikz}
\usetikzlibrary{automata}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\node (loop-node) at (0,0) {node};
\node (path-start) at (2,0) {start};
\node (path-end) at (2,2) {goal};
\path
(path-start) edge [-triangle 60] node {path} (path-end)
(loop-node) edge [loop above, -triangle 60] node {edge} ();
\end{tikzpicture}
\end{document}

Now I would like to understand why its not working as I expect, and how I can change the arrow tip for loops.

I also tried to change the style of the loop with loop/.append style{-triangle 60}, with and without \tikzset, but that seemed to be a dead end.

  • Oh, and Welcome to TeX.SX! – Torbjørn T. Sep 1 '11 at 15:03
4

I have no idea why your example doesn't work, but specifying the arrow tip with ->, >=triangle 60 instead works for me.

\documentclass[a4paper,abstracton,11pt]{scrreprt}
\usepackage{tikz}
\usetikzlibrary{automata}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\node (loop-node) at (0,0) {node};
\node (path-start) at (2,0) {start};
\node (path-end) at (2,2) {goal};
\path (path-start) edge [-triangle 60] node {path} (path-end)
(loop-node) edge [loop above,->, >=triangle 60] node {edge} ();
\end{tikzpicture}
\end{document}
  • The "correct" way would be to use every loop/.append style={-triangle 60}, as loop above is a shorthand for [above,out=105,in=75,loop], with loop introducing a to path that uses the every loop style. Your way is much more pragmatic, though, and works just as well in this case (some things, like shorten < do not). – Jake Sep 1 '11 at 15:24

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.