我想重现 Knuth 的 MIX 单词的格式计算机编程艺术。本页第三张图片很好地说明了导致我出现问题的原因:
也就是说,在该图片中心的表格中,
|-|80|3|5|4|,
“80” 跨越了两个单元格。我怎样才能在 80 的“下方”创建部分垂直线?谢谢。
答案1
虽然不太好,但是确实有效:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{every picture/.append style = remember picture}
\newcommand{\myanchor}[1]{\tikz \node[coordinate] (#1) {};}
\usepackage{array} % used for setting extrarowheight
\begin{document}
\setlength\extrarowheight{1.5pt} % change to whatever font depth is
\begin{tabular}{*{6}{|c}|}
\hline
$ - $ & \myanchor{11} & \myanchor{12} & 3 & 5 & 4 \\
\hline
$ + $ & \myanchor{21} & \myanchor{22} & 3 & 5 & 4 \\
\hline
$ + $ & 0 & 0 & 3 & 5 & 4 \\
\hline
$ - $ & 0 & 0 & \myanchor{31} & \myanchor{32} & 3 \\
\hline
$ + $ & 0 & 0 & 0 & 0 & 5 \\
\hline
$ - $ & 0 & 0 & 0 & 0 & 0 \\
\hline
$ + $ & 0 & 0 & 0 & 0 & ? \\
\hline
\end{tabular}
\setlength\extrarowheight{0pt} % reset
\begin{tikzpicture}[overlay]
\foreach \tmp in {1,2,3} {
\node[
shape = rectangle,
inner sep = 2pt,
fill = white,
anchor = base,
] at ($(\tmp1)!0.5!(\tmp2)$) {80};
}
\end{tikzpicture}
\end{document}
结果: