![在多行单元格上添加单元格之间的行分割线](https://linux22.com/image/475490/%E5%9C%A8%E5%A4%9A%E8%A1%8C%E5%8D%95%E5%85%83%E6%A0%BC%E4%B8%8A%E6%B7%BB%E5%8A%A0%E5%8D%95%E5%85%83%E6%A0%BC%E4%B9%8B%E9%97%B4%E7%9A%84%E8%A1%8C%E5%88%86%E5%89%B2%E7%BA%BF.png)
我想在D,E,F,G
单元格之间添加水平分割线。我尝试\hline
在末尾添加,但它会分割整条线。多行单元格C
不应分割。
\documentclass{standalone}
\usepackage{tikz}
\usepackage{multirow}
\begin{document}
\begin{tikzpicture}[font=\tiny]
\node[] (A) {
\begin{tabular}{|c|c|} \hline
\multicolumn{2}{|c|}{{A}} \\ \hline
\multicolumn{2}{|c|}{{B}} \\ \hline
\multirow{4}{*}{C} & D \\
& E \\
& F \\
& G \\ \hline
\end{tabular}
};
\end{tikzpicture}
\end{document}
答案1
如果你对强大的tabularray
\documentclass[border=1pt]{standalone}
\usepackage{tikz}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\begin{tikzpicture}[font=\tiny]
\node (A) {
\begin{tblr}{
colspec = {|c|c|},
row{1-2} = {font=\bfseries},
hlines,
}
\SetCell[c=2]{c} A \\
\SetCell[c=2]{c} B \\
\SetCell[r=4]{c} C & D \\
& E \\
& F \\
& G \\
\end{tblr}
};
\end{tikzpicture}
\end{document}