定位树

定位树

我画了一棵简单的树。但是这段代码创建了一棵左对齐的树。我怎样才能将整棵树置于中心?

\documentclass[12pt]{article}
\usepackage{gb4e}
\usepackage{amsmath}
\noautomath
\usepackage{tikz-qtree,tikz-qtree-compat}    
\title{This is the title}

    \begin{document}
    \maketitle

    \begin{tikzpicture}[level 1/.style={level distance=1.5cm}]
    \label{Figure1}
    \Tree 
    [.S 
      [.NP  [.PRP He ] ]
        [.VP
             [.VB ate ] 
              [.NP 
               [.DT some  ]                  
               [.NN pancakes ]                       
              ]
        ]
    ]
    \end{tikzpicture}
    This is the content of this document.

    \end{document}

答案1

您可以使用\centering\begin{center}...\end{center}将树置于中心:

\documentclass[12pt]{article}
\usepackage{gb4e}
\usepackage{amsmath}
\noautomath
\usepackage{tikz-qtree,tikz-qtree-compat}
\title{This is the title}

    \begin{document}
    \maketitle
    {\centering   %%<---- added
    \begin{tikzpicture}[level 1/.style={level distance=1.5cm}]
    \label{Figure1}
    \Tree
    [.S
      [.NP  [.PRP He ] ]
        [.VP
             [.VB ate ]
              [.NP
               [.DT some  ]
               [.NN pancakes ]
              ]
        ]
    ]
    \end{tikzpicture}
    \par
    }
    This is the content of this document.

    \end{document}

在此处输入图片描述

相关内容