Überarbeitungsverlauf[Zurück]
Klicke auf Einblenden/Ausblenden von Überarbeitungen 3
Typo im Titel

10 Nov '15, 13:17

esdd's gravatar image

esdd
17.8k304257

Tiki TikZ tree, Knoten der Nodes nicht mittig

Hallo Leute, ich habe mit meinem Diagramm ein Problem. Der nachfolgende Code ist ok und ergibt folgendes Diagramm. ![Diagramm][1] \documentclass[10pt]{article} \usepackage[utf8]{inputenc} \usepackage[landscape,paper=ansibpaper]{geometry} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{shadings} \tikzstyle{every node}=[draw=black,thin,anchor=west, minimum height=2.5em] \begin{document} \begin{figure}[!htb] \resizebox{\linewidth}{!}{ \begin{tikzpicture}[ supervisor/.style={% edge from parent fork down, level distance=2.5cm, text centered, text width=5cm}, teammate/.style={% text centered, text width=3cm, level distance=2.5cm, fill=gray!10}, subordinate/.style={% grow=down, xshift=-1.1cm, % Horizontal position of the child node text centered, text width=3cm, edge from parent path={(\tikzparentnode.205) |- (\tikzchildnode.west)}}, level1/.style ={level distance=1.5cm}, level2/.style ={level distance=3cm}, level3/.style ={level distance=4.5cm}, level4/.style ={level distance=6cm}, level5/.style ={level distance=7.5cm}, level 1/.style={sibling distance=4cm}, level 1/.append style={level distance=4.5cm}, ] % \draw[help lines] (0,0) grid (4,3); % Supervisor \node[anchor=south,supervisor]{Supervisor\\Supervisory position\\Location} [edge from parent fork down] % Teammate and Subordinates child{node [teammate] {Teammate1\\Position1\\Location1} child[subordinate,level1] {node {Subordinate\\Position1\\Location1}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Subordinate3}} child[subordinate,level4] {node {Subordinate4\\Position4\\Location4}} child[subordinate,level5] {node {Subordinate5\\Position5\\Location5}}} % child{node [teammate] {Teammate2\\Position2\\Location2} child[subordinate,level1] {node {Subordinate1}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Third\\Teammate}} child[subordinate,level4] {node {Longtext-\\teammate}}} % child{node [teammate] {Teammate3\\Position3\\Location3} child[subordinate,level1] {node {Subordinate\\two lines}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Subordinate3}}} % child{node [teammate] {Teammate4\\Position4\\Location4} child[subordinate,level1] {node {Subordinate1}} child[subordinate,level2] {node {Subordinate2}}} % child{node [teammate] {Teammate5\\Position5\\Location5} child[subordinate,level1] {node {First\\Subordinate}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Third\\Teammate}} child[subordinate,level4] {node {Longtext-\\teammate}}}; %\shade[shading=Mandelbrot set] (0,0) rectangle (5,5); \end{tikzpicture}} \caption{This is an org chart} \end{figure} \end{document} Das Problem beginnt, wenn ich den Höhe des "Teammates" mit minimum height erhöhe und gleichzeitig level distance(level 1/.append style={level distance=4.5cm},). Nämlich zwischen dem "Supervisor" und dem "Teammate" ist der Knoten nicht mehr vertikal zentriert. Also folgender Code ergibt das nachfolgende Bild: \documentclass[10pt]{article} \usepackage[utf8]{inputenc} \usepackage[landscape,paper=ansibpaper]{geometry} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{shadings} \tikzstyle{every node}=[draw=black,thin,anchor=west, minimum height=3em] \begin{document} \begin{figure}[!htb] \resizebox{\linewidth}{!}{ \begin{tikzpicture}[ supervisor/.style={% edge from parent fork down, level distance=2.5cm, text centered, text width=5cm}, teammate/.style={% text centered, text width=3cm, level distance=2.5cm, minimum height=4cm, fill=gray!10}, subordinate/.style={% grow=down, xshift=-1.1cm, % Horizontal position of the child node text centered, text width=3cm, edge from parent path={(\tikzparentnode.205) |- (\tikzchildnode.west)}}, level1/.style ={level distance=1.5cm}, level2/.style ={level distance=3cm}, level3/.style ={level distance=4.5cm}, level4/.style ={level distance=6cm}, level5/.style ={level distance=7.5cm}, level 1/.style={sibling distance=4cm}, level 1/.append style={level distance=5cm}, ] % \draw[help lines] (0,0) grid (4,3); % Supervisor \node[anchor=south,supervisor]{Supervisor\\Supervisory position\\Location} [edge from parent fork down] % Teammate and Subordinates child{node [teammate] {Teammate1\\Position1\\Location1} child[subordinate,level1] {node {Subordinate\\Position1\\Location1}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Subordinate3}} child[subordinate,level4] {node {Subordinate4\\Position4\\Location4}} child[subordinate,level5] {node {Subordinate5\\Position5\\Location5}}} % child{node [teammate] {Teammate2\\Position2\\Location2} child[subordinate,level1] {node {Subordinate1}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Third\\Teammate}} child[subordinate,level4] {node {Longtext-\\teammate}}} % child{node [teammate] {Teammate3\\Position3\\Location3} child[subordinate,level1] {node {Subordinate\\two lines}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Subordinate3}}} % child{node [teammate] {Teammate4\\Position4\\Location4} child[subordinate,level1] {node {Subordinate1}} child[subordinate,level2] {node {Subordinate2}}} % child{node [teammate] {Teammate5\\Position5\\Location5} child[subordinate,level1] {node {First\\Subordinate}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Third\\Teammate}} child[subordinate,level4] {node {Longtext-\\teammate}}}; %\shade[shading=Mandelbrot set] (0,0) rectangle (5,5); \end{tikzpicture}} \caption{This is an org chart} \end{figure} \end{document} ![alt text][2] Meine Frage ist nun, wie bekomme ich den Knoten immer mittig zwischen den Node'? Ich habe jetzt die darunterlegenden level nicht angepasst, wollte nur den oberen Fehler rekonstruieren. Vielen Dank! [1]: http://texwelt.de/wissen/upfiles/H6QCU.png [2]: http://texwelt.de/wissen/upfiles/Screen_Shot_2015-11-03_at_9.18.36_PM.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 2

