我尝试将两个表格并排放置,但出现错误

我尝试将两个表格并排放置,但出现错误
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}

\title{Test}
\author{Chad Stucki}
\date{September 2016}

\begin{document}

\maketitle

\section{Introduction}

\begin{table}[!b]
\centering
\caption{Caption}
\begin{tabular}[t]{|c|c|}
\hline
\multicolumn{2}{|c|}{\rule{0pt}{2.5ex} \textbf{Class I Fairing}} \\\hline
\rule{0pt}{2.5ex} \textbf{Configuration} & \textbf{Drag Ratio} \\\hline
\rule{0pt}{2.5ex} $\alpha = 61$ cm & \multirow{3}{*}{$D_R = 0.862$} \\\cline{1-1}
\rule{0pt}{2.5ex} $\beta = 0$ cm  & \\\cline{1-1}
\rule{0pt}{2.5ex} $\delta = 122$ cm & \\\hline
\multicolumn{2}{|c|}{\rule{0pt}{2.5ex} \textbf{Reduction in Drag}} \\\hline
\multicolumn{2}{|c|}{\rule{0pt}{2.5ex} $R_D = 13.8\%$} \\\hline
\end{tabular}
\begin{tabular}[t]{|c|c|}
\hline
\multicolumn{2}{|c|}{\rule{0pt}{2.5ex} \textbf{Class II Fairing} \\\hline
\rule{0pt}{2.5ex} \textbf{Configuration} & \textbf{Drag Ratio} \\\hline
\rule{0pt}{2.5ex} $W = 73^{\circ}$ & \multirow{4}{*}{$D_R = 0.826$} \\\cline{1-1}
\rule{0pt}{2.5ex} $X = 49^{\circ}$ & \\\cline{1-1}
\rule{0pt}{2.5ex} $Y = 19^{\circ}$ & \\\cline{1-1}
\rule{0pt}{2.5ex} $Z = 32^{\circ}$ & \\\hline
\multicolumn{2}{|c|}{\rule{0pt}{2.5ex} \textbf{Reduction in Drag}} \\\hline
\multicolumn{2}{|c|}{\rule{0pt}{2.5ex} $R_D = 17.4\%$} \\\hline
\end{tabular}
\end{table}

\end{document}

答案1

好的,面对@StefanH 发现您缺失的},并在@Mico 的解决方案的基础上,我尝试通过重构您的表格来扩展主题。我向您的解决方案添加了以下包:

  • array-> 有\extrarowheight
  • booktabs-> 针对花哨的规则
  • siunitx以适当的间距排版单元。

此外,为了避免过多,$我定义了一种新的列类型,可以自动为您插入。

因此,经过一些清理后,下面是代码,后面是结果。您会注意到我使用了更少的行,因为这样信息对我来说感觉分组更好,也更易读:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array,booktabs,multirow}
\usepackage{siunitx}
\title{Test}
\author{Chad Stucki}
\date{September 2016}
\newcolumntype{C}{>{$}c<{$}}
\begin{document}

\maketitle

\section{Introduction}

\begin{table}[!b]
\setlength\extrarowheight{2pt}
\centering
\caption{Caption}
\begin{tabular}[t]{Cc}
\toprule
\multicolumn{2}{c}{ \textbf{Class I Fairing}} \\
 \multicolumn{1}{c}{\textbf{Configuration}} & \textbf{Drag Ratio} \\\midrule
 \alpha = \SI{61}{\centi\metre}& \multirow{3}{*}{$D_R = 0.862$} \\
 \beta = \SI{0}{\centi\metre} & \\
 \delta = \SI{122}{\centi\metre}& \\\midrule
\multicolumn{2}{c}{ \textbf{Reduction in Drag}} \\
\multicolumn{2}{c}{ $R_D = 13.8\%$} \\\bottomrule
\end{tabular}
\begin{tabular}[t]{Cc}
\toprule
\multicolumn{2}{c}{ \textbf{Class II Fairing}} \\
 \multicolumn{1}{c}{\textbf{Configuration}} & \textbf{Drag Ratio} \\\midrule
 W = \ang{73} & \multirow{4}{*}{$D_R = 0.826$} \\
 X = \ang{49} & \\
 Y = \ang{19} & \\
 Z = \ang{32}& \\\midrule
\multicolumn{2}{c}{ \textbf{Reduction in Drag}} \\
\multicolumn{2}{c}{ $R_D = 17.4\%$} \\\bottomrule
\end{tabular}
\end{table}

\end{document}

在此处输入图片描述

相关内容