我使用 tikz 中的 node/child 创建一棵树,如下所示。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzstyle{nodestyle} = [circle,draw,minimum size=5pt]
\node [nodestyle, inner sep=0pt] {$A|_{\aleph_0}$}
child {node {$\vdots$}
child {node [nodestyle, inner sep=4pt] (b1) {$S$}
child {node [nodestyle,inner sep=0pt] {$\{X_1\}$}
child {node [nodestyle, inner sep=1pt] {$X_1$}}}
child {node [nodestyle,inner sep=1pt] (e) {$X_2$}}}
}
child {node {$\vdots$}
child {node [nodestyle, inner sep=2pt] (b3) {$X_1$}}}
child {node {$\cdots\cdots$}}
child {node {$\vdots$}
child {node [nodestyle, inner sep=2pt] (an) {$X_n$}}
};
\end{tikzpicture}
\end{document}
现在我想删除 child 中 \cdots 上方的分支。我该怎么做?谢谢。
答案1
我相信你会找到更好的解决方案(等待其他答案),但这里有一个快速破解:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
%\tikzstyle{nodestyle} = [circle,draw,minimum size=5pt] REPLACED WITH CODE BELOW AFTER @cfr's COMMENT
\tikzset{nodestyle/.style={circle,draw,minimum size=5pt}}
\node [nodestyle, inner sep=0pt] {$A|_{\aleph_0}$}
child {node {$\vdots$}
child {node [nodestyle, inner sep=4pt] (b1) {$S$}
child {node [nodestyle,inner sep=0pt] {$\{X_1\}$}
child {node [nodestyle, inner sep=1pt] {$X_1$}}}
child {node [nodestyle,inner sep=1pt] (e) {$X_2$}}}
}
child {node {$\vdots$}
child {node [nodestyle, inner sep=2pt] (b3) {$X_1$}}}
child[opacity=0] {node[opacity=1] {$\cdots\cdots$}}
child {node {$\vdots$}
child {node [nodestyle, inner sep=2pt] (an) {$X_n$}}
};
\end{tikzpicture}
\end{document}
输出:
我刚刚给子节点添加了零不透明度,并为其节点添加了一个不透明度
编辑:
我也在这里找到了解决方案:tikz 树:如何不绘制单个边缘
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
%\tikzstyle{nodestyle} = [circle,draw,minimum size=5pt] REPLACED WITH CODE BELOW AFTER @cfr's COMMENT
\tikzset{nodestyle/.style={circle,draw,minimum size=5pt}}
\node [nodestyle, inner sep=0pt] {$A|_{\aleph_0}$}
child {node {$\vdots$}
child {node [nodestyle, inner sep=4pt] (b1) {$S$}
child {node [nodestyle,inner sep=0pt] {$\{X_1\}$}
child {node [nodestyle, inner sep=1pt] {$X_1$}}}
child {node [nodestyle,inner sep=1pt] (e) {$X_2$}}}
}
child {node {$\vdots$}
child {node [nodestyle, inner sep=2pt] (b3) {$X_1$}}}
child{node{$\cdots\cdots$} edge from parent[draw=none]}
child {node {$\vdots$}
child {node [nodestyle, inner sep=2pt] (an) {$X_n$}}
};
\end{tikzpicture}
\end{document}
这会使你的问题重复