我在 beamer 中写了一个表格,代码如下:
\documentclass{beamer}
\usepackage{adjustbox}
\begin{document}
\begin{frame}
\centering
\adjustbox{max height=\dimexpr\textheight-5.5cm\relax,
max width=.9\textwidth}{
\begin{tabular}{|c|c|c|c|c|}
\hline
\begin{tabular}{c}
XYZ\\ABC
\end{tabular}
& \multicolumn{2}{c|}{Number of Vehicles } & \begin{tabular}{c}
Monthly\\Saving
\end{tabular} &
\begin{tabular}{c}
Improvement in\\ ABC (\%)
\end{tabular} \\
\hline
& PQR & ZXC & & \\
\hline
140 & 61 & 41 & 4 & 12 \\
\hline
150 & 83 & 61 & 4 & 12 \\
\hline
170 & 124 & 12 & 4 & 12 \\
\hline
\end{tabular}
}
\end{frame}
\end{document}
我想合并第 4 列的最后三行,以便条目 4 仅出现一次。该怎么做?
答案1
你可以\hline
使用\cline{1-3}\cline{5-5}
\documentclass{beamer}
\usepackage{adjustbox}
\begin{document}
\begin{frame}
\centering
\adjustbox{max height=\dimexpr\textheight-5.5cm\relax,
max width=.9\textwidth}{
\begin{tabular}{|c|c|c|c|c|}
\hline
\begin{tabular}{c}
XYZ\\ABC
\end{tabular} &
\multicolumn{2}{c|}{Number of Vehicles } &
\begin{tabular}{c}
Monthly\\Saving
\end{tabular} &
\begin{tabular}{c}
Improvement in\\ ABC (\%)
\end{tabular} \\
\hline
& PQR & ZXC & & \\
\hline
140 & 61 & 41 & & 12 \\
\cline{1-3}\cline{5-5}
150 & 83 & 61 & 4 & 12 \\
\cline{1-3}\cline{5-5}
170 & 124 & 12 & & 12 \\
\hline
\end{tabular}
}
\end{frame}
\end{document}