在对 tikz-qtree 进行了大量调整后,我最终得到了下面的结果。但我不知道为什么XML
节点后的级别距离太长,即使level distance
为该级别设置了,线条仍然又长又粗。
\documentclass[12pt]{paper}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
% tree
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{positioning,babel,trees}
\begin{document}
\begin{tikzpicture}[grow'=right,level distance=1.2in,sibling distance=.05in]
\tikzset{edge from parent/.style={thick, draw, edge from parent fork right},
every tree node/.style={draw,minimum width=1in,text width=1in,align=center},
level 1/.style={sibling distance=-40mm},
level 2/.style={level distance=10mm}}
\Tree [.SGML {HTML 4.0} [.\node(x) {XML}; [ XHTML XML DOM [.XSL XSLT XSL-FO XPath ] XQuery DTD XSD SOAP WSDL RDF RSS SVG ] ] ]
\end{tikzpicture}
\end{document}
编辑:.\node(x) {XML};
或者.XML
不做任何改变
答案1
如果你不介意更换软件包,你可以使用强大的forest
:
\documentclass[tikz,border=5pt]{standalone}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={
edge path={
\noexpand\path [draw, thick, \forestoption{edge}] (!u.parent anchor) -- +(5pt,0) |- (.child anchor)\forestoption{edge label};
},
parent anchor=east,
child anchor=west,
grow'=east,
text centered,
draw,
thick,
minimum width=1in,
text width=1in
}
[SGML [HTML 4.0] [XML [XHTML] [XML] [DOM] [XSL [XSLT] [XSL-FO] [XPath]] [XQuery] [DTD] [XSD] [SOAP] [WSDL] [RDF] [RSS] [SVG]]]
\end{forest}
\end{document}