1

I am building attack trees for my bachelor thisis. And i need to connect some children nodes by a logical and operator. So i just drew a line between thoses nodes, and put a node on it.

Sadly I am not able to make the label of the edge to be put directly on the (hidden) line, its always midway above it. And i have no idea why... Hope you can help me.

Heres a minimal example:

\documentclass[a4paper,12pt,headsepline,dvipsnames,bibliography=totocnumbered]{scrartcl}

\usepackage{tikz}
\usepackage{tikz-qtree}

\usetikzlibrary{trees}

\begin{document}

    \tikzset{
        attackTree/.style={
            auto,
            font=\small,
            edge from parent fork down,
            level distance=2.5cm,
            every node/.style=
            {   rectangle,
                minimum height=15mm,
                minimum width=30mm,
                draw=black,
                align=center,
                text depth = 0pt
            },
            edge from parent/.style=
            {   draw=black}
        },
        treeOperator/.style={
            minimum width=0,
            minimum height=0,
            draw=none
        }
    }

    \begin{tikzpicture}[
        attackTree,
        sibling distance=35mm
        ]
        \node {Open safe}
        child{
            node {Pick lock}
        }
        child{node {Learn combo}
            child{node {Find written\\combo}}
            child{node {Get combo\\from target}
                child{node{Threaten}}
                child{node{Blackmail}}
                child{node{Eavesdrop}
                    child{node(listen){Listen to\\conversation}}
                    child{node(state){Get target to\\state combo}}
                }
                child{node{Bribe}}
            }
        }
        child{node {Cut open safe}}
        child{node {Install\\improperly}};

        \draw[draw=none] (listen) -- (state) node[treeOperator,midway] {$\wedge$};
    \end{tikzpicture}
\end{document}

And this is what it looks like: enter image description here

I Just want the logical and operator centered right on the hidden line. There must be an option in my settings, which prevents it from beeing where it should be, but I am not able to figure out, which one it is.

Thanks in advance for your help!

  • 1
    Add auto=false to the TreeOperator settings: treeOperator/.style={...,auto=false}. – esdd Jan 24 '17 at 11:37
2

As @esdd mentioned:

add auto=false to the TreeOperator settings: TreeOperator/.style={...,auto=false}. –

did the trick and solved my problem. Thank you :)

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.