今天搞了一晚上的这个multirow,总算弄出来了几个比较好的例子,主要是这个multirow的语法我没看懂,这个逻辑我是没理解,就很尴尬,一改就报错,只能先弄几个例子,自己慢慢试
\documentclass{article}
\usepackage{multirow,booktabs}
\usepackage{ctex}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%% 测试1 %%%%%%%%%%%%%%%%
\begin{center}
\begin{tabular}{@{} ll cccc r @{}}
\toprule
Student & Marker & \multicolumn{4}{c}{Essay} & Total \\
\cmidrule(lr){3-6}
& & Originality & Synthesis & Effort & Overall & \\
\midrule
\multirow{4}{*}{James} & Alice & 9 & 8 & 7 & 8.0 & \multirow{4}{*}{7.9}\\
& Amelia & 8 & 9 & 7 & 8.0 & \\
& Anton & 9 & 7 & 7 & 7.7 & \\
& Arthur & 7 & 8 & 8 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Janice} & Alice & 9 & 9 & 7 & 8.3 & \multirow{4}{*}{8.1}\\
& Amelia & 9 & 8 & 8 & 8.3 & \\
& Anton & 8 & 8 & 8 & 8.0 & \\
& Arthur & 7 & 9 & 7 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Julie} & Alice &10 & 9 &10 & 9.7 & \multirow{4}{*}{8.8}\\
& Amelia & 9 & 7 & 8 & 8.0 & \\
& Anton & 9 & 8 & 8 & 8.3 & \\
& Arthur & 9 &10 & 9 & 9.3 & \\
\bottomrule
\end{tabular}
\end{center}
%%%%%%%%%%%%%%%%%%% 测试2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{tabular}{@{} ll cccc r @{}}
\toprule
Student & Marker & \multicolumn{4}{c}{Essay} & Total \\
\cmidrule(lr){3-6}
& & Originality & Synthesis & Effort & Overall & \\
\midrule
\multirow{4}{*}{James} & \multirow{4}{*}{Alice} & 9 & 8 & 7 & 8.0 & \multirow{4}{*}{7.9}\\
& &8 & 9 & 7 & 8.0 & \\
& &9 & 7 & 7 & 7.7 & \\
& &7 & 8 & 8 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Janice} & Alice & 9 & 9 & 7 & 8.3 & \multirow{4}{*}{8.1}\\
& Amelia & 9 & 8 & 8 & 8.3 & \\
& Anton & 8 & 8 & 8 & 8.0 & \\
& Arthur & 7 & 9 & 7 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Julie} & Alice &10 & 9 &10 & 9.7 & \multirow{4}{*}{8.8}\\
& Amelia & 9 & 7 & 8 & 8.0 & \\
& Anton & 9 & 8 & 8 & 8.3 & \\
& Arthur & 9 &10 & 9 & 9.3 & \\
\bottomrule
\end{tabular}
\end{center}
%%%%%%%%%%%%%%%%%%%%%%%%% 测试3 %%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{tabular}{@{} ll cccc r @{}}
\toprule
Student & Marker & \multicolumn{4}{c}{Essay} & Total \\
\cmidrule(lr){3-6}
& & Originality & Synthesis & Effort & Overall & \\
\midrule
\multirow{4}{*}{James} & \multirow{4}{*}{Alice} & \multirow{4}{*}{Mike} & 8 & 7 & 8.0 & \multirow{4}{*}{7.9}\\
& & & 9 & 7 & 8.0 & \\
& & & 7 & 7 & 7.7 & \\
& & & 8 & 8 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Janice} & Alice & 9 & 9 & 7 & 8.3 & \multirow{4}{*}{8.1}\\
& Amelia & 9 & 8 & 8 & 8.3 & \\
& Anton & 8 & 8 & 8 & 8.0 & \\
& Arthur & 7 & 9 & 7 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Julie} & Alice &10 & 9 &10 & 9.7 & \multirow{4}{*}{8.8}\\
& Amelia & 9 & 7 & 8 & 8.0 & \\
& Anton & 9 & 8 & 8 & 8.3 & \\
& Arthur & 9 &10 & 9 & 9.3 & \\
\bottomrule
\end{tabular}
\end{center}
%%%%%%%%%%%%%%%%%%%%%%%%% 测试4 %%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{tabular}{@{} ll cccc r @{}}
\toprule
Student & Marker & \multicolumn{4}{c}{Essay} & Total \\
\cmidrule(lr){3-6}
& & Originality & Synthesis & Effort & Overall & \\
\midrule
\multirow{4}{*}{James} & \multirow{4}{*}{Alice} & \multirow{4}{*}{Mike} & \multirow{4}{*}{Lily} & 7 & 8.0 & \multirow{4}{*}{7.9}\\
& & & & 7 & 8.0 & \\
& & & & 7 & 7.7 & \\
& & & & 8 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Janice} & Alice & 9 & 9 & 7 & 8.3 & \multirow{4}{*}{8.1}\\
& Amelia & 9 & 8 & 8 & 8.3 & \\
& Anton & 8 & 8 & 8 & 8.0 & \\
& Arthur & 7 & 9 & 7 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Julie} & Alice &10 & 9 &10 & 9.7 & \multirow{4}{*}{8.8}\\
& Amelia & 9 & 7 & 8 & 8.0 & \\
& Anton & 9 & 8 & 8 & 8.3 & \\
& Arthur & 9 &10 & 9 & 9.3 & \\
\bottomrule
\end{tabular}
\end{center}
%%%%%%%%%%%%%%%%%%%%%%%%% 测试5 %%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{tabular}{@{} ll cccc r @{}}
\toprule
Student & Marker & \multicolumn{4}{c}{Essay} & Total \\
\cmidrule(lr){3-6}
& & Originality & Synthesis & Effort & Overall & \\
\midrule
\multirow{4}{*}{James} & \multirow{4}{*}{Alice} & \multirow{4}{*}{Mike} & \multirow{4}{*}{Lily} & \multirow{4}{*}{nonotreply} & 8.0 & \multirow{4}{*}{7.9}\\
& & & & & 8.0 & \\
& & & & & 7.7 & \\
& & & & & 7.7 & \\
\addlinespace
\multirow{4}{*}{Janice} & Alice & 9 & 9 & 7 & 8.3 & \multirow{4}{*}{8.1}\\
& Amelia & 9 & 8 & 8 & 8.3 & \\
& Anton & 8 & 8 & 8 & 8.0 & \\
& Arthur & 7 & 9 & 7 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Julie} & Alice &10 & 9 &10 & 9.7 & \multirow{4}{*}{8.8}\\
& Amelia & 9 & 7 & 8 & 8.0 & \\
& Anton & 9 & 8 & 8 & 8.3 & \\
& Arthur & 9 &10 & 9 & 9.3 & \\
\bottomrule
\end{tabular}
\end{center}
%%%%%%%%%%%%%%%%%%%%%%%%% 测试5 %%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{tabular}{@{} ll cccc r @{}}
\toprule
Student & Marker & \multicolumn{4}{c}{Essay} & Total \\
\cmidrule(lr){3-6}
& & Originality & Synthesis & Effort & Overall & \\
\midrule
\multirow{4}{*}{James} & \multirow{4}{*}{Alice} & \multirow{4}{*}{Mike} & \multirow{4}{*}{Lily} & \multirow{4}{*}{nonotreply} & 8.0 & \multirow{4}{*}{7.9}\\
& & & & & 8.0 & \\
& & & & & 7.7 & \\
& & & & & 7.7 & \\
\addlinespace
\multirow{4}{*}{Janice} & Alice & 9 & 9 & 7 & 8.3 & \multirow{4}{*}{8.1}\\
& Amelia & 9 & 8 & 8 & 8.3 & \\
& Anton & 8 & 8 & 8 & 8.0 & \\
& Arthur & 7 & 9 & 7 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Julie} & Alice &10 & 9 &10 & 9.7 & \multirow{4}{*}{8.8}\\
& Amelia & 9 & 7 & 8 & 8.0 & \\
& Anton & 9 & 8 & 8 & 8.3 & \\
& Arthur & 9 &10 & 9 & 9.3 & \\
\bottomrule
\end{tabular}
\end{center}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 测试6%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{tabular}{@{} ll cccc r @{}}
\toprule
Student & Marker & \multicolumn{4}{c}{Essay} & Total \\
\cmidrule(lr){3-6}
& & Originality & Synthesis & Effort & Overall & \\
\midrule
\multirow{4}{*}{James} & \multirow{4}{*}{Alice} & 9 & 8 & 7 & 8.0 & 79\\
& &8 & 9 & 7 & 8.0 & 790 \\
& &9 & 7 & 7 & 7.7 & 7900\\
& &7 & 8 & 8 & 7.7 & 79000 \\
\addlinespace
\multirow{4}{*}{Janice} & Alice & 9 & 9 & 7 & 8.3 & \multirow{4}{*}{8.1}\\
& Amelia & 9 & 8 & 8 & 8.3 & \\
& Anton & 8 & 8 & 8 & 8.0 & \\
& Arthur & 7 & 9 & 7 & 7.7 & \\
\addlinespace
\multirow{4}{*}{Julie} & Alice &10 & 9 &10 & 9.7 & \multirow{4}{*}{8.8}\\
& Amelia & 9 & 7 & 8 & 8.0 & \\
& Anton & 9 & 8 & 8 & 8.3 & \\
& Arthur & 9 &10 & 9 & 9.3 & \\
\bottomrule
\end{tabular}
\end{center}
aaaa\\
aaaa\\
aaaa\\
表格6\\
%%%%%%%%%%%%%%%%%%%%%%%%%%% 测试6%%%%%%%%%%%%%%%%%%%%%%
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{学生个人信息} \\
\hline
\multirow{2}*{姓名} &
\multirow{2}*{学号} &
\multicolumn{3}{c|}{成绩} \\ \cline{3-5}
\multicolumn{1}{|c|}{} &
\multicolumn{1}{|c|}{} &
\multicolumn{1}{|c|}{语文} & 数学 & 英语 \\ \hline
张三 & 006 & 91 & 98 & 99 \\ \hline
李四 & 009 & 87 & 88 & 79 \\ \hline
王五 & 007 & 81 & 79 & 77 \\ \hline
\end{tabular}
aaaa\\
aaaa\\
aaaa\\
表格7\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 测试7%%%%%%%%%%%%%%%%%%%%%%
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{学生个人信息} \\
\hline
\multirow{2}*{姓名} & \multirow{2}*{学号} &科目1 & 科目2 & 科目3 \\
\cline{3-5}
& & 语文 & 数学& 英语 \\
\cline{1-5}
张三 & 006 & 91 & 98 & 99 \\ \hline
李四 & 009 & 87 & 88 & 79 \\ \hline
王五 & 007 & 81 & 79 & 77 \\ \hline
\end{tabular}
aaaa\\
aaaa\\
aaaa\\
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 测试8%%%%%%%%%%%%%%%%%%%%%%
\begin{table}
\centering
\caption{测试表格
\label{Table:测试}}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{学生个人信息} \\
\hline
\multirow{2}*{姓名} & \multirow{2}*{学号} &科目1 & 科目2 & 科目3 \\
\cline{3-5}
& & 语文 & 数学& 英语 \\
\cline{1-5}
张三 & 006 & 91 & 98 & 99 \\ \hline
李四 & 009 & 87 & 88 & 79 \\ \hline
王五 & 007 & 81 & 79 & 77 \\ \hline
\end{tabular}
\end{table}
\end{document}
结果如下
根据这几个表格,我大概能把语法看懂
multirow 逻辑
分析这个代码和结果的对应关系,首先使用语法\multirow
其中后面的2是代表这个位置是合并2行,后面的星星符号我目前也不知道干嘛的,我看到的例子全带这个,可以先不管,后面的{姓名}是最终合并两行所填写的一个元素的内容,同理\multirow{2}*{学号}也是这个道理,就是第二列的两行需要合并,从这里就可以看到一个逻辑,这个语法就是从左到右,一行一行写的,而不是先按列来的,到了这一步,假设需要合并的内容已经写完了,从第三列开始就是不需要合并的,按照一行一行的逻辑,那么接下来我就写 &科目1 & 科目2 & 科目3,把后面三列占满,但是此时需要注意,这里的&科目1 & 科目2 & 科目3仅仅占了一行的,要知道我们开始的两列是两行合并成一行的,所以元素必然还有缺失的,但是这个不影响这个逻辑,此时我们第一行其实已经写完了,然后输入换行\, 这里表格其实就已经输出到了第二行的第一列,记住第一列和第二列是合并了的,之前已经填过了,所以不需要再填了,所以需要使用& 把位置给占住,因为输入& & ,到这里其实表格已经输出到了第二行第三列了,从这里开始我就正常填充元素了,因此输入语文 & 数学& 英语 ,然后换行,一个多行合并的表格就被输出了,剩下的就依葫芦画瓢了
补充学习
\documentclass{article}
\usepackage{multirow,booktabs}
\usepackage{ctex}
\begin{document}
\begin{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 测试6%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{tabular}{@{} ll cccc r @{}}
\toprule
Student & Marker & \multicolumn{4}{c}{Essay} & Total \\
\cmidrule(lr){3-6}
& & Originality & Synthesis & Effort & Overall & \\
\midrule
\multirow{4}{*}{James} & \multirow{4}{*}{Alice} & 9 & 8 & 7 & 8.0 & 79\\
& &8 & 9 & 7 & 8.0 & 790 \\
& &9 & 7 & 7 & 7.7 & 7900\\
& &7 & 8 & 8 & 7.7 & 79000 \\
\cline{1-7}
\addlinespace
\multirow{4}{*}{Janice} & Alice & 9 & 9 & 7 & 8.3 & \multirow{4}{*}{8.1}\\
& Amelia & 9 & 8 & 8 & 8.3 & \\
& Anton & 8 & 8 & 8 & 8.0 & \\
& Arthur & 7 & 9 & 7 & 7.7 & \\
\cline{1-7}
\addlinespace
\multirow{4}{*}{Julie} & Alice &10 & 9 &10 & 9.7 & \multirow{4}{*}{8.8}\\
& Amelia & 9 & 7 & 8 & 8.0 & \\
& Anton & 9 & 8 & 8 & 8.3 & \\
& Arthur & 9 &10 & 9 & 9.3 & \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\begin{table}[hp] %%参数: h:放在此处 t:放在顶端 b:放在底端 p:在本页
\renewcommand\arraystretch{1.2}
%\setlength{\abovecaptionskip}{0.cm}
%\setlength{\belowcaptionskip}{-0.cm}
\centering % 显示位置为中间
\textbf{Table 2}~~Parameters description.\\ %%表的标题
\begin{tabular}{p{45pt}l|ll|l} %第一列设置宽度为45pt 全为左对齐 没有分割线
%\setlength{\tabcolsep}{20mm}
\hline % 表格的横线
%\toprule % 顶部线
Parameters & & Definitions & Value & Source \\%[3pt]只改一行 %%表格第一行标题 % 表格中的内容,用&分开,\\表示下一行
\hline % 表格的横线
%\midrule % 中部线
$\beta_{1}$ & & xxxxabcdxxx & 1 & Estimation \\ %%表格内容
%\midrule
\multirow{2}[2]{*}{$\alpha_{3}$} & & aaa1 & \multirow{2}[2]{*}{1} & \multirow{2}[2]{*}{Estimation} \\
& & bbb2 & & \\
$d_{1}$ & & xxxxabcdxxx & 1 & Estimation \\
\multirow{3}[2]{*}{$1/\theta(t)$}& $\theta_{0}$ & 1aaa & 1 & Estimation \\
& $\theta_{1}$ & 2bbb & 1 & Estimation \\
& $\theta_{2}$ & 3ccc & 1 & Estimation \\
%\bottomrule % 底部线
\hline % 表格的横线
\end{tabular}
\end{table}
\end{document}
结果如下