A.1 Jeopardy Template

[Back to Section 4.1 for suggested edits.]

[Back to Section 4.2 for full comments.]

If you move the cursor to the top-right corner of the gray area (code chunk), there is a copy button. Please copy and paste it into a blank TeX file.

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\setbeamersize{text margin left=0cm, text margin right=0cm}
\usepackage{arrayjobx}
\usepackage{tcolorbox}
\usepackage{ocgx}

% Define the subject boxes, i.e., the first column  
\newtcolorbox{SubjectBox}{
    colback=gray!85,       % Background color is 85 percent gray.
    colframe=white,        % The color of the box frame.
    nobeforeafter,         % Allow boxes align horizontally on the same row
    arc=0pt,               % Round the corners of the box. Zero means squared corners.
    boxrule=.4pt,          % The thickness of the box frame.
    halign=center,         % Center text horizontally.
    valign=center,         % Center text vertically.
    width=0.4\textwidth,   % Box width is 40 percent of the text width.
    height=0.12\textheight % Box height is 12 percent of the text height, i.e., 8 rows
}

% Define the prize boxes, i.e., rest of the columns
\newtcolorbox{PrizeBox}{
    colupper=white,        % Text color. (In a colorbox, by default, there are upper and lower parts.)
    colback=orange, 
    colframe=white,
    nobeforeafter, 
    arc=0pt, 
    boxrule=.4pt,
    halign=center, 
    valign=center,
    width=.2\textwidth,     % 3 prize boxes plus 1 subject box occupy a full line.
    height=0.12\textheight  % 8 rows.
}

% Define the colorbox shared by the header and footer
\newtcolorbox{QuestionHeadFoot}{
    sidebyside,             % By default, divide a colorbox into left and right region       
    colback=orange,
    before=\vskip-.2ex,     % Remove the top padding
    after=0ex,              % Set bottom padding to 0
    arc=0pt,
    boxrule=.4pt,
    colframe=white,
    center upper,           % Left region text centerred. (Because of sidebyside, upper means left.)       
    center lower,           % Right region text centerred. (Because of sidebyside, lower means right)  
    colupper=white,          
    collower=white,          
    valign=center,
    fontupper=\LARGE\bfseries,
    fontlower=\LARGE\bfseries,
    width=\textwidth,
    height=.15\paperheight
}

% Define the colorbox used by the question/answer content
\newtcolorbox{TextArea}{
    before=,
    after=\vskip-.01ex,
    height=0.69\paperheight,
    boxrule=0pt,
    halign=center,
    valign=center
}

\newarray\scores                  % Create a new array \scores
\readarray{scores}{100&200&400}   % Load the prize values to \scores

% Shortcut to create one row at a time on the homepage
\newcommand{\newrow}[2]{
    \begin{SubjectBox}
        #1
    \end{SubjectBox}% <-- NEVER REMOVE THIS PERCENT SIGN! It allows the color boxes sit side by side.
    \foreach \i in {1,2,3}{% <-- NEVER REMOVE THIS PERCENT SIGN! It allows the color boxes sit side by side.
        \begin{PrizeBox}
            \begin{ocg}{s#2-\i}{s#2-\i}{1} %{PDF label}{internal reference label}{visibility}
            \hyperlink{s#2-\i}{\scores(\i)}
            \end{ocg}
        \end{PrizeBox}% <-- NEVER REMOVE THIS PERCENT SIGN! It allows the color boxes sit side by side. 
        }
}

% Shortcut to create header of a question page
\newcommand{\header}[2]{
    \begin{QuestionHeadFoot}
         #1 \tcblower #2
    \end{QuestionHeadFoot}
}

% Shortcut to create the footer of a question page
\newcommand{\footer}[1]{
    \begin{QuestionHeadFoot}
        \hyperlink{question#1}{Question} \\ \hyperlink{answer#1}{Answer} \tcblower
        \hideocg{#1}{Done!} \\  \hyperlink{home}{Home}
    \end{QuestionHeadFoot}
}

% Create a  question page
\newcommand{\content}[4]{
\begin{frame}
    \hypertarget<1>{question#1}{} % Make an anchor. Land here when the Question button is clicked.
    \hypertarget<2>{answer#1}{}   % Make an anchor. Land here when the Answer button is clicked.
    \hypertarget{#1}{}            % Make an anchor. Land here when the prize is clicked on the homepage.
    \header{#2}{#3}               % Make header.
    #4                            % Add question on part <1> and answer on part <2>.
    \footer{#1}                   % Make footer.
\end{frame}
}

\begin{document}
\begin{frame}
\hypertarget{home}{} % set up the anchor for the Home button
\vspace*{.23cm}
    \newrow{u-substitution}{1}
    \newrow{Trig Substitution}{2}
    \newrow{Integration by Parts}{3}
    \newrow{Improper Integrals}{4}
    \newrow{Volume}{5}
    \newrow{Geometric Series}{6}
    \newrow{Limit of Sequences}{7}
    \newrow{Convergence of Series}{8}
\end{frame}

\content                           
    {s1-1}                         % Question internal ID. Subject 1, question 1.
    {u-Substitution}               % Subject title
    {100}{                         % Prize of the question
        \begin{TextArea}           
        \only<1>{                  % Adding the question
          In the integral $\int \frac{(\ln x)^2}{x}\, dx$ which term should be replaced as $u$?
            \begin{enumerate}[A).]
            \item $\ln x$
            \item $1/x$
            \end{enumerate}
        }
        \only<2>{                  % Adding the answer
             $\ln x$
        }
        \end{TextArea}
    }

\content                           
    {s1-2}                         % Question internal ID. Subject 1, question 2.
    {u-Substitution}               % Subject title
    {200}{                         % Prize of the question
        \begin{TextArea}           
        \only<1>{                  % Adding the question
        In the integral $\int \sin x\sqrt{1+\cos x}\, dx$, which substitution does NOT work?
            \begin{enumerate}[A).]
            \item $u=\sin x$
            \item $u=\cos x$
            \item $u=1+\cos x$
            \end{enumerate}
        }
        \only<2>{                  % Adding the answer
            $\sin x$
        }
        \end{TextArea}
    }

\content                           
    {s1-3}                         % Question internal ID. Subject 1, question 3.
    {u-Substitution}               % Subject title
    {400}{                         % Prize of the question
        \begin{TextArea}           
        \only<1>{                  % Adding the question
            In the integral $\int \frac{x}{1+x^4}\, dx$, what should be replaced as $u$?
        }
        \only<2>{                  % Adding the answer
            $u = x^2$
        }
        \end{TextArea}
    }

\end{document}