我使用列包将 sile 拆分为 2 列。一列用于图片,一列用于表格。但我的表格坏了。请帮我修复它。这是我的代码:
\RequirePackage[demo]{graphicx}
\documentclass{beamer}
\usepackage{tabularx}
\begin{document}
\begin{frame}
\begin{columns}[T]
\begin{column}{0.5\textwidth}
\centering
\includegraphics[height = 2 cm]{demo}
\end{column}
\begin{column}{0.5\textwidth}
\resizebox{\linewidth}{!}{
\begin{tabularx}{\linewidth}{|X|c|c|c|c|c|c|}
\hline
Method& RMSE & MAE & MSE & NMSE & MAPE &Hit Rate \%\\
\hline
\multicolumn{7}{|c|}{1-step ahead}\\
\hline
PureNN & 5.6411 & 4.1652 & 31.8224 & 0.015 & 0.0094 & 51.61\\
WaveletNN&5.5612&4.0539&30.9271&0.0146&0.0091&53.63\\
\hline
\multicolumn{7}{|c|}{3-step ahead}\\
\hline
PureNN & 11.8207 & 9.0218 & 139.7278 & 0.0658 & 0.0202 & 52.23\\
WaveletNN&10.0794&7.4881&101.5934&0.0478&0.0169&53.04\\
\hline
\multicolumn{7}{|c|}{4-step ahead}\\
\hline
PureNN & 12.212 & 9.3179 & 149.1321 & 0.0702 & 0.0212 & 49.6\\
WaveletNN&12.0099&9.0578&144.2389&0.0679&0.0205&52.4\\
\hline
\multicolumn{7}{|c|}{7-step ahead}\\
\hline
PureNN & 16.6392 & 13.35 & 276.8621 & 0.1303 & 0.0304 & 49.80\\
WaveletNN&15.824&12.3698&250.4003&0.1179&0.0278&55.82\\
\hline
\end{tabularx} }
\end{column}
\end{columns}
\end{frame}
\end{document}
这是我的结果(不对!!!):
答案1
你问的是tabularx
强制表格恢复到原始行宽前你缩放它,这意味着使 X 列的宽度为负数,所以它放弃。
只需使用普通表格到任意宽度,然后缩放它。
\RequirePackage[demo]{graphicx}
\documentclass{beamer}
\usepackage{tabularx}
\begin{document}
\begin{frame}
\begin{columns}[T]
\begin{column}{0.5\textwidth}
\centering
\includegraphics[height = 2 cm]{demo}
\end{column}
\begin{column}{0.5\textwidth}
\resizebox{\linewidth}{!}{%,, don't forget this %
\begin{tabular}{|p{2cm}|c|c|c|c|c|c|}
\hline
Method& RMSE & MAE & MSE & NMSE & MAPE &Hit Rate \%\\
\hline
\multicolumn{7}{|c|}{1-step ahead}\\
\hline
PureNN & 5.6411 & 4.1652 & 31.8224 & 0.015 & 0.0094 & 51.61\\
WaveletNN&5.5612&4.0539&30.9271&0.0146&0.0091&53.63\\
\hline
\multicolumn{7}{|c|}{3-step ahead}\\
\hline
PureNN & 11.8207 & 9.0218 & 139.7278 & 0.0658 & 0.0202 & 52.23\\
WaveletNN&10.0794&7.4881&101.5934&0.0478&0.0169&53.04\\
\hline
\multicolumn{7}{|c|}{4-step ahead}\\
\hline
PureNN & 12.212 & 9.3179 & 149.1321 & 0.0702 & 0.0212 & 49.6\\
WaveletNN&12.0099&9.0578&144.2389&0.0679&0.0205&52.4\\
\hline
\multicolumn{7}{|c|}{7-step ahead}\\
\hline
PureNN & 16.6392 & 13.35 & 276.8621 & 0.1303 & 0.0304 & 49.80\\
WaveletNN&15.824&12.3698&250.4003&0.1179&0.0278&55.82\\
\hline
\end{tabular}%don't forget this %
}
\end{column}
\end{columns}
\end{frame}
\end{document}