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 am a beginner in LaTeX, and trying to make my first tree diagram with TikZ. I have borrowed one sample of code and adapted it. I would like however to move the branch "Automatic formatting" to the left side of the trunk, in order to reduce the height of the diagram, but could not figure how to adapt the parameters. Can someone suggest a solution, and possibly any other change that would improve the look (or clarity and impact..?) of the diagram?

\documentclass[11pt ]{article}
\usepackage{tikz}
\usetikzlibrary{trees}

\begin{document}
\tikzstyle{every node}=[draw=black,thick,anchor=west, fill=red!20, text width=14em, text centered,  minimum height=1.5em, inner sep=0pt, auto, rounded corners= .1 ex]
\centering
\begin{tikzpicture}[
  grow via three points={one child at (0.5,-0.7) and
  two children at (0.5,-0.7) and (0.5,-1.4)},
  edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}]
  \node {Productivity}
child { node [fill=blue!20] {Full structuration}}
child { node  [fill=orange!20]{Automatic formatting}
child { node  [fill=orange!20]{Creation of tables and plots}}
child { node  [fill=orange!20]{Easy integration of pictures}}
child { node  [fill=orange!20]{Auto/easy native graphics}}
child { node [fill=orange!20]{Auto/easy changes}}
child { node  [fill=orange!20]{Sharing of libraries}}
child { node  [fill=orange!20]{Easy splitting of draft file}}
} %
child [missing] {}
child [missing] {}
child [missing] {}
child [missing] {}
child [missing] {}
child [missing] {}
child { node  [fill=green!20]{Simultaneous editing}}
child { node  [fill=green!20]{Short learning curve}}
child { node  [fill=green!20]{Training material}}
child { node  [fill=gray!20]{Stability of software}};
\end{tikzpicture}

\end{document}
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

There are several ways to move a node and its children to the left side. One possibility is to adapt the node properties, e.g. like this:

\documentclass[11pt ]{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\usetikzlibrary{positioning}

\begin{document}
\tikzstyle{every node}=[draw=black,thick,anchor=west, fill=red!20, text width=14em, text centered,  minimum height=1.5em, inner sep=0pt, auto, rounded corners= .1 ex]
\centering
\begin{tikzpicture}[
  grow via three points={one child at (0.5,-0.7) and
  two children at (0.5,-0.7) and (0.5,-1.4)},
  edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}]
  \node {Productivity}
child { node (A) [fill=blue!20] {Full structuration}}
child { node  [fill=green!20]{Simultaneous editing}}
child { node  [fill=green!20]{Short learning curve}}
child { node  [fill=green!20]{Training material}}
child { node  [fill=gray!20]{Stability of software}}
child[
   grow via three points={one child at (-0.5,-0.7) and
   two children at (-1.6,-0.7) and (-1.6,-1.4)},
   edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.east)}]
{ node  [left=of A,fill=orange!20]{Automatic formatting}
   child { node  [fill=orange!20,anchor=west]{Creation of tables and plots}}
   child { node  [fill=orange!20]{Easy integration of pictures}}
   child { node  [fill=orange!20]{Auto/easy native graphics}}
   child { node [fill=orange!20]{Auto/easy changes}}
   child { node  [fill=orange!20]{Sharing of libraries}}
   child { node  [fill=orange!20]{Easy splitting of draft file}}
};
\end{tikzpicture}

\end{document}

The resulting tree looks like this:

enter image description here

share|improve this answer
    
Excellent. I had no idea about the "left=of A," possibility. I have noticed the use of the library \usetikzlibrary{positioning}. Where is it possible to find documentation about the various TikZ libraries? –  Yves May 6 '12 at 16:38
    
My main source for TikZ/PGF is the manual coming with the package. It contains the documentation of all core libraries as well. Together with the wide range of different examples at TeXample.net I'm usually able to get most of my PGF questions answered. –  Martin May 6 '12 at 17:08
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.