Kindly help this messy tikz flow chart.
\documentclass{beamer}
\usetheme{CambridgeUS}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\tikzstyle{block} = [rectangle, draw, text width=10em, text centered, fill=yellow!80]
\tikzstyle{mycircle} = [circle, draw, text width=7em, text centered, fill=red!30]
\begin{document}
\begin{frame}
\begin{tikzpicture}[node distance=4.5cm, auto, >=stealth]
\centering
\node [block](child){\par {Early life{\begin{itemize}
\item Genetic
\item Environmental
\end{itemize}}}};
\node [block] (psych)[right of = child]{\large {Psychoscial factors}{\begin{itemize}
\item life stress
\item Psychological stress
\item coping
\item social support
\end{itemize}}};
\node [block](physiology)[below of = psych]{Physiology {\begin{itemize}
\item Motility
\item Sensation
\item Inflammation
\item Altered bacterial
\item flora
\end{itemize}}};
\node [mycircle](FGID)[right of = physiology]{FGID};
%path
\draw[->](child)--(psych);
\draw[->] (child)--(physiology);
\draw[<->](psych)--(physiology);
\draw [<->](physiology)--(FGID);
\draw [<->](psych)--(FGID);
\end{tikzpicture}
\end{frame}
\end{document}
Best Answer
Besides the things I already commented on, here are a few other things I’d consider:
Setting a fixed with makes the nodes having them the same width but also creates problem for very long words in the
itemize
environment. In addition to that theitemize
environment introduces a rather high horizontal white space in front of the bullet. (Similar things happen in Saving a list in a re-usable box.)I would avoid
itemize
and reproduce the behavior with a simplytabular
environment (see my answer on the linked question) which inserts the bullet on its own.For a more pleasing output I center the first line (kind of a header, isn’t it?) and add additional vertical space. The
rectangle split
shape might help here.The needed options are:
shape=rectangle split
,rectangle split parts=2
: we want two parts,rectangle split part align={center,left}
: the first part is centered, the second part is left-aligned.rectangle split draw splits=false
: by default the shape has lines between the separate parts, this disables them.In the second example, I have used my
positioning-plus
library to place thepsych
and theFGID
node vertically centered to the other nodes.The first example needs the
positioning
library (which is loaded bypositioning-plus
so it is not loaded explicitly).Code
Output