如何在LaTeX中的同一张表中插入多行和多列表

如何在LaTeX中的同一张表中插入多行和多列表

我需要帮助在同一个表中创建多行和多列表。下图给出了所需的表。

]1

答案1

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx,multirow,array}
\usepackage[margin=1in]{geometry}
\begin{document}

\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}

\renewcommand{\arraystretch}{1.3}
\begin{table}[htbp]
\caption{Criteria used for selecting the time delay}
\label{MyTable}
\begin{tabularx}{\linewidth}{|X|L{7cm}|L{5cm}|C{2cm}|} \hline
\multirow{3}{*}{Zone 1} & \multicolumn{3}{L{14cm}|}{This zone operates without ...} \\ \cline{2-4} 
                        & \multicolumn{2}{L{12cm}|}{Medium Votage (MV) and High Voltage (HV)} & 20-30 ms \\ \cline{2-4} 
                        & \multicolumn{2}{L{12cm}|}{Extra-High Voltage (EHV)}                 & 15-25 ms \\ \hline
\multirow{2}{*}{Zone 2} & \multicolumn{3}{L{14cm}|}{Must allow zone 1 of neighboring ... Must allow zone 1 of neighboring ... Must allow zone 1 of neighboring ...} \\ \cline{2-4} 
                        & {Zone 1 operating time of protected line ... Zone 1 operating time of protected line ...}  & \multicolumn{2}{L{7cm}|}{(Referred above) from 2 cycles ... (Referred above) from 2 cycles ...} \\ \hline
Zone 3                  & \multicolumn{3}{L{14cm}|}{Same procedure as for Zone 2, wherein the operating time of Zone 1 of the protected line is replaced by ...} \\ \hline
\end{tabularx}
\end{table}

\end{document}

tabularx对于如此大的表格来说,这非常有用,因为它使表格能够占据总空间\linewidth。您将需要multirow这些多行单元格的包和array定义新列类型的包(C和)。最后三列应由指定宽度的列或L定义,因为它们相互干扰。应至少指定一列来填充剩余的水平空间。CLX

\renewcommand{\arraystretch}{1.3}用于为表格提供一些垂直延伸以提高可读性。最后,您可以考虑使用booktabs以增加美观度。

相关内容