当我创建一个大的树的使用tikz-qtree
,发现部分子节点无法显示。
这是我的代码:
\documentclass{article}
\usepackage[active,tightpage]{preview}
\renewcommand{\PreviewBorder}{1cm}
\usepackage{geometry}
\geometry{
textwidth = 80em
}
\usepackage{tikz}
\usepackage{tikz-qtree}
\def\pgfname{\textsc{pgf}}
\def\tikzname{Ti\emph{k}Z}
\begin{document}
\begin{preview}
\begin{tikzpicture}[grow'=right, sibling distance=4ex]
\tikzstyle{level 1} = [level distance= 20em]
\tikzstyle{level 2} = [level distance= 28em]
\tikzstyle{level 3} = [level distance= 30em]
\tikzstyle{edge from parent} = [draw, edge from parent path={(\tikzchildnode.west) -- ++(-2em,0) |- (\tikzparentnode.east)}]
% \tikzstyle{edge from parent} = [draw, edge from parent fork right]
\tikzstyle{nd0} = [draw=black, minimum width=8em, text width=10em, align=center]
\tikzstyle{nd1} = [draw=black, minimum width=8em, text width=20em, align=center]
\tikzstyle{nd2} = [draw=black, minimum width=8em, text width=26em, align=left]
\tikzstyle{every tree node} = [fill=red!30, font=\bfseries]
\tikzstyle{done} = [fill=green!30]
\tikzstyle{doing} = [fill=cyan!30]
\tikzstyle{not} = [fill=red!30]
\Tree
% [ .\node [nd0, doing] {\tikzname\ \& PGF \\ \pgfversion\ \\ 中文手册};
[ .\node [nd0, doing] {\tikzname\ \& PGF \\ \pgfversion};
[ . \node [nd1, doing] {Introduction};
[ . \node [nd2, done] {The Layers Below \tikzname}; ]
[ . \node [nd2, doing] {Comparison with Other Graphics Packages}; ]
[ . \node [nd2, not] {Utility Packages}; ]
[ . \node [nd2, not] {How to Read This Manual}; ]
[ . \node [nd2, not] {Authors and Acknowledgements}; ]
[ . \node [nd2, not] {Getting Help}; ]
]
[ . \node [nd1] {Tutorials and Guidelines};
[ . \node [nd2] {Tutorial: A Picture for Karl's Students}; ]
[ . \node [nd2] {Tutorial: A Petri-Net for Hagen}; ]
[ . \node [nd2] {Tutorial: Euclid's Amber Version of the Elements}; ]
[ . \node [nd2] {Tutorial: Diagrams as Simple Graphs}; ]
[ . \node [nd2] {Tutorial: A Lecture Map for Johannes}; ]
[ . \node [nd2] {Tutorial: Guidelines on Graphics}; ]
]
[ . \node [nd1] {Installation and Configurations};
[ . \node [nd2] {Installation}; ]
[ . \node [nd2] {Licenses and Copyright}; ]
[ . \node [nd2] {Supported Formats}; ]
]
[ . \node [nd1] {Ti\emph{k}Z ist \emph{kein} Zeichenprogramm};
[ . \node [nd2] {Design Principles}; ]
[ . \node [nd2] {Hierarchical Structures: \\ Package, Environments, Scopes, and Styles}; ]
[ . \node [nd2] {Specifying Coordinates}; ]
[ . \node [nd2] {Syntax for Path Specifications}; ]
[ . \node [nd2] {Actions on Paths}; ]
[ . \node [nd2] {Arrows}; ]
[ . \node [nd2] {Nodes and Edges}; ]
[ . \node [nd2] {Pics: Small Pictures on Paths}; ]
[ . \node [nd2] {Specifying Graphs}; ]
[ . \node [nd2] {Matrices and Alignment}; ]
[ . \node [nd2] {Making Trees Grow}; ]
[ . \node [nd2] {Plots of Functions}; ]
[ . \node [nd2] {Transparency}; ]
[ . \node [nd2] {Decorated Paths}; ]
[ . \node [nd2] {Transformations}; ]
]
[ . \node [nd1] {Graph Drawing};
[ . \node [nd2] {Introduction to Algorithmic Graph Drawing}; ]
[ . \node [nd2] {Using Graph Drawing in \tikzname}; ]
[ . \node [nd2] {Using Graph Drawing in PGF}; ]
[ . \node [nd2] {Graph Drawing Layouts: Trees}; ]
[ . \node [nd2] {Graph Drawing Algorithms: Layered Layouts}; ]
[ . \node [nd2] {Graph Drawing Algorithms: Force-Based Methods}; ]
[ . \node [nd2] {Graph Drawing Algorithms: Circular Layouts}; ]
[ . \node [nd2] {Graph Drawing Layouts: Phylogenetic Trees}; ]
[ . \node [nd2] {Graph Drawing Algorithms: Edge Routing}; ]
[ . \node [nd2] {The Algorithm Layer}; ]
[ . \node [nd2] {Writing Graph Drawing Algorithms in C}; ]
[ . \node [nd2] {The Display Layer}; ]
[ . \node [nd2] {The Binding Layer}; ]
]
[ . \node [nd1] {Libraries};
[ . \node [nd2] {Angle Library}; ]
[ . \node [nd2] {Arrow Tip Library}; ]
[ . \node [nd2] {Automata Drawing Library}; ]
[ . \node [nd2] {Babel Library}; ]
[ . \node [nd2] {Background Library}; ]
[ . \node [nd2] {Calc Library}; ]
[ . \node [nd2] {Calendar Library}; ]
[ . \node [nd2] {Chains}; ]
[ . \node [nd2] {Circuit Libraries}; ]
[ . \node [nd2] {Decoration Library}; ]
[ . \node [nd2] {Entity-Relationship Diagram Drawing Library}; ]
[ . \node [nd2] {Externalization Library}; ]
[ . \node [nd2] {Fading Library}; ]
[ . \node [nd2] {Fitting Library}; ]
[ . \node [nd2] {Fixed Point Arithmetic Library}; ]
[ . \node [nd2] {Floating Point Unit Library}; ]
[ . \node [nd2] {Lindenmayer System Drawing Library}; ]
[ . \node [nd2] {Math Library}; ]
[ . \node [nd2] {Matrix Library}; ]
[ . \node [nd2] {Mindmap Drawing Library}; ]
[ . \node [nd2] {Paper Folding Diagrams Library}; ]
[ . \node [nd2] {Pattern Library}; ]
[ . \node [nd2] {Petri-Net Drawing Library}; ]
[ . \node [nd2] {Plot Handler Library}; ]
[ . \node [nd2] {Plot Mark Library}; ]
[ . \node [nd2] {Profiler Library}; ]
[ . \node [nd2] {Shadings Library}; ]
[ . \node [nd2] {Shadows Library}; ]
[ . \node [nd2] {Shape Library}; ]
[ . \node [nd2] {Spy Library: Magnifying Parts of Pictures}; ]
[ . \node [nd2] {SVG-Path Library}; ]
[ . \node [nd2] {To Path Library}; ]
[ . \node [nd2] {Through Library}; ]
[ . \node [nd2] {Tree Library}; ]
[ . \node [nd2] {Turtle Graphics Library}; ]
]
[ . \node [nd1] {Data Visualization};
[ . \node [nd2] {Introduction to Data Visualization}; ]
[ . \node [nd2] {Creating Data Visualizations}; ]
[ . \node [nd2] {Providing Data for a Data Visualization}; ]
[ . \node [nd2] {Axes}; ]
[ . \node [nd2] {Visualizers}; ]
[ . \node [nd2] {Style Sheets and Legends}; ]
[ . \node [nd2] {Polar Axes}; ]
[ . \node [nd2] {The Data Visualization Backend}; ]
]
[ . \node [nd1] {Utilities};
[ . \node [nd2] {Key Management}; ]
[ . \node [nd2] {Repeating Things: The Foreach Statement}; ]
[ . \node [nd2] {Date and Calendar Utility Macros}; ]
[ . \node [nd2] {Page Management}; ]
[ . \node [nd2] {Extended Color Support}; ]
[ . \node [nd2] {Parser Module}; ]
]
[ . \node [nd1] {Mathematical and Objected Engines};
[ . \node [nd2] {Design Principles}; ]
[ . \node [nd2] {Mathematical Expressions}; ]
[ . \node [nd2] {Additional Mathematical Commands}; ]
[ . \node [nd2] {Customizing the Mathematical Engine}; ]
[ . \node [nd2] {Number Printing}; ]
[ . \node [nd2] {Object-Oriented Programming}; ]
]
[ . \node [nd1] {The Basic Layer};
[ . \node [nd2] {Design Principles}; ]
[ . \node [nd2] {Hierarchical Structures: \\ Package, Environments, Scopes, and Text}; ]
[ . \node [nd2] {Specifying Coordinates}; ]
[ . \node [nd2] {Constructing Paths}; ]
[ . \node [nd2] {Decorations}; ]
[ . \node [nd2] {Using Paths}; ]
[ . \node [nd2] {Defining New Arrow Tip Kinds}; ]
[ . \node [nd2] {Nodes and Shapes}; ]
[ . \node [nd2] {Matrices}; ]
[ . \node [nd2] {Coordinate, Canvas, and Nonlinear Transformations}; ]
[ . \node [nd2] {Patterns}; ]
[ . \node [nd2] {Declaring and Using Images}; ]
[ . \node [nd2] {Externalizing Graphics}; ]
[ . \node [nd2] {Creating Plots}; ]
[ . \node [nd2] {Layered Graphics}; ]
[ . \node [nd2] {Shadings}; ]
[ . \node [nd2] {Transparency}; ]
[ . \node [nd2] {Adding libraries to PGF: temporary registers}; ]
[ . \node [nd2] {Quick Commands}; ]
]
[ . \node [nd1] {The System Layer};
[ . \node [nd2] {Design of the System Layer}; ]
[ . \node [nd2] {Commands of the System Layer}; ]
[ . \node [nd2] {The Soft Path Subsystem}; ]
[ . \node [nd2] {The Protocol Subsystem}; ]
]
[ . \node [nd1, done] {References and Index}; ]
]
\end{tikzpicture}
\end{preview}
\end{document}
编译命令是latexmk -pv -xelatex test.tex
请注意,在输出中,没有显示“Libraries”的多个子节点。经过更多测试,我发现当前父节点显示的子节点数量取决于其他父节点的子节点数量和父节点的顺序。这真的很奇怪。
我猜测这个问题可能与某些内部数字限制有关。
放大以更清楚地查看细节:
答案1
\tiny
如果在树之前使用,则所有节点都会出现。另一个选项是你的答案笔记,是从XeTeX切换到pdfTeX作为引擎。
如果您需要使用 XeTeX 并且不想减小字体大小,第三个选择是forest
:
\documentclass[border=10pt]{standalone}
\usepackage[edges]{forest}
\newcommand\pgfname{\textsc{pgf}}
\newcommand\tikzname{Ti\emph{k}Z}
\tikzset{
nd0/.style={draw=black, minimum width=8em, text width=10em, align=center},
nd1/.style={draw=black, minimum width=8em, text width=20em, align=center},
nd2/.style={draw=black, minimum width=8em, text width=26em, align=left},
every tree node/.style={fill=red!30, font=\bfseries},
done/.style={fill=green!30},
doing/.style={fill=cyan!30},
not/.style={fill=red!30},
}
\begin{document}
\begin{forest}
for tree={every tree node, folder, grow'=0}
[\tikzname\ \& PGF\\\pgfversion, nd0, doing
[Introduction, nd1, doing
[The Layers Below \tikzname, nd2, done]
[Comparison with Other Graphics Packages, nd2, doing]
[Utility Packages, nd2, not]
[How to Read This Manual, nd2, not]
[Authors and Acknowledgements, nd2, not]
[Getting Help, nd2, not]
]
[Tutorials and Guidelines, nd1
[Tutorial: A Picture for Karl's Students, nd2]
[Tutorial: A Petri-Net for Hagen, nd2]
[Tutorial: Euclid's Amber Version of the Elements, nd2]
[Tutorial: Diagrams as Simple Graphs, nd2]
[Tutorial: A Lecture Map for Johannes, nd2]
[Tutorial: Guidelines on Graphics, nd2]
]
[Installation and Configurations, nd1
[Installation, nd2]
[Licenses and Copyright, nd2]
[Supported Formats, nd2]
]
[Ti\emph{k}Z ist \emph{kein} Zeichenprogramm, nd1
[Design Principles, nd2]
[Hierarchical Structures:\\{Package, Environments, Scopes, and Styles}, nd2]
[Specifying Coordinates, nd2]
[Syntax for Path Specifications, nd2]
[Actions on Paths, nd2]
[Arrows, nd2]
[Nodes and Edges, nd2]
[Pics: Small Pictures on Paths, nd2]
[Specifying Graphs, nd2]
[Matrices and Alignment, nd2]
[Making Trees Grow, nd2]
[Plots of Functions, nd2]
[Transparency, nd2]
[Decorated Paths, nd2]
[Transformations, nd2]
]
[Graph Drawing, nd1
[Introduction to Algorithmic Graph Drawing, nd2]
[Using Graph Drawing in \tikzname, nd2]
[Using Graph Drawing in PGF, nd2]
[Graph Drawing Layouts: Trees, nd2]
[Graph Drawing Algorithms: Layered Layouts, nd2]
[Graph Drawing Algorithms: Force-Based Methods, nd2]
[Graph Drawing Algorithms: Circular Layouts, nd2]
[Graph Drawing Layouts: Phylogenetic Trees, nd2]
[Graph Drawing Algorithms: Edge Routing, nd2]
[The Algorithm Layer, nd2]
[Writing Graph Drawing Algorithms in C, nd2]
[The Display Layer, nd2]
[The Binding Layer, nd2]
]
[Libraries, nd1
[Angle Library, nd2]
[Arrow Tip Library, nd2]
[Automata Drawing Library, nd2]
[Babel Library, nd2]
[Background Library, nd2]
[Calc Library, nd2]
[Calendar Library, nd2]
[Chains, nd2]
[Circuit Libraries, nd2]
[Decoration Library, nd2]
[Entity-Relationship Diagram Drawing Library, nd2]
[Externalization Library, nd2]
[Fading Library, nd2]
[Fitting Library, nd2]
[Fixed Point Arithmetic Library, nd2]
[Floating Point Unit Library, nd2]
[Lindenmayer System Drawing Library, nd2]
[Math Library, nd2]
[Matrix Library, nd2]
[Mindmap Drawing Library, nd2]
[Paper Folding Diagrams Library, nd2]
[Pattern Library, nd2]
[Petri-Net Drawing Library, nd2]
[Plot Handler Library, nd2]
[Plot Mark Library, nd2]
[Profiler Library, nd2]
[Shadings Library, nd2]
[Shadows Library, nd2]
[Shape Library, nd2]
[Spy Library: Magnifying Parts of Pictures, nd2]
[SVG-Path Library, nd2]
[To Path Library, nd2]
[Through Library, nd2]
[Tree Library, nd2]
[Turtle Graphics Library, nd2]
]
[Data Visualization, nd1
[Introduction to Data Visualization, nd2]
[Creating Data Visualizations, nd2]
[Providing Data for a Data Visualization, nd2]
[Axes, nd2]
[Visualizers, nd2]
[Style Sheets and Legends, nd2]
[Polar Axes, nd2]
[The Data Visualization Backend, nd2]
]
[Utilities, nd1
[Key Management, nd2]
[Repeating Things: The Foreach Statement, nd2]
[Date and Calendar Utility Macros, nd2]
[Page Management, nd2]
[Extended Color Support, nd2]
[Parser Module, nd2]
]
[Mathematical and Objected Engines, nd1
[Design Principles, nd2]
[Mathematical Expressions, nd2]
[Additional Mathematical Commands, nd2]
[Customizing the Mathematical Engine, nd2]
[Number Printing, nd2]
[Object-Oriented Programming, nd2]
]
[The Basic Layer, nd1
[Design Principles, nd2]
[Hierarchical Structures:\\{Package, Environments, Scopes, and Text}, nd2]
[Specifying Coordinates, nd2]
[Constructing Paths, nd2]
[Decorations, nd2]
[Using Paths, nd2]
[Defining New Arrow Tip Kinds, nd2]
[Nodes and Shapes, nd2]
[Matrices, nd2]
[{Coordinate, Canvas, and Nonlinear Transformations}, nd2]
[Patterns, nd2]
[Declaring and Using Images, nd2]
[Externalizing Graphics, nd2]
[Creating Plots, nd2]
[Layered Graphics, nd2]
[Shadings, nd2]
[Transparency, nd2]
[Adding libraries to PGF: temporary registers, nd2]
[Quick Commands, nd2]
]
[The System Layer, nd1
[Design of the System Layer, nd2]
[Commands of the System Layer, nd2]
[The Soft Path Subsystem, nd2]
[The Protocol Subsystem, nd2]
]
[References and Index, nd1, done]
]
\end{forest}
\end{document}
答案2
我最终通过反复试验找到了解决这个问题的方法。
替换编译命令
latexmk -pv -xelatex test.tex
到
latexmk -pv -pdf test.tex
不过,我还是不知道它为什么会起作用。