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 a feeling this should be simple, but I can't find how to do it. I'm trying to draw an arrow looping around the corner of a node in a state diagram. I have the following, but as you see it cuts the corner, plus ideally the arrow would loop from nearer the corner.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[%node distance = 15mm and 300mm,
    node/.style={
        draw,
        rectangle,
        text width=25mm,
        text centered,
        minimum height=20mm
    },  
    arrow/.style={
        very thick,
        ->
    }]

\node[node] (state) {State};

\draw [arrow] (state.south)  to [out=270, in=0]  (state.east);

\end{tikzpicture}
\end{document}

enter image description here

share|improve this question
    
Something like \node [draw] {a} edge [in=-10,out=-55,loop] (); ? –  percusse May 14 '12 at 14:36
add comment

1 Answer 1

up vote 6 down vote accepted

You have several possibilities: you can use the .. controls .. syntax, or the out=<value>,in=<value>,loop options perhaps combined with an appropriate looseness, or (as Jake suggested) you can use and arc to get a proper circle arc:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[%node distance = 15mm and 300mm,
    node/.style={
        draw,
        rectangle,
        text width=25mm,
        text centered,
        minimum height=20mm
    },  
    arrow/.style={
        very thick,
        ->
    }]

\node[node] (state) {State};

\draw[red] [arrow] (state.270) .. controls  (0.5,-3) and (3.5,-1) ..  (state.0);
\draw[blue] (state) edge [out=270,in=0,loop] (state);
\draw[green] (state) edge [out=270,in=0,loop,looseness=4] (state);
\draw [arrow] (state.south east) ++(-0.75cm,0pt) arc [start angle=-180, end angle=90, radius=0.75cm];

\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
Great thanks, still new to tikz but I'm starting to see how it all works now... –  Chris May 14 '12 at 15:08
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.