7

I have the following plot which looks good, but there are two issues:

  1. Not all arrows have arrow-heads. I have no idea why this is.
  2. Some edges are not long enough. For example, the left edge of the root does not touch the root at the base.

What can I do to fix this?

\tikzstyle{every node}=[align=center, fill=white, rectangle, draw, rounded corners]
    \tikzset{external/remake next}
    \begin{tikzpicture}[->, thick,scale=0.8, level distance=3em, growth parent anchor=south]
    \node {Cryptographic\\primitives}
    [sibling distance=25em]
    child {
        [sibling distance=10em]
        node {Public-key\\primitives}
        child{ 
            [sibling distance=.5em]
            node {Public-key\\ciphers}
        }
        child{ 
            [sibling distance=.5em]
            node {Signatures}
        }
    }   
    child {
        [sibling distance=10em]
        node {Symmetric-key\\primitives}
        child{ 
            [sibling distance=10em]
            node {Symmetric-key\\ciphers}
            child {
                node {Block\\ciphers}
                child {
                    node {Lightweight\\block ciphers}
                }   
            }
            child {
                node {Stream\\ciphers}
            }
        }
        child{ 
            [sibling distance=2em]
            node {Hash\\functions}
        }
        child{ 
            [sibling distance=2em]
            node {Pseudo-random\\sequences}
        }
    }
    ;
    \end{tikzpicture}
6

Problems were due to the fact that you specified manually [sibling distance=..] at each step covering the arrows. It is better to declare once the distance by means of level 1/.style={...}.

Here is my MWE:

\documentclass{scrartcl}

\usepackage{tikz}
\usetikzlibrary{trees,arrows}

\begin{document}
\tikzset{every node/.style={align=center, fill=white, rectangle, draw, rounded corners}}
\tikzset{level 1/.style={sibling distance =25em}}
\tikzset{level 2/.style={sibling distance =10em}}
\tikzset{level 3/.style={sibling distance =7em}}
\tikzset{level 4/.style={sibling distance =5em}}

    \begin{tikzpicture}[-stealth,thick,scale=0.8, level distance=3em, growth parent anchor=south]
    \node {Cryptographic\\primitives}
    child {
        node {Public-key\\primitives}
        child{ 
            node {Public-key\\ciphers}
        }
        child{ 
            node {Signatures}
        }
    }   
    child {
        node {Symmetric-key\\primitives}
        child{ 
            node {Symmetric-key\\ciphers}
            child {
                node {Block\\ciphers}
                child {
                    node {Lightweight\\block ciphers}
                }   
            }
            child {
                node {Stream\\ciphers}
            }
        }
        child{ 
            node {Hash\\functions}
        }
        child{ 
            node {Pseudo-random\\sequences}
        }
    };
    \end{tikzpicture}

\end{document}

Graphical result:

enter image description here

To let all arrows meet correctly boxes, one can remove the option growth parent anchor=south and increasing the level distance. For example:

\begin{tikzpicture}[-stealth,thick,scale=0.8, level distance=6em]

This will give:

enter image description here

1
  • Very nice, thank you. The arrows still fail to meet some of the boxes, but I guess thats ok :) – Martin Lauridsen Jun 21 '12 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.