图中树未居中

图中树未居中

虽然图表似乎居中(如标题所示),但里面的树却不是。树越窄,它的位置就越靠右。有什么想法吗?

在此处输入图片描述

这是我的代码

\documentclass[oneside,11pt,titlepage,a4paper,american,bibliography=totocnumbered,listof=numbered]{scrbook}
\usepackage{tree-dvips}
\usepackage{qtree}
\usepackage{newfloat}
\begin{document}

\begin{diagram}[!ht]
  \begin{center}
  \Tree [.Root 
      [.\node{I}{Internal} Research Sales ]
      [.\node{T}{TU Berlin} Research ]
      [.\node{C}{Charite} Research Sales ]
      [.\node{D}{...} Research Sales ]]
  \caption{A Purpose Graph with Multiple Relevant Utilizer Distinctions}
  \label{dia:mixed_tree}
  \end{center}
\end{diagram}

In contrast, using a clear distinction of purposes and utilizers, we end up with a much more well-structured set of trees with less duplicates (as seen in diagrams \ref{dia:split_tree_purpose} and \ref{dia:split_tree_utilizer}):

\vspace*{0.5cm}

\begin{diagram}[!ht]
  \begin{center}
  \Tree [.Root 
      [.\node{M}{Medical} Research Sales ]]
  \caption{A Purpose Tree in a Model with Separate Purpose and Utilizer Trees}
  \label{dia:split_tree_purpose}
  \end{center}
\end{diagram}

\begin{diagram}[!ht]
  \begin{center}
  \Tree [.Root Internal 
      [.\node{U}{Universities} \node{B}{TU Berlin} Charite ]
      [.Hospitals \node{C}{Charite} ]]
  \caption{A Utilizer Tree in a Model with Separate Purpose and Utilizer Trees}
  \label{dia:split_tree_utilizer}
  \end{center}
\end{diagram}
\end{document}

答案1

正如艾伦在没有 \node宏的情况下所建议的那样:

\documentclass{article}
\usepackage{tikz-qtree}
\usepackage{float}
\newfloat{diagram}{!ht}{grm}\floatname{diagram}{Diagram}
\usepackage[labelfont=bf]{caption}
\begin{document}

\begin{diagram}
\centering
\Tree [.Root 
          [.{Internal} Research Sales ]
          [.{TU Berlin} Research ]
          [.{Charite} Research Sales ]
          [.{...} Research Sales ]]
\caption{A Purpose Graph with Multiple Relevant Utilizer Distinctions}
\label{dia:mixed_tree}
\end{diagram}

In contrast, using a clear distinction of purposes and utilizers, we end up with a much more well-structured 
set of trees with less duplicates (as seen in diagrams \ref{dia:split_tree_purpose} and 
\ref{dia:split_tree_utilizer}):

\bigskip
\begin{diagram}
\centering
\Tree [.Root 
          [.{Medical} Research Sales ]]
\caption{A Purpose Tree in a Model with Separate Purpose and Utilizer Trees}
\label{dia:split_tree_purpose}
\end{diagram}

\begin{diagram}
\centering
\Tree [.Root Internal 
          [.{Universities} {TU Berlin} Charite ]
          [.Hospitals {Charite} ]]
\caption{A Utilizer Tree in a Model with Separate Purpose and Utilizer Trees}
\label{dia:split_tree_utilizer}
\end{diagram}

\end{document}

在此处输入图片描述

答案2

我不知道它diagram是如何定义的。但是,我想forest在这里打个广告,推荐\centering一下center环境,而不是添加\vspaces。

\documentclass{article}
\usepackage{forest}
\begin{document}
\newenvironment{diagram}[1][]{\begingroup\renewcommand{\figurename}{Diagram}%
\begin{figure}[#1]}{
\end{figure}\endgroup}
\begin{diagram}[!ht]
\centering
\begin{forest}
for tree={parent anchor=south}
[Root
    [Internal
          [Research]
          [Sales] 
    ]
    [TU Berlin
        [Research] 
    ]
    [Charite 
          [Research]
          [Sales] 
    ]
    [\dots 
          [Research]
          [Sales] 
    ]
]
\end{forest}
\caption{A Purpose Graph with Multiple Relevant Utilizer Distinctions.}
\label{dia:mixed_tree}
\end{diagram}

In contrast, using a clear distinction of purposes and utilizers, we end up with
a much more well-structured set of trees with less duplicates (as seen in
diagrams \ref{dia:split_tree_purpose} and \ref{dia:split_tree_utilizer}).

\begin{diagram}[!ht]
\centering
\begin{forest}
for tree={parent anchor=south}
[Root 
    [Medical
          [Research]
          [Sales] 
    ]
]
\end{forest}
\caption{A Purpose Tree in a Model with Separate Purpose and Utilizer Trees.}
\label{dia:split_tree_purpose}
\end{diagram}

\begin{diagram}[!ht]
\centering
\begin{forest}
for tree={parent anchor=south}
[Root 
    [Internal]
    [Universities
        [TU Berlin]
        [Charite]
    ]       
    [Hospitals 
        [Charite] 
    ]
]
\end{forest}
\caption{A Utilizer Tree in a Model with Separate Purpose and Utilizer Trees.}
\label{dia:split_tree_utilizer}
\end{diagram}
\end{document}

在此处输入图片描述

上面的代码是所谓的 MWE,即以 开始\documentclass,以 结束\end{document}并加载所有必要的包。

相关内容