1. 整体逻辑
整个table是由大小一致的单元格组成的,在这个基础上,我们通过合并单元格(行/列)的方式,实现整个table的设计:竖线用“|”,横线用“\cline“,列合并用”\multicolumn“,行合并用”\multirow“。
2. 实现步骤
从左到右逐行设计。
3. 2×2 Tabble
\usepackage{multirow} \begin{table}[] \centering \caption{My table} \begin{tabular}{|c|l|} \hline 1 & 2 \\ \hline 3 & 4 \\ \hline \end{tabular} \end{table}
\multicolumn 函数/标志符: {占用列数} {方框边界竖线|文字居左中右|方框边界竖线} {内容}
\usepackage{multirow} \begin{table}[] \centering \caption{My table} \begin{tabular}{|c|l|} \hline 1 & 2 \\ \hline \multicolumn{2}{|c|}{3} \\ \hline \end{tabular} \end{table}
\multirow 函数/标志符: {占用行数} {方框边界竖线|文字居左中右|方框边界竖线} {内容}
\cline 函数/标志符:画横线
\usepackage{multirow} \begin{table}[] \centering \caption{My table} \begin{tabular}{|c|l|} \hline \multirow{2}{*}{1} & 2 \\ \cline{2-2} & 4 \\ \hline \end{tabular} \end{table}
4. 2×3 Table
\usepackage{multirow} \begin{table}[] \centering \caption{My table} \begin{tabular}{|c|l|l|} \hline 1 & 2 & 3 \\ \hline 4 & 5 & 6 \\ \hline \multicolumn{1}{|l|}{7} & 8 & 9 \\ \hline \end{tabular} \end{table}
\multicolumn 函数/标志符: {占用列数} {方框边界竖线|文字居左中右|方框边界竖线} {内容}
\usepackage{multirow} \begin{table}[] \centering \caption{My table} \begin{tabular}{|c|l|l|} \hline 1 & 2 & 3 \\ \hline 4 & \multicolumn{2}{l|}{5} \\ \hline \multicolumn{1}{|l|}{7} & 8 & 9 \\ \hline \end{tabular} \end{table}
\multirow 函数/标志符: {占用行数} {方框边界竖线|文字居左中右|方框边界竖线} {内容}
\usepackage{multirow} \begin{table}[] \centering \caption{My table} \begin{tabular}{|c|l|l|} \hline 1 & 2 & 3 \\ \hline 4 & \multirow{2}{*}{5} & 6 \\ \cline{1-1} \cline{3-3} \multicolumn{1}{|l|}{7} & & 9 \\ \hline \end{tabular} \end{table}
5. A sample
\usepackage{multirow} \begin{table}[] \centering \caption{A transcript sample} \begin{tabular}{c|l|l|l} \hline \multirow{2}{*}{Subject} & \multicolumn{2}{c|}{Science} & Extracurricular \\ \cline{2-4} & Math & English & \multicolumn{1}{l}{Others} \\ \hline \multicolumn{1}{l|}{Score} & 95 & 93 & 90 \\ \hline \end{tabular} \end{table}
标签:Latex,begin,end,hline,tabular,multirow,详解,Table,table From: https://www.cnblogs.com/ltkekeli1229/p/16843194.html