拆分表格单元格的最佳方法是什么,如下所示:
| Header1 | Header2| Header3 |
----------------------------------
| text11 | text12 | text13 |
----------------------------------
| text21 | text22 | text23 |
----------------------------------
| |t311 |text312 | text313 |
| text31| | | |
| |t312 |text322 | text323 |
谢谢
答案1
这是你想要的吗?
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{| l | l | c | c |}
\hline
\multicolumn{2}{|l|}{Header1} & Header2 & Header3 \\
\hline
\multicolumn{2}{|l|}{text11} & text12 & text13 \\
\hline
\multicolumn{2}{|l|}{text21} & text22 & text23 \\
\hline
\multirow{2}*{text31} & t311 &text312 & text313 \\
& t312 & text322 & text323 \\
\hline
\end{tabular}
\end{document}
答案2
{NiceTabular}
下面显示了如何使用 制作表格nicematrix
。
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{NiceTabular}{llcc}[hvlines]
\Block{1-2}{Header1} & & Header2 & Header3 \\
\Block{1-2}{text11} & & text12 & text13 \\
\Block{1-2}{text21} & & text22 & text23 \\
\Block{2-1}{text31} & t311 & text312 & text313 \\
& t312 & text322 & text323 \\
\end{NiceTabular}
\end{document}