I would like to do a organisation chart with pictures, name, mobile.nr and email in each node... I tried with the tikz tree bit failed. How can i add pictures in a node?
Can someone help me? Please
Asked
Active
Viewed 4,551 times
7
Jocken
- 123
-
Welcome to the TeX.SX! Could you please add a minimum (working) example? It would help the solvers a lot to actually start working on it. – Malipivo Apr 07 '14 at 15:27
-
You should probably have a look at this site for examples with tikz : http://www.texample.net/tikz/examples/tag/diagrams/ and come back for specific problem when you have some. – Penbeuz Apr 07 '14 at 15:28
1 Answers
11
Here's one possibility:
\documentclass[border=6pt]{standalone}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\usepackage[
colorlinks=true,
urlcolor=cyan!70!black
]{hyperref}
\tikzset{
basic/.style={
draw,
text width=6.5cm,
minimum height=40pt,
font=\sffamily,
inner sep=0pt,
},
}
\newcommand\mynode[7][]{
\node[#1] (#2)
{\parbox{20pt}{%
\includegraphics[height=40pt,width=20pt]{#3}}%
\parbox{10pt}{\mbox{}}%
\parbox{\dimexpr6.5cm-30pt\relax}{#4\\[.4ex]#5\\\footnotesize\texttt{#6}\ \url{#7}}%
};
}
\begin{document}
\begin{tikzpicture}[
level 1/.style={sibling distance=80mm},
edge from parent/.style={->,draw},
>=latex,
every node/.style={basic}
]
% root
\mynode{root}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
% The first level
\mynode[below left= of root]{c1}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of root]{c2}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below right= of root]{c3}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\begin{scope}[node distance=-\pgflinewidth and 1cm]
\mynode[below = 10pt of c1, xshift=15pt]{c11}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c11]{c12}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c12]{c13}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = 10pt of c2, xshift=15pt]{c21}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c21]{c22}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c22]{c23}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c23]{c24}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = 10pt of c3, xshift=15pt]{c31}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c31]{c32}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c32]{c33}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c33]{c34}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\mynode[below = of c34]{c35}{flor}{No Body}{All and nothing}{00-123456}{anywhere@home.com}
\end{scope}
% lines from root to level 1
\draw (root.south) -- ++(0,-13pt) -| (c1.north);
\draw (root.south) -- ++(0,-13pt) -| coordinate[pos=0.05] (aux) (c3.north);
\draw (aux) -- (aux|-c2.north);
% lines from each level 1 node to every one of its "children"
\foreach \value in {1,2,3}
\draw[->] ([xshift=6pt]c1.south west) |- (c1\value.west);
\foreach \value in {1,...,4}
\draw[->] ([xshift=6pt]c2.south west) |- (c2\value.west);
\foreach \value in {1,...,5}
\draw[->] ([xshift=6pt]c3.south west) |- (c3\value.west);
\end{tikzpicture}
\end{document}

The command \mynode has one optional argument to pass options to the internal node used and six mandatory arguments (if the image for every node is the same, the definition can be simplified):
\mynode[<options for the node>]{<name>}{<image file>}{<text line1>}{<text line2>}{<telephone number>}{<url>}
Gonzalo Medina
- 505,128