OK, it may seem stupid, but I often have tikz nodes inside a tikz environment inside a tikz node.  When the outer node has parameter minimum width set to non zero, it appears the inner node inherits this setting:  \documentclass{article}  \usepackage{tikz}  \begin{document} \tikzset{m/.style={draw, minimum width=2cm}}  \tikz\node[m]{(\tikz\node[fill=yellow]{Hello};]};  \tikz\node[m]{(\tikz\node[fill=blue, minimum width=0]{Hello};]}; \end{document}   While I know that color of the outer node is applied to the inner node, this does not fall under the qualification of "inheritance". Other common settings (fill, draw, text, inner sep, outer sep) don't seem to be inherited either.  Is this documented? Are there other settings behaving the same way? Is it avoidable without force-setting minimum width for the inner nodes?  Context  To give my question some substance, I define a command \textnode that transforms any text into a tikz node, allowing for easy highlighting, overlaying, etc.
52513
Sometimes, nesting tikzpicture environments seems inevitable, e.g., if you want a node to contain a TikZ picture on its own. () However, nesting tikzpicture environments is , also because the inner environment  from the surrounding tikzpicture environment.  In a comment to a , Martin Scharrer has suggested that     a command [that resets all TikZ/PGF attributes] would be very difficult to maintain, because all TikZ attributes would need to be set with it explicitly.   Is there a way, with the current implementation, to save/restore all of TikZ/PGF's internal state, in order to apply it to a nested tikzpicture environment? If not, what would be really necessary to implement a "clean start with default values" for nested tikzpicture environments? Any thoughts?
38679
How do I make partially shaded nodes with tikz without hardcoding coordinates?  A plain MWE is as follows:  \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[mynode/.style={circle,draw=black,minimum size=10mm}]      \filldraw[fill=gray!25] (-3.5mm,-3.5mm) arc [start angle=225, end angle=405, radius=5mm];     \node at (0,0) [mynode] {\Large $x$};  \end{tikzpicture} \end{document} \end{tikzpicture}   This works, but I had to compute the coordinates of the shaded arc, and is very tedious when I have to work with a large number of nodes. Is there a way to do this automatically?  I have other code that uses , so if the solution can build on top of that it would be even better.
74965
I have drawn the following tree in TikZ. What I don't like about it is   that I have to manually adjust the sibling distance for each level; and the syntax is too cumbersome.   It has been suggested to me by @percusse and @AlanMunn that using tikz-qtree and/or forest may be a more efficient way to produce the same result. But I don't have experience in using either package.   It would be nice if someone can reproduce my example using either of these packages, so that I can have quick example to learn from instead of reading a 150-page manual trying to find an answer.    \documentclass{standalone} \usepackage{tikz} \usepackage{amsmath}  \begin{document}  \tikzset{   % Two node styles for game trees: solid and hollow   solid node/.style={circle,draw,inner sep=1.2,fill=black},   hollow node/.style={circle,draw,inner sep=1.2}, }  % macro for entering payoffs \newcommand\payoff[1]{   $\begin{pmatrix} #1 \end{pmatrix}$ }  \begin{tikzpicture}[font=\footnotesize]   \tikzset{     level 1/.style={level distance=15mm,sibling distance=65mm},     level 2/.style={level distance=15mm,sibling distance=30mm},     level 3/.style={level distance=15mm,sibling distance=15mm},     level 4/.style={level distance=15mm,sibling distance=10mm},   }    \node[hollow node,label=above:{Nature}]{}     child{node[solid node,label=left:{P1}]{}       child{node(l1)[solid node]{}         child{node[solid node,label=below:{\payoff{1\\-1}}]{}edge from parent node[left]{L}}         child{node[solid node,label=below:{\payoff{0\\0}}]{}edge from parent node[right]{R}}         edge from parent node[left]{U}       }       child{node(l2)[solid node]{}         child{node[solid node,label=below:{\payoff{0\\0}}]{}edge from parent node[left]{L}}         child{node[solid node,label=below:{\payoff{2\\-2}}]{}edge from parent node[right]{R}}         edge from parent node[right]{D}       }       edge from parent node[left,xshift=-10]{A}     }     child{node[solid node,label=right:{P1}]{}       child{node(r1)[solid node]{}         child{node[solid node,label=below:{\payoff{-2\\2}}]{}edge from parent node[left]{L}}         child{node[solid node,label=below:{\payoff{0\\0}}]{}edge from parent node[right]{R}}         edge from parent node[left]{U}       }       child{node(r2)[solid node]{}         child{node[solid node,label=below:{\payoff{0\\0}}]{}edge from parent node[left]{L}}         child{node[solid node,label=below:{\payoff{-1\\1}}]{}edge from parent node[right]{R}}         edge from parent node[right]{D}       }       edge from parent node[right,xshift=10]{B}     }   ;    \draw[dashed](l1)--(l2)--node[midway,above]{P2}(r1)--(r2); \end{tikzpicture}  \end{document}
93167
I am looking into using TikZ to represent pitch patterns over a phrase or sentence (intonation).  I've got it to produce some useful results, already, as in the attached MWE (although in 1.1 the baselines don't seem to level up).  %!TEX TS-program = xelatex %!TEX encoding = UTF-8 Unicode \documentclass[a4paper,12pt, oneside]{article}  \usepackage{fontspec} \defaultfontfeatures{Mapping=tex-text, Scale=MatchLowercase} \setmainfont{Charis SIL}  \usepackage{tikz}  \begin{document}  \section{Marking intonation using TikZ}  \subsection{Setting words on different levels}  \begin{table}[hbtp] \begin{tabular}{ll} \cline{1-1} \noalign{\smallskip} \tikz[x=1mm,y=1mm,baseline=12] \draw (0,10) node {\underline{Where}} (10,2) node {are} (20,2) node {you} (30,6) node {\underline{go}} (40,0) node{ing?}; &amp; \textit{neutral/default - stress represented by underlining}\\ \cline{1-1} \noalign{\smallskip} \tikz[x=1mm,y=1mm,baseline=12] \draw (0,0) node {Where} (10,10) node {\underline{are}} (20,5) node {you} (30,2) node {go} (40,0) node{ing?}; &amp; \textit{ e.g. in response to ``I'm not going to the shops after all.''}\\ \cline{1-1} \end{tabular} \end{table}  Why do ``are'' and ``you'' in the first example appear on slightly different levels, even though they are both set to 1mm on the y axis?  Likewise for ``where'' and ``ing'' in the second example.  I'm not sure I'm using ``baseline'' properly here!  \subsection{As above, but boxed}  \begin{tikzpicture} \node[draw] at (0,1) {\underline{Where}}; \node[draw] at (1,0.1) {are}; \node[draw] at (2,0.1) {you}; \node[draw] at (3,0.6) {\underline{go}}; \node[draw] at (4,0) {ing?}; \end{tikzpicture}\ Still have to figure out the difference between ``\textbackslash draw node'' and ``\textbackslash node[draw]''!  \subsection{Graphical contour}  \begin{table}[hbtp] \begin{tabular}{l} \tikz[x=1mm,y=1mm,rounded corners=2mm] \draw[very thick, gray](0,10)--(10,2)--(20,2){[red]--(30,6)--(40,0)}; \\ Where are you~~~going? \end{tabular} \end{table}  \begin{table}[hbtp] \begin{tabular}{l} \tikz[x=1mm,y=1mm,rounded corners=2mm] \draw[very thick, gray](0,10)--(12,2)--(23,2){[red]--(26,6)--(35,0)}; \\ Where are you going? \end{tabular} \end{table}  This is preferable to setting the individual words on different levels, but requires trial and error in (i) matching the length of the whole contour to the utterance, and (ii) spreading the parts of the contour to match the words of the utterance, either by spacing the words (first example) or adjusting the contour points (second example).  \end{document}   However, my main query is whether anyone has a method for dealing with the issue in 1.3.  This involves trial-and-error in fitting the contour to the words, and I was wondering if there is any way to somehow anchor particular contour coordinates to particular syllables.  I know that lines can be attached to nodes, but I haven't been able to find a way of getting the lines to "float" above the nodes.  Any suggestions for allowing a line of text to be marked with anchor points as it is typed, with the contour then being drawn between these?
74537
I have found a strange behavior in TikZ. When using the \draw ... to ... syntax and trying to place nodes along the line with the node[...]{...} syntax, the nodes do not turn up at the expected location.  \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}   \draw(0,0) to[out=60,in=120] (1,0) node[midway]{x}; \end{tikzpicture} \end{document}     How is this done properly?
76362
I created following figure with a script as pasted below:    \documentclass[tikz,border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{positioning, shapes.multipart, arrows, shadows, backgrounds, fit}  \tikzset{   bluebox/.style={     draw,     rectangle,     minimum height=4.5cm,     fill=blue!50!white,     align=center,     inner sep=2ex   },   whitebox/.style={     draw,     rectangle,     minimum height=4.5cm,     fill=white,     align=center,     inner sep=2ex   },   item/.style={     draw,     inner sep=1ex,     fill=white    },   matrix/.style={     draw,     fill=white,     text centered,     minimum height=1em,     drop shadow   } }  \begin{document}  \begin{tikzpicture}[font=\sffamily]      % Stage 1     \node[whitebox, label={Labela}] (Stage1) {\rotatebox{90}{Something}};      % Stage 2     \node[whitebox, right=of Stage1, label=Labelpgq] (Stage2) {\rotatebox{90}{\footnotesize{Something}}};      % Stage 3     \node[draw, shape=rectangle split, rectangle split parts=2, fill=white, right=of Stage2, label=Options A] (OptionsA) {         \nodepart{one} A         \nodepart{two} B};      \node[draw, shape=rectangle split, rectangle split parts=2, fill=white, below=of OptionsA, label=Options B] (OptionsB) {         \nodepart{one} A         \nodepart{two} B};      \begin{scope}[on background layer]         \node[bluebox, fit=(OptionsA) (OptionsB), label=Labelg] (Stage3) {};     \end{scope}      \draw[dashed] (Stage1) -- (Stage2);     \draw[dashed] (Stage2) -- (Stage3); \end{tikzpicture}  \end{document}   Here are the issues I want to solve:   When labels contain a "p", "g" or "q", the text has a larger distance. It looks like the padding is given by the lowest pixel (bug?). For some reason, the blue box is shifted. It should be on level with the others. I experimented by applying "right=of Stage2" to the blue box, but without success.   I'm thankful for help here.
41863
Questions:   Why are the top corners of this number line missing? Why aren't the bottom corners or any other corners of this number line missing? How do I ensure the corners are always there?     \documentclass{article}  \usepackage[left=1.5cm,right=1.5cm,top=2cm,bottom=2cm]{geometry} \usepackage{tikz}   \begin{document}  \begin{tikzpicture}[line width=0.08cm]  \draw (0,0)--(5,0); \draw (0,0.3)--(5,0.3);  \foreach \x in {0,...,5}  {  \node at (\x,-0.55) {\x};  \draw (\x,-0.3)--(\x,0.3);  }  \foreach \x in {0,...,5}  \draw (\x,0)--(\x,0.3);  \end{tikzpicture}  \end{document}   That code yields this:
14106
I want to draw a TikZ matrix with its border and I would like to define the distance between most external matrix nodes and matrix border. Something like a matrix inner sep. If I change inner sep in matrix options declaration, all nodes inside the matrix also change its inner separation.      I know how to do it with fit library. I just want to know if its possible without it.
22304
Hi All: I have a code snippet below which works beautifully and was provided by someone on this list to me a while back.  But now I want to change it so that I draw one long rectangle instead of the adjacent five boxes. The text inside the rectangle should just be at the far right of it and could say $Y^{*}_{whatever}$. I'm thinking that I need to define a rectnode instead of a squared node with different things in it.  But I don't understand how to make it the same length as the length of the boxes and in the same position. &quot;minimum size&quot; currently inside the definition of squarednode isn't making sense to me. EDIT: I have edited this question by including a handwritten drawing in order to express the fact that I need the rectangles to line up with the horizontal axis as shown. So, the first rectangle travels from 0 to 5. The second rectangle travels from 1 to 6, etc all the way to the 6th rectangle travelling from 5 to 10. Also, all the rectangles should be the same width and length even though it may not seem that way by the picture. I also don't need a y-axis. Thanks and I'm sorry for not being clearer the first time.  \begin{tikzpicture}[ squarednode/.style={draw=black, minimum size=9.9mm}, y=1.5cm ]    %boxes      \draw (0.5, 5.5) node[squarednode] {$X_{1}^{*}$};     \draw (1.5, 5.5) node[squarednode] {$X_{2}^{*}$};     \draw (2.5, 5.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 5.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 5.5) node[squarednode] {$X_{5}^{*}$};                  \draw (1.5, 4.5) node[squarednode] {$X_{2}^{*}$};     \draw (2.5, 4.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 4.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 4.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 4.5) node[squarednode,dashed] {0};      \draw (2.5, 3.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 3.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 3.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 3.5) node[squarednode,dashed] {0};     \draw (6.5, 3.5) node[squarednode,dashed] {0};          \draw (3.5, 2.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 2.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 2.5) node[squarednode,dashed] {0};     \draw (6.5, 2.5) node[squarednode,dashed] {0};     \draw (7.5, 2.5) node[squarednode,dashed] {0};          \draw (4.5, 1.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 1.5) node[squarednode,dashed] {0};     \draw (6.5, 1.5) node[squarednode,dashed] {0};     \draw (7.5, 1.5) node[squarednode,dashed] {0};     \draw (8.5, 1.5) node[squarednode,dashed] {0};          \draw (5.5, 0.5) node[squarednode,dashed] {0};     \draw (6.5, 0.5) node[squarednode,dashed] {0};     \draw (7.5, 0.5) node[squarednode,dashed] {0};     \draw (8.5, 0.5) node[squarednode,dashed] {0};     \draw (9.5, 0.5) node[squarednode,dashed] {0};                      \end{tikzpicture}
100691
Taking from the PGF manual,  \begin{tikzpicture}   \draw [help lines] (0,0) grid (3,3);   \coordinate (a) at (rnd,rnd);   \coordinate (b) at (3-rnd,3-rnd);   \draw (a) -- (b);   \node (c) at (1,2) {x};   \draw let \p1 = ($ (a)!(c)!(b) - (c) $),             \n1 = {veclen(\x1,\y1)}         in circle [at=(c), radius=\n1]; \end{tikzpicture}   I'd like to increase the size of x. The problem is that I have multiple circles in the same diagram. Some of them require a larger sized font, while others are okay at default. How do I do this?
72387
TeX Code  \documentclass{standalone} \usepackage{tikz}  \begin{document}  \begin{tikzpicture}    \coordinate (A) at (0, 0);   \coordinate (B) at (2, 3);    \node[draw,minimum width=10mm] at (A) {};   \node[draw,minimum width=10mm] at (B) {}; \end{tikzpicture}  \end{document}   How such path can be drawn using Tikz?
65190
Is there a way to put $\nLeftarrow$ instead of some arrows in TikZ? Specifically, how do I change it to "B does not imply A" in the following code.  \documentclass{article} \usepackage{tikz-cd} \begin{document} \begin{tikzcd}[arrows=Rightarrow]    A \arrow[out=30,in=150]{r}{}\arrow{d} &amp; B \arrow[out=210,in=330]{l}{}\arrow{d}  \\    E  \arrow{r}{} &amp; F \end{tikzcd} \end{document}   One very primite way is to do something similar to the following, where at the description part in the middle of the arrow, use \Big\backslash.  \documentclass{article} \usepackage{tikz-cd} \begin{document} \begin{tikzpicture} \matrix (m) [matrix of math nodes, row sep=3em, column sep=3em]              { A &amp; B \\           &amp; C \\ }; \path[-&gt;,font=\scriptsize] (m-1-1) edge node    {$\Big\backslash$} (m-1-2) edge node {$\Big\backslash$} (m-2-2);     \end{tikzpicture}  \end{document}   But then, how do I put a description in the middle of an arrow in the first code?
110500
I need to do a &quot;work breakdown structure&quot;. As it has to many items on the second level i would like to arrange it horizontally? On  I found following code by Gonzalo Medina: \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows,shapes,positioning,shadows,trees}  \tikzset{   basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},   root/.style   = {basic, rounded corners=2pt, thin, align=center,                    fill=green!30},   level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=green!60,                    text width=8em},   level 3/.style = {basic, thin, align=left, fill=pink!60, text width=6.5em} }  \begin{document} \begin{tikzpicture}[   level 1/.style={sibling distance=40mm},   edge from parent/.style={-&gt;,draw},   &gt;=latex]  % root of the the initial tree, level 1 \node[root] {Drawing diagrams} % The first level, as children of the initial tree   child {node[level 2] (c1) {Defining node and arrow styles}}   child {node[level 2] (c2) {Positioning the nodes}}   child {node[level 2] (c3) {Drawing arrows between nodes}};  % The second level, relatively positioned nodes \begin{scope}[every node/.style={level 3}] \node [below of = c1, xshift=15pt] (c11) {Setting shape}; \node [below of = c11] (c12) {Choosing color}; \node [below of = c12] (c13) {Adding shading};  \node [below of = c2, xshift=15pt] (c21) {Using a Matrix}; \node [below of = c21] (c22) {Relatively}; \node [below of = c22] (c23) {Absolutely}; \node [below of = c23] (c24) {Using overlays};  \node [below of = c3, xshift=15pt] (c31) {Default arrows}; \node [below of = c31] (c32) {Arrow library}; \node [below of = c32] (c33) {Resizing tips}; \node [below of = c33] (c34) {Shortening}; \node [below of = c34] (c35) {Bending}; \end{scope}  % lines from each level 1 node to every one of its &quot;children&quot; \foreach \value in {1,2,3}   \draw[-&gt;] (c1.195) |- (c1\value.west);  \foreach \value in {1,...,4}   \draw[-&gt;] (c2.195) |- (c2\value.west);  \foreach \value in {1,...,5}   \draw[-&gt;] (c3.195) |- (c3\value.west); \end{tikzpicture} \end{document}  Which leads to following result:  (source: ) How can the code be modified in a way that the diagram will expand from the left to the right?
82504
I would like to draw a picture that reflects some file structure. Below code works almost as expected. I need to adjust the connections between nodes so they don't start from the center of the bottom of the parent node but from near the left bottom corner.  How can I do this?  Code:  \documentclass[11pt, oneside]{article} \usepackage{tikz}                           % super package for complex and awesome drawing  \begin{document}  \usetikzlibrary{trees} \tikzstyle{every node}=[draw=black,thick,anchor=west,inner sep=2pt,minimum size=1pt] \tikzstyle{selected}=[draw=cyan,fill=cyan!30] \begin{tikzpicture}[   grow via three points={one child at (0.5,-0.7) and   two children at (0.5,-0.7) and (0.5,-1.4)},      edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}]   \node {MainFolder-\{version\}}     child { node [label={[xshift=6.0cm, yshift=-0.58cm, color=gray] Documentation for developers}] {References and Documentation/}         child { node [draw=none] {main.html} }         child { node {reference/}             child { node [draw=none] {...}}         }         child [missing] {}     }     child [missing] {}     child [missing] {}     child [missing] {}     child { node {release/}         child { node [draw=none] {libAwesome.a} }         child { node [draw=none] {libAwesome.dylib} }     }; \end{tikzpicture} \tikzstyle{every node}=[] % resets borders of tables \tikzstyle{selected}=[] % resets selected  \end{document}     Ouput:    Ideal:    Any help is appreciated.
48091
I'm in the following situation: Using TikZ, I have drawn a curve which is fairly simply described:  \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (1,1.5) .. controls (1,2.25) and (-1,2.25) .. (-1,2)         node[pos=0,anchor=west]{-1}         .. controls (-1,1.75) and (1,1.75) .. (1,2.5)         node[pos=1,anchor=west]{0}         .. controls (1,3.25) and (-1,3.25) .. (-1,3)         .. controls (-1,2.75) and (1,2.75) .. (1,3.5)         node[pos=1,anchor=west]{1}; \end{tikzpicture} \end{document}   However, now I'd like to specify a different style for part of this curve; It happens that the part of this curve I'd like to do something special with is not easily described explicitly. In this particular case, I'd like to apply the style [(-),thick,red] to some arbitrary segment of the curve. I'm looking for an efficient and simple way to do just that.  I was hoping that there might be an option to do something along the lines of \draw[only between 0.2 and 0.8] "curve description", but I'm not aware of any such possibilities.   For extra concreteness, here is a (Paint-made) picture of something like what I'm looking for:
77759
I just came to the following problem - using \settowidth on a length in a tikzpicture resets that length to 0? Here is a (totally command-line) MWE, compiled with pdflatex test.tex:   \documentclass[12pt]{article}  \usepackage{tikz}  \begin{document}  \newlength{\mypgVTitleWidth} \newbox\tbxa  \setlength{\mypgVTitleWidth}{1.0pt} \typeout{ = A: \mypgVTitleWidth is \the\mypgVTitleWidth }  \ %  \settowidth{\mypgVTitleWidth}{MMMMM} \typeout{ = B: \mypgVTitleWidth is \the\mypgVTitleWidth }  \setbox\tbxa\hbox{{MMMMM}} \mypgVTitleWidth\wd\tbxa \typeout{ = B2: \mypgVTitleWidth is \the\mypgVTitleWidth }   \fontsize{10}{10}\selectfont \ % \settowidth{\mypgVTitleWidth}{MMMMM} \typeout{ = C: \mypgVTitleWidth is \the\mypgVTitleWidth }  {  \fontsize{30}{30}\selectfont \ % \settowidth{\mypgVTitleWidth}{MMMMM} \typeout{ = D: \mypgVTitleWidth is \the\mypgVTitleWidth }  }  \begin{tikzpicture} \typeout{ = E: \mypgVTitleWidth is \the\mypgVTitleWidth }  \fontsize{30}{30}\selectfont \ % \settowidth{\mypgVTitleWidth}{MMMMM} \typeout{ = F: \mypgVTitleWidth is \the\mypgVTitleWidth } \end{tikzpicture}  \end{document}   first problem  With that code, with tikzpicture, the following log is generated:    = A: \mypgVTitleWidth is 1.0pt  = B: \mypgVTitleWidth is 53.83278pt  = B2: \mypgVTitleWidth is 53.83278pt  = C: \mypgVTitleWidth is 45.83344pt  LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size &lt;30&gt; not available (Font)              size &lt;24.88&gt; substituted on input line 30.   = D: \mypgVTitleWidth is 105.74562pt  = E: \mypgVTitleWidth is 45.83344pt  = F: \mypgVTitleWidth is 0.0pt   Notably, trace F shows 0.0pt. Comment out the begin and end tikzpicture - and this shows in the log:   ...  = D: \mypgVTitleWidth is 105.74562pt  = E: \mypgVTitleWidth is 45.83344pt  = F: \mypgVTitleWidth is 105.74562pt   ... as expected.   second problem  If I use \fontsize..\selectfont in a group to make temporary changes to calculate a length; I get one length inside the {...} group - and the previous as soon as I exit:   = D: \mypgVTitleWidth is 105.74562pt  = E: \mypgVTitleWidth is 45.83344pt   ... Ok, this I guess is the very purpose of the group (to make sure changes are local) - but if I wanted to save this length for using further on in the code (say in the tikzpicture), what would I do? I tried also with second \newlength set to 0 and \addtolength, that resets itself as well.     Any ideas why this is happening, and how to: get \settowidth working also in tikz? - and read \settowidth from groups?
113508
I've been creating a flow chart using the template I found here:    Please see the code below:  \documentclass{article} \usepackage[latin1]{inputenc} \usepackage{tikz} \usetikzlibrary{shapes,arrows} % Define block styles \tikzstyle{decision} = [diamond, draw, fill=blue!20,      text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt] \tikzstyle{block} = [rectangle, draw, fill=blue!20,      text width=5em, text centered, rounded corners, minimum height=4em] \tikzstyle{line} = [draw, -latex'] \tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,     minimum height=2em] \begin{document} \begin{tikzpicture}[node distance = 2cm, auto]     % Place nodes          \node [cloud] (a) {a};         \node [block, right of = a, node distance =5cm] (b) {b};         \node [decision, below of = b] (c) {c};         \node [block, below of = c, node distance = 3cm] (d) {d};         \node [decision, below of = d, node distance = 3.2cm] (e) {e};         \node [block, right of = e, node distance = 3.2cm] (f) {f};         \node [decision, below of = e] (g) {g};         \node [block, left of = g, node distance = 3.2cm] (h) {h};         \node [decision, below of = g, node distance = 3.5cm] (i) {i};         \node [block, left of = i, node distance = 3.2cm] (j) {j};         \node [block, right of = i, node distance = 3.5cm] (k) {k};      % Draw edges     \path [line] (a) -- (b);     \path [line] (b) -- (b);     \path [line] (b) -- node [near start] {yes} (d);     \path [line] (d) -- (e);     \path [line] (e) -- node [near start] {no} (f);     \path [line] (f) |- (b);     \path [line] (e) -- node [near start] {yes} (g);     \path [line] (g) -- node [near start] {no} (h);     \path [line] (h) |- (e);     \path [line] (g) -- node [near start] {yes} (i);     \path [line] (i) -- node [near start] {yes} (j);     \path [line] (j) -- (h);     \path [line] (i) -- node [near start] {no} (k);     \path [line] (k) -| (h); \end{tikzpicture} \end{document}   How can I create an arrow from k to h that doesn't intersect any of the other boxes or arrows?