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.

After finally solving many issues with this flowchart, I get this...

I'm new to TikZ and I'm having a hard time fixing this. I wanted the 5 nodes from row 5 to be inside a box with a vertical disposition. I have good vertical space, but I'm restricted to the column you see. Im using beamerposter btw.

A not so great MWE

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,matrix}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\scriptsize
\begin{tikzpicture}
[auto,
  block/.style={rectangle, draw=blue, thick, fill=blue!20,text width=10em, text centered, rounded corners,minimum height=4em},
  ratos/.style={rectangle, draw=blue, thick, fill=blue!20,text width=20em, text centered, rounded corners,minimum height=4em},
  line/.style={draw, thick, -latex,shorten >=2pt}]

\matrix [column sep=3mm,row sep=12mm, ampersand replacement=\tikzand]
  {
  % row 1
   \tikzand \node [ratos] (ratos){\textbf{Ratos}\\ 
      \begin{itemize}
        \item Filogeneticamente próximos do Homem
        \item Desenvolve a patologia rapidamente
        \item Manipulação fácil e baixo custo
      \end{itemize}}; \tikzand \\
  % row 2
    \node [block] (femea) {\textbf{Fêmea}\\ 
      \begin{itemize}
        \item Patologia do ovário
      \end{itemize}}; 
   \tikzand \node [block] (hibridos) {\textbf{Híbridos}\\ 
      \begin{itemize}
        \item Geneticamente iguais
      \end{itemize}
    }; 
   \tikzand \node [block] (suprimidos) {\textbf{Imunossuprimidos}\\
      \begin{itemize}
        \item Ratos \textit{nude}, sem timo -- sem rejeição de transplante e interferência imunitária
      \end{itemize}
    }; \\
  % row 3
     \tikzand \node [ratos] (metodo1){Inoculação intrabursal ortotópica de células da linhagem humana do carcinoma de células claras, não metastizantes, preferencialmente no infundíbulo}; \\
  % row 4
    \tikzand \node [block] (grupos){5 grupos de 6 ratos\\ }; \\
  % row 5
    \node [block] (grupo1){\textbf{Grupo 1}\\ Sem tratamento}; \tikzand
    \node [block] (grupo2){\textbf{Grupo 2}\\ Vorinostat \textit{pd} -- 50 mg/kg/dia}; 
    \node [block] (grupo3){\textbf{Grupo 3}\\ Células tratadas com vorinostat \textit{in vitro} antes da inoculação}; \tikzand
    \node [block] (grupo4){\textbf{Grupo 4}\\ Tratamento com fármaco de 1ª linha (paclixatel ou agentes de platina)}; \tikzand
    \node [block] (grupo5){\textbf{Grupo 5}\\ Tratamento com fármaco de 1ª linha e vorinostat}; \\

  % row 6
    \node [block] (duração){\textbf{11 semanas de duração}
      \begin{itemize}
        \item 6 semanas para desenvolvimento tumoral
        \item 5 semanas para se confirmar efeito terapêutico
      \end{itemize}
     }; \\
  % row 7
     \node [block] (eutanasia){Eutanásia de 2 ratos de cada grupo à 9ª, 10ª e 11ª semanas.
     };\\
  %row 8
      \node [block] (analise){Análise macroscópica.
    }; \tikzand
     \node [block] (citologia){Citologia com coloração PAS.
     };\\ 
   };      
\begin{scope}[every path/.style=line]
  \path(ratos)-- (femea);
  \path(ratos)-- (hibridos);
  \path(ratos)-- (suprimidos);
  \path(femea)-- (metodo1);
  \path(hibridos)-- (metodo1);
  \path(suprimidos)-- (metodo1);
  \path(metodo1)-- (grupos);
  \path(grupos)-- (grupo1);
  \path(grupos)-- (grupo2);
  \path(grupos)-- (grupo3);
  \path(grupos)-- (grupo4);
  \path(grupos)-- (grupo5);
  \path(grupo1)-- (duração);
  \path(grupo2)-- (duração);
  \path(grupo3)-- (duração);
  \path(grupo4)-- (duração);
  \path(grupo5)-- (duração);
  \path(duração)-- (eutanasia);
  \path(eutanasia)-- (analise);
  \path(eutanasia)-- (citologia);
\end{scope}
\end{tikzpicture}
\end{document}

Could someone give me a hand in taming this? This is a poster I'm doing for a conference for students of my uni. Thanks for your time!

share|improve this question
add comment

1 Answer

Here is a solution of what I think you want. I minimized the code and only included the rows 4, 5 and 6 from your (not minimal) example. In addition, I added the tikzlibrary calc in order to compute the positions of the corners of the box. The code is

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,matrix,calc}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
\scriptsize

\begin{tikzpicture} [auto,
block/.style={rectangle, draw=blue, thick, text width=5em, text centered, rounded corners,minimum height=4em},
ratos/.style={rectangle, draw=blue, thick,text width=5em, text centered, rounded corners,minimum height=4em},
line/.style={draw, thick, -latex,shorten >=2pt}]

\matrix [column sep=3mm,row sep=6mm, ampersand replacement=\tikzand]
{ 
% row 4
\tikzand \node [block] (grupos){row 4}; \\
% row 5
\tikzand\tikzand\node [block] (grupo1){\textbf{Grupo 1}};\\
\tikzand\tikzand\node (grupo234) {$\vdots$};\\
\tikzand\tikzand\node [block] (grupo5){\textbf{Grupo 5}}; \\
% row 6
\tikzand\node [block] (dura){row 6}; \\    
};
\begin{scope}[every path/.style=line]

\path(grupos)|- (grupo1);
\path(grupos) |- (grupo234);
\path(grupos)|- (grupo5);
\path(grupo1) -- ++(2,0) |- (dura);
\path(grupo234) -- ++(2,0) |- (dura);
\path(grupo5) -- ++(2,0) |- (dura);

\end{scope}

\draw[red] ($(grupo1.north west) + 0.3*(-1.2,1)$) rectangle ($(grupo5.south east)+ 0.3*(1.2,-1)$);
\end{tikzpicture} 
\end{document} 

The result is

diagram with a box

There are other ways to get the result you want, but I think this one limits the amount of changes you have to make to your existing code.

share|improve this answer
    
thanks, I've been reading the pgf manual for the past two days, but nothing I do works.. like your example, as soon as I add a \\ after Group 1 in row 5, it won't compile, complaining of a missing }. Is Latex thinking that I want to end the node? This works in my full-document... –  Santiago Apr 20 '11 at 21:22
    
@Santiago : I can compile the code I wrote for your problem. If when you use it, it does not compile, the probably is something missing. I suggest you build from the ground up : build the nodes and connect them. Once the that is done, then add the text. All of the text makes it difficult to read the structure. I can't say anything more without seeing your work. The code you originaly wrote also compiled. Sorry I can't help more for the moment. –  Frédéric Apr 20 '11 at 22:26
    
your example works, but setting a line break seems impossible without setting "text width=x" –  Santiago Apr 20 '11 at 23:08
    
@Santiago You cannot break a line inside a node as-is, because the node text is not in paragraph mode. You can make it by putting it in a parbox. –  ipavlic Apr 21 '11 at 6:57
    
@Santiago, @ipavlic: Setting "text width=..." will put the node text in paragraph mode. –  Jan Hlavacek Apr 22 '11 at 5:48
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.