考试文档类可以排版,但我仍然想修复错误信息

考试文档类可以排版,但我仍然想修复错误信息

我有

\documentclass[answers]{exam}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tipa}
\usepackage{graphicx}
\graphicspath{{ozclo images/}}
\begin{document}
\let\oldtable\table
\let\endoldtable\endtable
\newif\ifinsidefloatingenv  %set boolean for 
\insidefloatingenvfalse     %not necessary but to be sure its false
\renewenvironment{table}[1][h]
{\ifinner               \center \insidefloatingenvtrue     \else    \oldtable[#1]   \fi}
{\ifinsidefloatingenv   \endcenter \insidefloatingenvfalse \else    \endoldtable    \fi}
\begin{solution}
\textbf{Problem 2}
\begin{table}[htp]
\begin{center}
\begin{tabular}{lll}
\textbf{Ancient} & \textbf{Early} & \textbf{Late}\\
chegar & praino & plátano\\
chão & prancha & plebe\\
cheio& &\\
\end{tabular}
\end{center}
\end{table}
\end{solution}
\begin{solution}
\textbf{Problem 4}
mtu - person, mbuzi - goat, jito - large, mgeni - guest, jitu - giant, kibuzi - little goat
\end{solution}
\end{questions}
\hskip-1cm\includegraphics[scale=0.75]{P4}
\includegraphics[scale=0.75]{P4a}
\end{document}

如果我强制执行,它可以排版,但它会显示此错误消息(见图) 照片

我不知道该怎么做。顺便问一下,我该如何正确地将代码包含在我的帖子中?我看到有人将他们的代码包含在下面的输出中,并“自动”显示。代码也在它自己的单独“窗口”中,带有上下左右滚动条。抱歉,我知道我的代码看起来真的很乱。我可以在 meta 上找到这方面的教程吗?

答案1

这个怎么样?

\documentclass[answers]{exam}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tipa}
\usepackage{graphicx}
\graphicspath{{ozclo images/}}
\begin{document}
\let\oldtable\table
\let\endoldtable\endtable
\newif\ifinsidefloatingenv  %set boolean for 
\insidefloatingenvfalse     %not necessary but to be sure its false
\renewenvironment{table}[1][h]
{\ifinner               \center \insidefloatingenvtrue     \else    \oldtable[#1]   \fi}
{\ifinsidefloatingenv   \endcenter \insidefloatingenvfalse \else    \endoldtable    \fi}
\begin{solution}
\textbf{Problem 2}
%\begin{table}[htp] %% <-- you don't really need table
\begin{center}
\begin{tabular}{lll}
\textbf{Ancient} & \textbf{Early} & \textbf{Late}\\
chegar & praino & plátano\\
chão & prancha & plebe\\
cheio& &\\
\end{tabular}
\end{center}
%\end{table}  %% <-- you don't really need table
\end{solution}

\begin{solution}
\textbf{Problem 4}
mtu - person, mbuzi - goat, jito - large, mgeni - guest, jitu - giant, kibuzi - little goat
\end{solution}
% \end{questions} %% <-- this line caused trouble
% \hskip-1cm\includegraphics[scale=0.75]{P4} % commented off 
% \includegraphics[scale=0.75]{P4a}          % commented off
\end{document}

在此处输入图片描述

相关内容