问题:
我的 MWE 无法正常工作。请给我一些建议,以便我能完成我的试卷。实际上,当我输入完第一个问题后进入下一页时,代码出现了一些错误。
我根据以下链接准备了我的代码。
关联
平均能量损失
\documentclass[12pt]{beamer}
\usepackage{xcolor}
\usetheme{AnnArbor}
\usecolortheme{default}
\usepackage{enumitem}
\usefonttheme{professionalfonts} % using non standard fonts for beamer
\usefonttheme{serif} % default family is serif
\usepackage{setspace}
\addtobeamertemplate{frametitle}{}{\vspace{-0.4em}} % decrease
%make new line after item
\makeatletter
\def\myitem{%
\@ifnextchar[ \@myitem{\@noitemargtrue\@myitem[\@itemlabel]}}
\def\@myitem[#1]{\item[#1]\mbox{}\\}
\makeatother
%make new line after item
%%%
%%%%
\makeatletter
\newenvironment{cenumerate}{%
\enumerate
\setcounter{\@enumctr}{\csname saved@\@enumctr\endcsname}%
}{%
\expandafter\xdef\csname saved@\@enumctr\endcsname{\the\value{\@enumctr}}%
\endenumerate
}
\newenvironment{cenumerate*}{%
\enumerate
}{%
\expandafter\xdef\csname saved@\@enumctr\endcsname{\the\value{\@enumctr}}%
\endenumerate
}
\makeatother
\title[]{}
\author[]{}
\date[\today]{}
\begin{document}
\begin{frame}
\begin{center}
\textbf{Multiple Choice Questions}
\end{center}
\vspace{-0.70cm}
\maketitle
\end{frame}
\begin{frame}[t]{}
%\setstretch{1.5}
%\bfseries
\begin{cenumerate*}[label=(\arabic*)]
\item Let $T:\mathbb{R}^2 \rightarrow \mathbb{R}^2$ be a linear transformation defined by $T(x\,,\,y)=\left(2x+3y\,,\,4x-5y\right)$ the matrix representation relative to usual basis is
\vspace{0.5cm}
(A)~$\begin{bmatrix}
2 & \phantom{0}3\\[0.3em]
4 & -4
\end{bmatrix}$\hspace{2cm} (B)~$\begin{bmatrix}
2 & \phantom{0}3\\[0.3em]
4 & -4
\end{bmatrix}$ \vspace{1cm}
(C)~$\begin{bmatrix}
2 & \phantom{0}3\\[0.3em]
4 & -4
\end{bmatrix}$\hspace{2cm} (D)~$\begin{bmatrix}
2 & \phantom{0}3\\[0.3em]
4 & -4
\end{bmatrix}$
\end{cenumerate*}
\end{frame}
\begin{frame}[t]{}
%\setstretch{1.5}
%\bfseries
\begin{cenumerate}[label=(\arabic*)]
\item
\end{cenumerate}
\end{frame}
\end{document}
答案1
问题出在你传递的可选参数上\begin{cenumerate*}
,但你没有在序言中声明它。更改枚举的定义:
\newenvironment{cenumerate}[1][]{%
\enumerate[#1]
\setcounter{\@enumctr}{\csname saved@\@enumctr\endcsname}%
}{%
\expandafter\xdef\csname saved@\@enumctr\endcsname{\the\value{\@enumctr}}%
\endenumerate
}
\newenvironment{cenumerate*}[1][]{%
\enumerate[#1]
}{%
\expandafter\xdef\csname saved@\@enumctr\endcsname{\the\value{\@enumctr}}%
\endenumerate
}