我遇到一个问题:我用模板修改了我的表格如下,然后它显示
! 缺失数字,视为零 [
以下是我的部分代码:
\documentclass[compress,mathserif,CJK]{beamer}
\usetheme{Darmstadt}
\usefonttheme[onlylarge]{structurebold}
\setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
\setbeamertemplate{navigation symbols}{}
\usepackage{tabular}
\usepackage{longtable}
\usepackage{multirow}
\renewcommand{\tablename}{表}
\usepackage[english]{babel}
\usepackage{CJK}
\newcommand{\Ref}[1]{\mbox{(\ref{#1})}}
\begin{document}
\begin{CJK*}{GBK}{kai}
\newgeometry{textwidth=135mm,textheight=195mm}
\newcommand{\D}{\displaystyle}
\newcommand{\DF}[2]{\dfrac{\D#1}{\D#2}}
\newcommand{\mc}[1]{\multicolumn{1}{>{\columncolor[gray]{0.7}}c}{#1}}
\newcommand{\ml}[1]{\multicolumn{1}{>{\columncolor[gray]{0.7}}c}{#1}}
\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\newcolumntype{R}{>{$}r<{$}}
\newcolumntype{V}[1]{>{[\;}*{#1}{R@{\;\;}}R<{\;]}}
\makeatletter\def\@captype{table}\makeatother
\begin{frame}
\begin{spacing}{0.5}\scalebox[0.7]
{\centering
\footnotesize
\begin{longtable}{|c|c|cc|}
\caption{人造数据集上各方法比较}\label{tab1}
\\ \hline
{(m,n)} & p & met\\
\hline
\multirow{19}{*}{(300,400)}
& 2\% & \begin{tabular}{c}
rK \\ ST \\ Lm \\ AIe \\ ll\\ mml\\
\end{tabular}
& \begin{tabular}{c}
0.0131\\0.0273\\0.0337\\0.0265\\0.0100\\ \bf{0.0102}\\
\end{tabular}
\\ \hline
\end{longtable}}
\end{spacing}
\end{frame}
\end{CJK*}
\end{document}
答案1
您加载了一个包tabular
,但据我所知,它并不存在。我将其更改为tabularx
。此外,我还加载了包caption
,该包正在使用中,但尚未加载。
此后,我注释掉了第 16 行:
\newgeometry{textwidth=135mm,textheight=195mm}
这给出了一个奇怪的文本块,以及第 3 行和第 48 行:
%\begin{spacing}{0.5}\scalebox[0.7]
...
%\end{spacing}
因为环境spacing
是一个未定义的命令。
然后你的代码编译后得到以下结果:
完整代码:
\documentclass[compress,mathserif,CJK]{beamer}
\usetheme{Darmstadt}
\usefonttheme[onlylarge]{structurebold}
\setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
\setbeamertemplate{navigation symbols}{}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{multirow}
\renewcommand{\tablename}{表}
\usepackage[english]{babel}
\usepackage{CJK, caption}
\newcommand{\Ref}[1]{\mbox{(\ref{#1})}}
\begin{document}
\begin{CJK*}{GBK}{kai}
%\newgeometry{textwidth=135mm,textheight=195mm}
\newcommand{\D}{\displaystyle}
\newcommand{\DF}[2]{\dfrac{\D#1}{\D#2}}
\newcommand{\mc}[1]{\multicolumn{1}{>{\columncolor[gray]{0.7}}c}{#1}}
\newcommand{\ml}[1]{\multicolumn{1}{>{\columncolor[gray]{0.7}}c}{#1}}
\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\newcolumntype{R}{>{$}r<{$}}
\newcolumntype{V}[1]{>{[\;}*{#1}{R@{\;\;}}R<{\;]}}
\makeatletter\def\@captype{table}\makeatother
\begin{frame}
%\begin{spacing}{0.5}\scalebox[0.7]
{\centering
\footnotesize
\begin{longtable}{|c|c|cc|}
\caption{人造数据集上各方法比较}\label{tab1}
\\ \hline
{(m,n)} & p & met\\
\hline
\multirow{19}{*}{(300,400)}
& 2\% & \begin{tabular}{c}
rK \\ ST \\ Lm \\ AIe \\ ll\\ mml\\
\end{tabular}
& \begin{tabular}{c}
0.0131\\0.0273\\0.0337\\0.0265\\0.0100\\ \bf{0.0102}\\
\end{tabular}
\\ \hline
\end{longtable}}
%\end{spacing}
\end{frame}
\end{CJK*}
\end{document}