\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\begin{document}
\begin{tikzpicture}
\tikzset{grow'=right,level distance=32pt}
\tikzset{execute at begin node=\strut}
\tikzset{every tree node/.style={anchor=base west}}
\Tree [.S [.NP [.Det the ] [.N cat ] ]
[.VP [.V sat ]
[.PP [.P on ]
[.NP [.Det the ] [.N mat ] ] ] ] ]
\end{tikzpicture}
\end{document}
答案1
将以下内容添加到您的代码中:
\tikzset{edge from parent/.style=
{draw,
edge from parent path={(\tikzparentnode.east)
-- +(8pt,0)
|- (\tikzchildnode)}}}
梅威瑟:
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\tikzset{edge from parent/.style=
{draw,
edge from parent path={(\tikzparentnode.east)
-- +(8pt,0)
|- (\tikzchildnode)}}}
\begin{document}
\begin{tikzpicture}
\tikzset{grow'=right,level distance=32pt}
\tikzset{execute at begin node=\strut}
\tikzset{every tree node/.style={anchor=base west}}
\Tree [.S [.NP [.Det the ] [.N cat ] ]
[.VP [.V sat ]
[.PP [.P on ]
[.NP [.Det the ] [.N mat ] ] ] ] ]
\end{tikzpicture}
\end{document}