如何增加树形图中节点之间的空间

如何增加树形图中节点之间的空间

我需要创建一个树形图,但是当我在节点上写入时会发生这种情况:

在此处输入图片描述

以下是代码:

\documentclass[12pt, oneside, article]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb, verbatim, xspace, setspace}
\usepackage{enumerate}
\usepackage[top=2.5cm, left=2cm, right=2cm, bottom=2.5cm]{geometry}
\usepackage[spanish]{babel}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{thmtools}
\usepackage{multicol}
\usepackage{tgtermes}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{color}
\usepackage[dvipsnames]{xcolor}
\usepackage{bbm}
\usepackage{euscript}
\usepackage{framed}
\usepackage{polynom}
\usepackage{fancyhdr}
\usepackage{stmaryrd}
\usepackage{bbm}
\usepackage{listings}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\usepackage{color} %red, green, blue, yellow, cyan, magenta, black, white
\tikzset{
      basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
      root/.style   = {basic, rounded corners=2pt, thin, align=center,
                   fill=Cerulean},
      level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=SeaGreen,
                   text width=8em},
      level 3/.style = {basic, thin, align=left, fill=Goldenrod!60, text width=6.5em}
    }

\begin{document}
\begin{tikzpicture}[
  level 1/.style={sibling distance=45mm},
  edge from parent/.style={->,draw},
  >=latex]

% root of the the initial tree, level 1
\node[root] {\textbf{Holones de la sexualidad}}
% The first level, as children of the initial tree
  child {node[level 2] (c1) {La reproductividad}}
  child {node[level 2] (c2) {El género}}
  child {node[level 2] (c3) {El erotismo}}
  child {node[level 2] (c4) {Viculación afectiva}};

% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]
\node [below of = c1, xshift=15] (c11) {Los serem humaos por naturaleza somos seres sexuales. El fin más \emph{tradiccional} es el de reproducción.};
\node [below of = c1, xshift=15pt] (c12) {Para que los seres huanos sigan existiendo, la reproducción es fundamental.};
\node [below of = c11] (c13) {Choosing color};
\node [below of = c12] (c14) {Adding shading};

\node [below of = c2, xshift=15pt] (c21) {El géneo rompe el concepto \emph{tradicional} del pensamiento binario de hombre y mujeres};
\node [below of = c21] (c22) {También rompe los estígmas de que solamente existe la heterosexualidad};
\node [below of = c22] (c23) {Absolutely};
\node [below of = c23] (c24) {Using overlays};

\node [below of = c3, xshift=15pt] (c31) {Default arrows};
\node [below of = c31] (c32) {Arrow library};
\node [below of = c32] (c33) {Resizing tips};
\node [below of = c33] (c34) {Shortening};
\node [below of = c34] (c35) {Bending};

\node [below of = c4, xshift=15pt] (c41) {Default arrows};
\node [below of = c41] (c42) {Arrow library};
\node [below of = c42] (c43) {Resizing tips};
\node [below of = c43] (c44) {Shortening};
\node [below of = c44] (c45) {Bending};
\end{scope}

% lines from each level 1 node to every one of its "children"
\foreach \value in {1,2,3}
  \draw[->] (c1.195) |- (c1\value.west);

\foreach \value in {1,...,4}
  \draw[->] (c2.195) |- (c2\value.west);

\foreach \value in {1,...,5}
  \draw[->] (c3.195) |- (c3\value.west);
  
\foreach \value in {1,...,5}
  \draw[->] (c3.195) |- (c4\value.west);
  
\end{tikzpicture}

\end{document}

我该如何修复它?

答案1

在此处输入图片描述

\documentclass[12pt, oneside, article]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb, verbatim, xspace, setspace}
\usepackage{enumerate}
\usepackage[top=2.5cm, left=2cm, right=2cm, bottom=2.5cm]{geometry}
\usepackage[spanish]{babel}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{thmtools}
\usepackage{multicol}
\usepackage{tgtermes}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{color}
\usepackage[dvipsnames]{xcolor}
\usepackage{bbm}
\usepackage{euscript}
\usepackage{framed}
\usepackage{polynom}
\usepackage{fancyhdr}
\usepackage{stmaryrd}
\usepackage{bbm}
\usepackage{listings}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\usepackage{color} %red, green, blue, yellow, cyan, magenta, black, white
\tikzset{
      basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
      root/.style   = {basic, rounded corners=2pt, thin, align=center,
                   fill=Cerulean},
               level 1/.style={sibling distance=45mm},
      level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=SeaGreen,
                   text width=8em},
      level 3/.style = {basic, thin, align=left, fill=Goldenrod!60, text width=6.5em}
    }

\begin{document}
\begin{tikzpicture}[
%                   level 1/.style={sibling distance=45mm},
%                    edge from parent/.style={->,draw},
                    ]

% root of the the initial tree, level 1
\node[root] {\textbf{Holones de la sexualidad}}
% The first level, as children of the initial tree
  child {node[level 2] (c1) {La reproductividad}}
  child {node[level 2] (c2) {El género}}
  child {node[level 2] (c3) {El erotismo}}
  child {node[level 2] (c4) {Viculación afectiva}}
  ;
% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]
\node [below=of c1, xshift=15pt] (c11) {Los serem humaos por naturaleza somos seres sexuales. El fin más \emph{tradiccional} es el de reproducción.};
\node [below=of c11] (c12) {Para que los seres huanos sigan existiendo, la reproducción es fundamental.};
\node [below=of c12] (c13) {Choosing color};
\node [below=of c13] (c14) {Adding shading};

\node [below=of c2, xshift=15pt] (c21) {El géneo rompe el concepto \emph{tradicional} del pensamiento binario de hombre y mujeres};
\node [below=of c21] (c22) {También rompe los estígmas de que solamente existe la heterosexualidad};
\node [below=of c22] (c23) {Absolutely};
\node [below=of c23] (c24) {Using overlays};

\node [below=of c3, xshift=15pt] (c31) {Default arrows};
\node [below=of c31] (c32) {Arrow library};
\node [below=of c32] (c33) {Resizing tips};
\node [below=of c33] (c34) {Shortening};
\node [below=of c34] (c35) {Bending};

\node [below=of c4, xshift=15pt] (c41) {Default arrows};
\node [below=of c41] (c42) {Arrow library};
\node [below=of c42] (c43) {Resizing tips};
\node [below=of c43] (c44) {Shortening};
\node [below=of c44] (c45) {Bending};
\end{scope}
% lines from each level 1 node to every one of its "children"
%\foreach \value in {1,2,3}
%  \draw[->] (c1.195) |- (c1\value.west);
%
%\foreach \value in {1,...,4}
%  \draw[->] (c2.195) |- (c2\value.west);
%
%\foreach \value in {1,...,5}
%  \draw[->] (c3.195) |- (c3\value.west);
%  
%\foreach \value in {1,...,5}
%  \draw[->] (c3.195) |- (c4\value.west);
%  
\end{tikzpicture}

\end{document}

编辑

\documentclass[12pt, oneside, article]{memoir}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amssymb, verbatim, xspace, setspace}
\usepackage{enumerate}
\usepackage[top=2.5cm, left=2cm, right=2cm, bottom=2.5cm]{geometry}
%\usepackage[spanish]{babel}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{thmtools}
\usepackage{multicol}
\usepackage{tgtermes}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{color}
\usepackage[dvipsnames]{xcolor}
\usepackage{bbm}
\usepackage{euscript}
\usepackage{framed}
\usepackage{polynom}
\usepackage{fancyhdr}
\usepackage{stmaryrd}
%\usepackage{bbm}
\usepackage{listings}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\usepackage{color} %red, green, blue, yellow, cyan, magenta, black, white
\tikzset{
      basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
      root/.style   = {basic, rounded corners=2pt, thin, align=center,
                   fill=Cerulean},
      level 1/.style={sibling distance=45mm},
      level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=SeaGreen,
                   text width=8em},
      level 3/.style = {basic, thin, align=left, fill=Goldenrod!60, text width=6.5em}
    }

\begin{document}
\begin{tikzpicture}[
%                   level 1/.style={sibling distance=45mm},
                     edge/.style={->,draw},
                    ]

% root of the the initial tree, level 1
\node[root] {\textbf{Holones de la sexualidad}}
% The first level, as children of the initial tree
  child {node[level 2] (c1) {La reproductividad}}
  child {node[level 2] (c2) {El género}}
  child {node[level 2] (c3) {El erotismo}}
  child {node[level 2] (c4) {Viculación afectiva}}
  ;
% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]
\node [below=of c1, xshift=15pt] (c11) {Los serem humaos por naturaleza somos seres sexuales. El fin más \emph{tradiccional} es el de reproducción.};
\node [below=of c11] (c12) {Para que los seres huanos sigan existiendo, la reproducción es fundamental.};
\node [below=of c12] (c13) {Choosing color};
\node [below=of c13] (c14) {Adding shading};

\node [below=of c2, xshift=15pt] (c21) {El géneo rompe el concepto \emph{tradicional} del pensamiento binario de hombre y mujeres};
\node [below=of c21] (c22) {También rompe los estígmas de que solamente existe la heterosexualidad};
\node [below=of c22] (c23) {Absolutely};
\node [below=of c23] (c24) {Using overlays};

\node [below=of c3, xshift=15pt] (c31) {Default arrows};
\node [below=of c31] (c32) {Arrow library};
\node [below=of c32] (c33) {Resizing tips};
\node [below=of c33] (c34) {Shortening};
\node [below=of c34] (c35) {Bending};

\node [below=of c4, xshift=15pt] (c41) {Default arrows};
\node [below=of c41] (c42) {Arrow library};
\node [below=of c42] (c43) {Resizing tips};
\node [below=of c43] (c44) {Shortening};
\node [below=of c44] (c45) {Bending};
\end{scope}
% lines from each level 1 node to every one of its "children"
\foreach \value in {1,2,3,4}
  {\draw[->] (c1.195) |- (c1\value.west);}
%
\foreach \value in {1,...,4}
  {\draw[->] (c2.195) |- (c2\value.west);}
%
\foreach \value in {1,...,5}
  {\draw[->] (c3.195) |- (c3\value.west);}
%  
\foreach \value in {1,...,5}
 { \draw[->] (c4.195) |- (c4\value.west);}
% 

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容