运行以下代码后
\documentclass[10pt]{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|l|l|l|} \hline
\multicolumn{3}{|c|}{Schedulers} \\ \hline
\multirow{3}{3cm}{Row 1. long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text } & RR & Round Robin \\
& EF & Earliest First \\
& LL & Lightest Loaded \\ \hline
\multirow{4}{*}{Row 2.} & MM & Min-Min \\
& MX & Max-Min \\
& DL & Dynamic Level \\
& RC & Relative Cost \\ \hline
\multirow{4}{*}{Row 3.} & PN & This paper \\
& ZO & Genetic Algorithm\\
& TA & Tabu search\\
& SA & Simlulated Annealing \\ \hline
\end{tabular}
\end{document}
我得到这个输出:
我应该怎么做才能使前三行(RR、EF 和 LL)相应更高?
答案1
不幸的是,multirow
如果行数大于它所跨越的行数,则不会扩展行数。在这种情况下,进行更改\\
以\\[1cm]
产生合理的结果。更自动化的解决方案是可能的,但更难。
\documentclass[10pt]{article}
\usepackage{multirow}
\begin{document}
\begin{tabular}{|l|l|l|} \hline
\multicolumn{3}{|c|}{Schedulers} \\ \hline
\multirow{3}{3cm}{Row 1. long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text long text } & RR & Round Robin \\[1cm]
& EF & Earliest First \\[1cm]
& LL & Lightest Loaded \\[1cm] \hline
\multirow{4}{*}{Row 2.} & MM & Min-Min \\
& MX & Max-Min \\
& DL & Dynamic Level \\
& RC & Relative Cost \\ \hline
\multirow{4}{*}{Row 3.} & PN & This paper \\
& ZO & Genetic Algorithm\\
& TA & Tabu search\\
& SA & Simlulated Annealing \\ \hline
\end{tabular}
\end{document}