04 Nov '15, 03:24

MCBR's gravatar image

MCBR
71336

Tiki tree, Knoten der Nodes nicht mittig

Hallo Leute, ich habe mit meinem Diagramm ein Problem. Der nachfolgende Code ist ok und ergibt folgendes Diagramm. ![Diagramm][1] \documentclass[10pt]{article} \usepackage[utf8]{inputenc} \usepackage[landscape,paper=ansibpaper]{geometry} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{shadings} \tikzstyle{every node}=[draw=black,thin,anchor=west, minimum height=2.5em] \begin{document} \begin{figure}[!htb] \resizebox{\linewidth}{!}{ \begin{tikzpicture}[ supervisor/.style={% edge from parent fork down, level distance=2.5cm, text centered, text width=5cm}, teammate/.style={% text centered, text width=3cm, level distance=2.5cm, fill=gray!10}, subordinate/.style={% grow=down, xshift=-1.1cm, % Horizontal position of the child node text centered, text width=3cm, edge from parent path={(\tikzparentnode.205) |- (\tikzchildnode.west)}}, level1/.style ={level distance=1.5cm}, level2/.style ={level distance=3cm}, level3/.style ={level distance=4.5cm}, level4/.style ={level distance=6cm}, level5/.style ={level distance=7.5cm}, level 1/.style={sibling distance=4cm}, level 1/.append style={level distance=4.5cm}, ] % \draw[help lines] (0,0) grid (4,3); % Supervisor \node[anchor=south,supervisor]{Supervisor\\Supervisory position\\Location} [edge from parent fork down] % Teammate and Subordinates child{node [teammate] {Teammate1\\Position1\\Location1} child[subordinate,level1] {node {Subordinate\\Position1\\Location1}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Subordinate3}} child[subordinate,level4] {node {Subordinate4\\Position4\\Location4}} child[subordinate,level5] {node {Subordinate5\\Position5\\Location5}}} % child{node [teammate] {Teammate2\\Position2\\Location2} child[subordinate,level1] {node {Subordinate1}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Third\\Teammate}} child[subordinate,level4] {node {Longtext-\\teammate}}} % child{node [teammate] {Teammate3\\Position3\\Location3} child[subordinate,level1] {node {Subordinate\\two lines}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Subordinate3}}} % child{node [teammate] {Teammate4\\Position4\\Location4} child[subordinate,level1] {node {Subordinate1}} child[subordinate,level2] {node {Subordinate2}}} % child{node [teammate] {Teammate5\\Position5\\Location5} child[subordinate,level1] {node {First\\Subordinate}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Third\\Teammate}} child[subordinate,level4] {node {Longtext-\\teammate}}}; %\shade[shading=Mandelbrot set] (0,0) rectangle (5,5); \end{tikzpicture}} \caption{This is an org chart} \end{figure} \end{document} Das Problem beginnt, wenn ich den Höhe des "Teammates" mit minimum height erhöhe und gleichzeitig level distance(level 1/.append style={level distance=4.5cm},). Nämlich zwischen dem "Supervisor" und dem "Teammate" ist der Knoten nicht mehr vertikal zentriert. Also folgender Code ergibt das nachfolgende Bild: \documentclass[10pt]{article} \usepackage[utf8]{inputenc} \usepackage[landscape,paper=ansibpaper]{geometry} \usepackage{tikz} \usetikzlibrary{trees} \usetikzlibrary{shadings} \tikzstyle{every node}=[draw=black,thin,anchor=west, minimum height=3em] \begin{document} \begin{figure}[!htb] \resizebox{\linewidth}{!}{ \begin{tikzpicture}[ supervisor/.style={% edge from parent fork down, level distance=2.5cm, text centered, text width=5cm}, teammate/.style={% text centered, text width=3cm, level distance=2.5cm, minimum height=4cm, fill=gray!10}, subordinate/.style={% grow=down, xshift=-1.1cm, % Horizontal position of the child node text centered, text width=3cm, edge from parent path={(\tikzparentnode.205) |- (\tikzchildnode.west)}}, level1/.style ={level distance=1.5cm}, level2/.style ={level distance=3cm}, level3/.style ={level distance=4.5cm}, level4/.style ={level distance=6cm}, level5/.style ={level distance=7.5cm}, level 1/.style={sibling distance=4cm}, level 1/.append style={level distance=5cm}, ] % \draw[help lines] (0,0) grid (4,3); % Supervisor \node[anchor=south,supervisor]{Supervisor\\Supervisory position\\Location} [edge from parent fork down] % Teammate and Subordinates child{node [teammate] {Teammate1\\Position1\\Location1} child[subordinate,level1] {node {Subordinate\\Position1\\Location1}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Subordinate3}} child[subordinate,level4] {node {Subordinate4\\Position4\\Location4}} child[subordinate,level5] {node {Subordinate5\\Position5\\Location5}}} % child{node [teammate] {Teammate2\\Position2\\Location2} child[subordinate,level1] {node {Subordinate1}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Third\\Teammate}} child[subordinate,level4] {node {Longtext-\\teammate}}} % child{node [teammate] {Teammate3\\Position3\\Location3} child[subordinate,level1] {node {Subordinate\\two lines}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Subordinate3}}} % child{node [teammate] {Teammate4\\Position4\\Location4} child[subordinate,level1] {node {Subordinate1}} child[subordinate,level2] {node {Subordinate2}}} % child{node [teammate] {Teammate5\\Position5\\Location5} child[subordinate,level1] {node {First\\Subordinate}} child[subordinate,level2] {node {Subordinate2}} child[subordinate,level3] {node {Third\\Teammate}} child[subordinate,level4] {node {Longtext-\\teammate}}}; %\shade[shading=Mandelbrot set] (0,0) rectangle (5,5); \end{tikzpicture}} \caption{This is an org chart} \end{figure} \end{document} ![alt text][2] Meine Frage ist nun, wie bekomme ich den Knoten immer mittig zwischen den Node'? Ich habe jetzt die darunterlegenden level nicht angepasst, wollte nur den oberen Fehler rekonstruieren. Vielen Dank! [1]: http://texwelt.de/wissen/upfiles/H6QCU.png [2]: http://texwelt.de/wissen/upfiles/Screen_Shot_2015-11-03_at_9.18.36_PM.png
Klicke auf Einblenden/Ausblenden von Überarbeitungen 1

04 Nov '15, 03:22

MCBR's gravatar image

MCBR
71336