复杂的 LaTeX 表格

复杂的 LaTeX 表格

我正在尝试制作一个 LaTeX 表格。我准备了以下代码。

\begin{table}[htbp]
\caption{Combination Nomenclature, (Average Fill Factor)}
\resizebox{1.0\textwidth}{!}{
\begin{tabular}{|c||c|c|c|c|}
\hline
\textbf{Combination} &\multicolumn{4}{l|}{\textbf{Included Optional Steps}}\\
\cline{2-5}
&\textbf{1}&\textbf{2}&\textbf{3}&\textbf{4}\\
\hline\hline
\textbf{1}& X & & & \\
\hline
\textbf{2}& X & X & & \\
\hline
\textbf{3}& X & X & X & \\ 
\hline
\textbf{4}& X & X &  &X \\ 
\hline
\textbf{5}& X &  & X & \\ 
\hline
\textbf{6}& X &  & X & X\\ 
\hline
\textbf{7}& X &  & & X\\
\hline
\textbf{8}&  & X & &\\
\hline
\textbf{9}&  & X &  X &\\
\hline
\textbf{10}&  & X &  X & X\\
\hline
\textbf{11}&  & X & & X\\
\hline
\textbf{12}&  &  & X & \\
\hline
\textbf{13}&  &  & X & X \\
\hline
\textbf{14}&  &  &  & X \\
\hline
\hline
\textbf{15}& \multicolumn{1}{l}{Nano Particles Deposited, Not Sintered} &  &  & \\
\hline
\textbf{16}& \multicolumn{1}{l}{Only Grinded Wafer 1, No Particles Deposited, Not Sintered} &  &  & \\
\hline
\textbf{17}& \multicolumn{1}{l}{Only Grinded Wafer 2, No Particles Deposited, Not Sintered}  &  &  &\\
\hline
\end{tabular}}
\label{table:AverageFillFactor}
\end{table}

如您所见,组合 15-17 应该独立于上面的行,可选步骤 1-4 应该具有相同的宽度。问题是我不确定如何将它们分开。

答案1

一种方法是固定列的宽度,如第一个示例所示:

在此处输入图片描述

像第二个例子那样消除垂直线会更好:

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\begin{table}[htbp]
\caption{Combination Nomenclature, (Average Fill Factor)}
\resizebox{1.0\textwidth}{!}{
\begin{tabular}{|c||p{1.0em}|p{1.0em}|p{1.0em}|p{1.0em} l|}
\hline
\textbf{Combination} &\multicolumn{5}{l|}{\textbf{Included Optional Steps}}\\
\cline{2-6}
&\textbf{1}&\textbf{2}&\textbf{3}&\textbf{4}&\\
\hline\hline
\textbf{1}& X & & & &\\
\hline
\textbf{13}&  &  & X & X &\\
\hline
\textbf{14}&  &  &  & X &\\
\hline
\hline
\textbf{15}& \multicolumn{4}{l}{Nano Particles Deposited, Not Sintered}&\\
\hline
\textbf{16}& \multicolumn{4}{l}{Only Grinded Wafer 1, No Particles Deposited, Not Sintered}&\\
\hline
\textbf{17}& \multicolumn{4}{l}{Only Grinded Wafer 2, No Particles Deposited, Not Sintered}&\\
\hline
\end{tabular}}
\label{table:AverageFillFactor}
\end{table}
%
\begin{table}[htbp]
\caption{Combination Nomenclature, (Average Fill Factor)}
\resizebox{1.0\textwidth}{!}{
\begin{tabular}{c p{1.0em} p{1.0em} p{1.0em} p{1.0em} l }
\hline
\textbf{Combination} &\multicolumn{5}{l}{\textbf{Included Optional Steps}}\\
\cline{2-6}
&\textbf{1}&\textbf{2}&\textbf{3}&\textbf{4}&\\
\hline\hline
\textbf{1}& X & & & &\\
\hline
\textbf{13}&  &  & X & X &\\
\hline
\textbf{14}&  &  &  & X &\\
\hline
\hline
\textbf{15}& \multicolumn{4}{l}{Nano Particles Deposited, Not Sintered}&\\
\hline
\textbf{16}& \multicolumn{4}{l}{Only Grinded Wafer 1, No Particles Deposited, Not Sintered}&\\
\hline
\textbf{17}& \multicolumn{4}{l}{Only Grinded Wafer 2, No Particles Deposited, Not Sintered}&\\
\hline
\end{tabular}}
\label{table:AverageFillFactor}
\end{table}
\end{document}

答案2

\documentclass{article}
\usepackage{graphicx,array}    
\begin{document}

\begin{table}[!htb]
\def\arraystretch{1.3}% more vertical space
\caption{Combination Nomenclature, (Average Fill Factor)}\label{table:AverageFillFactor}
\medskip
\resizebox{1.0\textwidth}{!}{%
\begin{tabular}{|>{\bfseries}c||p{1.0em}|p{1.0em}|p{1.0em}|p{1.0em} l|}      \hline
\textbf{Combination} &\multicolumn{5}{l|}{\textbf{Included Optional Steps}}\\\cline{2-6}
   & \textbf{1}&\textbf{2}&\textbf{3}&\textbf{4}&\\\hline\hline
 1 & X & & & &    \\\hline
13 &  &  & X & X &\\\hline
14 &  &  &  & X & \\\hline\hline
15 & \multicolumn{4}{l}{Nano Particles Deposited, Not Sintered}&\\\hline
16 & \multicolumn{4}{l}{Only Grinded Wafer 1, No Particles Deposited, Not Sintered}&\\\hline
17 & \multicolumn{4}{l}{Only Grinded Wafer 2, No Particles Deposited, Not Sintered}&\\\hline
\end{tabular}}
\end{table}

\end{document}

在此处输入图片描述

相关内容