我想要一个这样的光学元件,但没有划掉的分支。
我该怎么做?
\documentclass[border=10pt, tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[sibling distance=10em,
every node/.style = {shape=rectangle, rounded corners,
draw, align=center,
top color=white, bottom color=blue!20}]
\node {A0}
child { node {A1}
child{ node{A1.1}
child{ node{X} }
child[draw=none]{ }% no effect, problem here .............................
}
child{ node{A1.2}
}
};
\end{tikzpicture}
\end{document}
答案1
边缘的样式由 控制edge from parent
,draw
默认情况下如此。因此,
\documentclass[border=10pt, tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[sibling distance=10em,
every node/.style = {shape=rectangle, rounded corners,
draw, align=center,
top color=white, bottom color=blue!20}]
\node {A0}
child { node {A1}
child{ node{A1.1}
child{ node{X} }
child[draw=none, edge from parent/.style={}]{ }% no effect, problem here .............................
}
child{ node{A1.2}
}
};
\end{tikzpicture}
\end{document}
忽略边缘:
[我会使用forest
,但你的公里数可能会有所不同。]