答案1
人们通常希望将 的基线tikzpicture
置于 中心的正常大小节点的基线处tikzpicture
,否则上下空间将不对称。此处方可制成样式。
\documentclass{article}
\usepackage{tikz}
\tikzset{
op/.style = {shape=rectangle, rounded corners, draw=black, align=center,
fill=blue!30},base align tikzpicture/.style={execute at end picture={
\path (current bounding box.north) -- (current bounding box.south)
node[midway](Xphantom){\phantom{X}};},baseline={(Xphantom.base)}}
}
\begin{document}
Si A est l'arbre
\begin{tikzpicture}[base align tikzpicture]
\node [op] {'+'}
child { node {B} } child { node {C} };
\end{tikzpicture}, alors d\'erivee(A) est l'arbre
\end{document}
答案2
\documentclass{article}
\usepackage{tikz}
\tikzset{
op/.style = {box/.style = {draw, rounded corners, fill=blue!30},
level distance=9mm, sibling distance=9mm,
baseline = (current bounding box.center)}
}
\begin{document}
Si A est l'arbre
\begin{tikzpicture}[op]
\node [box] {'+'}
child { node {B} } child { node {C} };
\end{tikzpicture}
, alors dérivee(A) est l'arbre
\end{document}