表格中垂直居中的列分隔符

表格中垂直居中的列分隔符

我想在 中垂直居中自定义列分隔符tabular。我试过

 \begin{tabular}{c @{ $\vcenter{\rightarrow}$ } c @{ $\vcenter{\rightarrow}$ } c}...\end{tabular}

无济于事。其他搜索导致的答案指向如何在列内垂直居中内容,但没有指向实际的列分隔符本身。我的最小工作示例产生了以下结果:

最小工作示例视觉

而我想要的是(大约)这个:

在此处输入图片描述

与往常一样,如果您知道没有使用tabular或与我的实现有很大不同的解决方案,欢迎提出。也许我应该不使用列分隔符,而只是垂直居中所有列。

这是我的最小工作示例:

\documentclass[letterpaper]{article}
\usepackage{tikz}
\usepackage[letterpaper, top=2.54cm, bottom=2.54cm, left=2.54cm, right=2.54cm]{geometry}

\begin{document}

\begin{tabular}{c @{ $\rightarrow$ } c @{ $\rightarrow$ } c}

\begin{tikzpicture}[level/.style={level distance=8mm,sibling distance=25mm/#1}]
\node [circle,draw]{17} 
child {node [circle,draw] {9}
    child {node [circle,draw] {7}
        child {node [circle,draw] {3}}
        child {node [circle,draw] {4}}
        }
    child {node [circle,draw] {7}
        child {node [circle,draw] {13}}
        }
    }
child {node [circle,draw] {12}
    child {node [circle,draw] {9}}
    child {node [circle,draw] {5}}
    };
\end{tikzpicture} & 

\begin{tikzpicture}[level/.style={level distance=8mm,sibling distance=25mm/#1}]
\node [circle,draw]{17} 
child {node [circle,draw] {9}
    child {node [circle,draw] {7}
        child {node [circle,draw] {3}}
        child {node [circle,draw] {4}}
        }
    child {node [circle,draw] {13}
        child {node [circle,draw] {7}}
        }
    }
child {node [circle,draw] {12}
    child {node [circle,draw] {9}}
    child {node [circle,draw] {5}}
    };
\end{tikzpicture} &

\begin{tikzpicture}[level/.style={level distance=8mm,sibling distance=25mm/#1}]
\node [circle,draw]{17} 
child {node [circle,draw] {13}
    child {node [circle,draw] {7}
        child {node [circle,draw] {3}}
        child {node [circle,draw] {4}}
        }
    child {node [circle,draw] {9}
        child {node [circle,draw] {7}}
        }
    }
child {node [circle,draw] {12}
    child {node [circle,draw] {9}}
    child {node [circle,draw] {5}}
    };
\end{tikzpicture} \\

[17,9,12,7,7,9,5,3,4,13] & [17,9,12,7,13,9,5,3,4,7] & [17,13,12,7,9,9,5,3,4,7] \\

\end{tabular}

\end{document}

答案1

添加为所有s 的baseline={(current bounding box.center)}选项tikzpicture

\begin{tikzpicture}[baseline={(current bounding box.center)},level...

代码:

\documentclass[letterpaper]{article}
\usepackage{tikz}
\usepackage[letterpaper, top=2.54cm, bottom=2.54cm, left=2.54cm, right=2.54cm]{geometry}

\begin{document}

\begin{tabular}{c @{ $\rightarrow$ } c @{ $\rightarrow$ } c}

\begin{tikzpicture}[baseline={(current bounding box.center)},level/.style={level distance=8mm,sibling distance=25mm/#1}]
\node [circle,draw]{17}
child {node [circle,draw] {9}
    child {node [circle,draw] {7}
        child {node [circle,draw] {3}}
        child {node [circle,draw] {4}}
        }
    child {node [circle,draw] {7}
        child {node [circle,draw] {13}}
        }
    }
child {node [circle,draw] {12}
    child {node [circle,draw] {9}}
    child {node [circle,draw] {5}}
    };
\end{tikzpicture} &

\begin{tikzpicture}[baseline={(current bounding box.center)},level/.style={level distance=8mm,sibling distance=25mm/#1}]
\node [circle,draw]{17}
child {node [circle,draw] {9}
    child {node [circle,draw] {7}
        child {node [circle,draw] {3}}
        child {node [circle,draw] {4}}
        }
    child {node [circle,draw] {13}
        child {node [circle,draw] {7}}
        }
    }
child {node [circle,draw] {12}
    child {node [circle,draw] {9}}
    child {node [circle,draw] {5}}
    };
\end{tikzpicture} &

\begin{tikzpicture}[baseline={(current bounding box.center)},level/.style={level distance=8mm,sibling distance=25mm/#1}]
\node [circle,draw]{17}
child {node [circle,draw] {13}
    child {node [circle,draw] {7}
        child {node [circle,draw] {3}}
        child {node [circle,draw] {4}}
        }
    child {node [circle,draw] {9}
        child {node [circle,draw] {7}}
        }
    }
child {node [circle,draw] {12}
    child {node [circle,draw] {9}}
    child {node [circle,draw] {5}}
    };
\end{tikzpicture} \\

[17,9,12,7,7,9,5,3,4,13] & [17,9,12,7,13,9,5,3,4,7] & [17,13,12,7,9,9,5,3,4,7] \\

\end{tabular}

\end{document}

在此处输入图片描述

相关内容