# how to draw angle line? [duplicate]

Possible Duplicate:
how to draw special line in a picture

I use the code below to draw a picture, however the line is straight from s2 to s4 refer to the image.

However, I want the line like an angle like the red line in the picture.would someone help me how to do it?

\usepackage{tikz}
\usetikzlibrary{trees}
\resizebox{.5\textwidth}{!}{
\tikzset{level 1/.style={level distance=0.7cm, sibling distance=3cm}}
\tikzset{level 2/.style={level distance=0.7cm, sibling distance=6cm}}

\tikzset{bag/.style={text centered,yshift=-0.2cm}}
\begin{tikzpicture}[grow=down, -stealth]
\node[bag]{$S_0{:}(B,true,0)$}
child{ edge from parent node[right]{$\lsInvoke \_ DS$}; \node[bag]{$S_1{:}(R_{good})$}
child{ edge from parent node[right]{and}; \node[bag]{$S_2{:}(and)$}
child[missing]
child{ edge from parent node[right=0.1cm]{$[else]$}; \node[bag]{$S_3{:}(A_1)$}
}
child{ edge from parent node[right=0.9cm]{$[if]$}; \node[bag]{$S_4{:}(R_{good})$}
}
}
};
\end{tikzpicture}}

-

## marked as duplicate by Torbjørn T., Marco Daniel, percusse, lockstep, Tom BombadilAug 24 '12 at 3:03

as a mwe goes, i thought you should know that your code doesn't compile stand alone. it would be nice to add things like the document class you're using and such. –  asia1281 Aug 17 '12 at 17:16
I get errors trying to compile your code. giving up on this path. Did you forget a semicolon? –  JLDiaz Aug 17 '12 at 17:21
You can refer to the manual for edge from parent path option. –  percusse Aug 17 '12 at 17:51
yes, I have referred it, however, i just see how to draw dashed line and so on, But nothing about this kind of line. So would you please help me? –  sweetyBaby Aug 18 '12 at 1:40
@asia1281, sorry for the error code, you I have updated the new codes, please refer to tex.stackexchange.com/questions/67650/… –  sweetyBaby Aug 18 '12 at 2:02

i can't compile your code, and don't have any experience with trees, which appears to draw the path for you. this should demonstrate the concept i think you're looking for though:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (5,-1);
\draw (A) -- (B);
\draw[thick,dashed,red,->] (A) -| (B);
\end{tikzpicture}
\end{document}


which produces:

the most important part for you here is the use of -| instead of -- to create the path in a rectilinear coordinate system instead of the standard one. when used with draw, instead of drawing a straight line, this draws the components of that line.

perhaps you can just create named coordinates at S_2 and S_4 and overlay the rectilinear path over it?

-
unless, of course, you want the rectilinear line INSTEAD of the straight line...in which case i can't really help without a valid mwe. –  asia1281 Aug 17 '12 at 17:40