tikz - Latex: elements are superimposed in fault tree -


i have following code element 31 superimposed on element 27. how can fix problem?

\documentclass[border=10pt]{standalone} \usepackage{tikz,rotating} \usetikzlibrary{trees,calc,shadings,shapes.gates.logic.us,positioning,arrows} \usetikzlibrary{shapes,snakes}  \begin{document} \begin{turn}{-90} \begin{tikzpicture}[ % gates , symbols style     and/.style={and gate us,thick,draw,fill=red!60,rotate=90,         anchor=east,xshift=-2mm},     or/.style={or gate us,thick,draw,fill=blue!60,rotate=90,         anchor=east,xshift=-1mm},     be/.style={circle,thick,draw,fill=green!60,anchor=north,         minimum width=0.7cm},     tr/.style={buffer gate us,thick,draw,fill=purple!60,rotate=90,         anchor=east,minimum width=0.8cm}, % label style     label distance=-3mm,     every label/.style={blue,rotate=90}, % event style     event/.style={rectangle,thick,draw,fill=yellow!20,text width=0.7cm,         text centered,font=\sffamily,anchor=north}, % children , edges style     edge parent/.style={very thick,draw=black!70},     edge parent path={(\tikzparentnode.south) -- ++(0,-1.05cm)             -| (\tikzchildnode.north)},     level 1/.style={sibling distance=7cm,level distance=1.4cm,             growth parent anchor=south,nodes=event},     level 2/.style={sibling distance=5cm},     level 3/.style={sibling distance=1cm},     level 4/.style={sibling distance=3cm}     ]     \node (g1) {}          child{node (g2) {\rotatebox{90}{final}}                child {node (g3) {\rotatebox{90}{1}}                child {node (g4) {\rotatebox{90}{11}}}            }             child {node (g5) {\rotatebox{90}{2}}               child {node (s1) {\rotatebox{90}{21}}}               child {node (s2) {\rotatebox{90}{22}}}               child {node (s3) {\rotatebox{90}{23}}}               child {node (s4) {\rotatebox{90}{24}}}               child {node (s5) {\rotatebox{90}{25}}}               child {node (s6) {\rotatebox{90}{26}}}               child {node (s7) {\rotatebox{90}{27}}}             }         child {node (g6) {\rotatebox{90}{3}}               child {node (r1) {\rotatebox{90}{31}}}               child {node (r2) {\rotatebox{90}{32}}}               child {node (r3) {\rotatebox{90}{33}}}               child {node (r4) {\rotatebox{90}{34}}}             }             };    \node [and]  @ (g2.south)   [label=-100:and]    {};    \node [or]   @ (g3.south)   [label=-100:or] {};    \node [or]   @ (g5.south)   [label=-100:or] {};    \node [or]   @ (g6.south)   [label=-100:or] {}; \end{tikzpicture} \end{turn}   \end{document} 

enter image description here

as see elements superimposed each other. when change parameters in code, figure went end of document.

you can add simple xshift second child (it on x because of rotation). try version if satisfies you:

\documentclass[border=10pt]{standalone} \usepackage{tikz,rotating} \usetikzlibrary{trees,calc,shadings,shapes.gates.logic.us,positioning,arrows} \usetikzlibrary{shapes,snakes}  \begin{document} \begin{turn}{-90} \begin{tikzpicture}[ % gates , symbols style     and/.style={and gate us,thick,draw,fill=red!60,rotate=90,         anchor=east,xshift=-2mm},     or/.style={or gate us,thick,draw,fill=blue!60,rotate=90,         anchor=east,xshift=-1mm},     be/.style={circle,thick,draw,fill=green!60,anchor=north,         minimum width=0.7cm},     tr/.style={buffer gate us,thick,draw,fill=purple!60,rotate=90,         anchor=east,minimum width=0.8cm}, % label style     label distance=-3mm,     every label/.style={blue,rotate=90}, % event style     event/.style={rectangle,thick,draw,fill=yellow!20,text width=0.7cm,         text centered,font=\sffamily,anchor=north}, % children , edges style     edge parent/.style={very thick,draw=black!70},     edge parent path={(\tikzparentnode.south) -- ++(0,-1.05cm)             -| (\tikzchildnode.north)},     level 1/.style={sibling distance=7cm,level distance=1.4cm,             growth parent anchor=south,nodes=event},     level 2/.style={sibling distance=5cm},     level 3/.style={sibling distance=1cm},     level 4/.style={sibling distance=3cm}     ]     \node (g1) {}          child{node (g2) {\rotatebox{90}{final}}                child {node (g3) {\rotatebox{90}{1}}                child {node (g4) {\rotatebox{90}{11}}}            }             child {node (g5) {\rotatebox{90}{2}}               child {node (s1) {\rotatebox{90}{21}}}               child {node (s2) {\rotatebox{90}{22}}}               child {node (s3) {\rotatebox{90}{23}}}               child {node (s4) {\rotatebox{90}{24}}}               child {node (s5) {\rotatebox{90}{25}}}               child {node (s6) {\rotatebox{90}{26}}}               child {node (s7) {\rotatebox{90}{27}}}             }         child {node[xshift=1cm] (g6) {\rotatebox{90}{3}} % <--- edit!               child {node (r1) {\rotatebox{90}{31}}}               child {node (r2) {\rotatebox{90}{32}}}               child {node (r3) {\rotatebox{90}{33}}}               child {node (r4) {\rotatebox{90}{34}}}             }             };    \node [and]  @ (g2.south)   [label=-100:and]    {};    \node [or]   @ (g3.south)   [label=-100:or] {};    \node [or]   @ (g5.south)   [label=-100:or] {};    \node [or]   @ (g6.south)   [label=-100:or] {}; \end{tikzpicture} \end{turn}   \end{document} 

result

p.s. such question fits better on tex site


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -