我正在使用数组创建 Latex 表,下面提到了示例表之一,其中合并了多行单元格。
你能帮助我理解吗,如何合并数组中的行?下面提到了带有数组的示例 Latex 表;
\[\begin{array}{*{20}{|c}}
\hline
{{\text{Differentiation}}} & {{\text{Integration}}} & {} \\
{{\text{The problem of finding SLOPE}}} & {} & {} \\
{} & {{\text{Leibnitz}}} & {{\text{Archimedes}}} \\
a & b & c \\
d & e & f \\
g & h & i \\
j & k & l \\
m & n & o \\
\hline
\end{array} \]
答案1
这可能是您的起点。我创建了一种新的列类型P
,这使得在文本块的宽度上分布列变得更容易,因为使用此解决方案,n
列的宽度应该加起来为1
而不是1-n*\tabcolsep
。
\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{booktabs,array}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{\dimexpr#1\linewidth-2\tabcolsep}}
\begin{document}
\begin{table}
\centering
\begin{tabular}{P{0.3}P{0.35}P{0.35}}
\toprule
Differentiation & \multicolumn{2}{c}{Integration} \\
\midrule
Slope & \multicolumn{2}{l}{Area} \\
& Leibnitz & Archimedes, Eudoxus, others \\
& Anti Deri & Area \\
& Test 1 & Test 2 \\
& Indefinite Integral & Definite Integral \\[\baselineskip]
& \multicolumn{2}{c}{Together constitutes Integral Calculus} \\
\midrule
Derivative of a polynomial function decreases its degree by 1 & \multicolumn{2}{p{0.5\textwidth}}{Integral of a polynomial function increases its degree by 1} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}