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 Would like to know how to draw this diagram or similar. Thx. enter image description here

I have started to use LaTeX just a few weeks to try pass a .doc to .tex, but I don't know how do this image. I tried use one exemple to do that, but I could not adjust the size and add dashed line.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{trees} % this is to allow the fork right path


\title{Tikz}
\author{fernando_bcc }
\date{April 2014}

\begin{document}

\begin{tikzpicture}[level.style={sibling distance=1mm}]
\tikzset{edge from parent/.style= 
            {thick, draw, edge from parent fork down},
         every tree node/.style=
            {draw,minimum width=0.8in,text width=1in,align=center,{sibling distance=1mm}}}


\Tree 
    [. Sistema 
        [.{Estáticos}
        ]
        [.{Dinâmicos}
            [.{Variante no tempo } ]
            [.{Invariante no tempo}
                [.{Linear} ]
                [.{Não Linear} 
                    [.{Estados contínuos} ]
                    [.{Estados discretos} 
                        [.{Dirigidos pelo tempo} ]
                        [.{Dirigidos por eventos} 
                            [.{Determinísticos} ]
                            [.{Não determinísticos}
                                [.{Tempo discretizado} ]
                                [.{Tempo contínuo} ]
                            ]
                        ]
                    ]
                ]
            ]
        ] 
    ]
\end{tikzpicture}

\maketitle

\section{Introduction}

\end{document}
share|improve this question
1  
Welcome to TeX.SE. Which specific part are you having difficulty with? There should be several example on this site to get you started. –  Peter Grill Apr 12 at 23:36
1  
Please post the code you've got so far so people have something to start with! Just posting an image is not really a reasonable question as it makes it harder to help and even to understand the context and question. All questions should include a complete small document demonstrating the issue or showing what efforts you've made so far. Without this, you have to hope the procrastinators take a liking to your question and want to while away some time! –  cfr Apr 12 at 23:39
    
Try having a check at link, pages 364 on... –  MattAllegro Apr 13 at 0:09
    
To draw the line, all you need to do is to place some names to designated nodes and use those names to draw the line. See my answer below. –  Gonzalo Medina Apr 13 at 0:25

1 Answer 1

up vote 10 down vote accepted

One option using the powerful forest package:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{forest}
\usetikzlibrary{shadows}

\begin{document}

\begin{forest} 
for tree={
  edge path={
    \noexpand\path[line width=1.5pt,\forestoption{edge}]
      (\forestOve{\forestove{@parent}}{name}.parent anchor) -- +(0,-16pt) -|   
      (\forestove{name}.child anchor)\forestoption{edge label};
  },
  l sep=12pt,
  draw,
  fill=white,
  align=center,
  drop shadow
} 
[Sistemas
  [Dinámicos]
  [Estâticos
    [Variante no tempo]
    [Invariantes no tempo
      [Linear]
      [N\~ao linear
        [Estados contínuos]
        [Estados discretos,name=discretos
          [Dirigidos pelo tempo,name=pelotempo]
          [Dirigidos por eventos
            [Determinísticos]
            [N\~ao determinísiticos
              [Tempo discretizado]
              [Tempo contínuo,name=continuo]
            ]
          ]
        ]
      ]
    ]
  ]
]
\draw[dashed,red]
 ([xshift=-4pt]pelotempo.north west|-continuo.south) --
 ([xshift=-4pt,yshift=4pt]pelotempo.north west) --
 ([xshift=-2pt,yshift=4pt]discretos.west|-pelotempo.north) --
 ([xshift=-2pt,yshift=8pt]discretos.north west) --
 ([xshift=20pt,yshift=8pt]discretos.north east) --
 ([xshift=35pt]continuo.south east);
\end{forest}

\end{document}

enter image description here

share|improve this answer
    
Thanks very much! –  user1313455 Apr 13 at 0:25
    
@user1313455 You're welcome! Don't forget that you can accept answers that you consider solved your problems by clicking the checkmark to their left. In case of doubt, please see How do you accept an answer?. –  Gonzalo Medina Apr 13 at 0:26
1  
Does the documentation include any examples with the branches like this? (i.e. like with the standard tikz edge from parent fork down from the trees library?) I looked but I couldn't find anything. –  cfr Apr 13 at 0:32
1  
@cfr No; there's no examples like this one. I took the relevant code from page 90 (lines 1873-1878) Section 10.4.2 Declaring options, where the code is documented. –  Gonzalo Medina Apr 13 at 0:44
    
Thanks. I've never looked at forest before and it wasn't obvious where that might be! I'll try to remember 'options' for next time! –  cfr Apr 13 at 1:01

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.