0

Question:

My MWE is not working. Please give me suggestions so i can finish my exam paper. Actually when i reach in the next page after typing my first question codes are giving some errors.

I have prepared my codes by taking reference of the following link.

Link

beamer: best way to span long enumerations on different frames

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}

enter image description here

luki
  • 1,796
SandyM
  • 2,757

1 Answers1

1

The problem comes from the optional argument you pass to \begin{cenumerate*} but which you didn't declare in the preamble. Change the definitions of your enumerations:

\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
}

Then it compiles enter image description here enter image description here

JPG
  • 2,019