7

I've been looking to make Jeopardy-type games in LaTeX. After some googling and tinkering, I haven't found anything satisfactory (I've looked into these links: Jeopardy Review, CTAN, AcroTeX, and this one here).

I'm not good enough with TeX to do this myself, and it seems such thing is out there somewhere, but I can't find it. I've found tons of decent Jeopardy games, but nothing which take math code (for example, BYOJeopardy is great for Jeopardy but bad for math, whereas the other things I linked are great for math but not good for Jeopardy). I suspect this would be done with beamer (which I have plenty of experience with).

Edit for clarity: I am looking for some way (maybe a new document class?) which would allow me to make Jeopardy-type games.

To my knowledge, this is the sort of thing you get from the jeopardy.sty found in the second link above, and I don't see how that's much like Jeopardy.

  • A snarky game host is included? – percusse Sep 13 '14 at 17:38
  • 1
    The game host can be snarky at times. – danzibr Sep 13 '14 at 17:39
  • 1
    Given that you don't say why e.g. jeopardy.sty is unsatisfactory, I'm not really sure what you are asking. (That seems to be designed both for the jeopardy bit and the maths bit and so to fulfil both desiderata.) – cfr Sep 13 '14 at 21:41
  • 1
    So a satisfying solution would be to recreate the BYOjeopardy layout in beamer, right? – Nico Boni Sep 14 '14 at 9:03
  • Yes, that would be a satisfying solution. I'll make an edit for clarity. Edit: Unless maybe I'm just not getting the second link in the original post to work correctly. I am getting error messages, and the output doesn't look like Jeopardy at all. – danzibr Sep 14 '14 at 19:01
7

Ok, here is some code that recreates the BYOjeopardy layout in Beamer to help you get started.

Gif mockup

enter image description here

The code:

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


\newtcolorbox{InnerSubjectBox}{
    enhanced,
    nobeforeafter,
    arc=0pt,
    width=.2\paperwidth,
    boxrule=.4pt,
    colframe=white,
    center upper,
    interior style={
        top color=blue,
        bottom color=black
    },
    colupper=white,
}

\newcommand{\subjects}[5]{×
    \begin{InnerSubjectBox}
        #1
    \end{InnerSubjectBox}%
    \begin{InnerSubjectBox}
        #2
    \end{InnerSubjectBox}%
    \begin{InnerSubjectBox}
        #3
    \end{InnerSubjectBox}%
    \begin{InnerSubjectBox}
        #4
    \end{InnerSubjectBox}%
    \begin{InnerSubjectBox}
        #5
    \end{InnerSubjectBox}
}

\newtcolorbox{InnerPrizeBox}{
    enhanced,
    nobeforeafter,
    arc=0pt,
    width=.2\paperwidth,
    boxrule=.4pt,
    colframe=white,
    center upper,
    interior style={
        top color=blue,
        bottom color=black
    },
    colupper=white,
    valign=center,
    fontupper=\LARGE\bfseries,
    height=.176\paperheight
}

\newcommand{\prizes}{%
    \foreach \i in {1,2,...,5}{%
        \begin{InnerPrizeBox}%
            \begin{ocg}{s\i-100}{s\i-100}{1}{\hyperlink{s\i-100}{100}}\end{ocg}
        \end{InnerPrizeBox}%
        }%

    \foreach \i in {1,2,...,5}{%
        \begin{InnerPrizeBox}%
            \begin{ocg}{s\i-200}{s\i-200}{1}{\hyperlink{s\i-200}{200}}\end{ocg}
        \end{InnerPrizeBox}%
        }%

    \foreach \i in {1,2,...,5}{%
        \begin{InnerPrizeBox}%
            \begin{ocg}{s\i-300}{s\i-300}{1}{\hyperlink{s\i-300}{300}}\end{ocg}
        \end{InnerPrizeBox}%
        }%

    \foreach \i in {1,2,...,5}{%
        \begin{InnerPrizeBox}%
            \begin{ocg}{s\i-400}{s\i-400}{1}{\hyperlink{s\i-400}{400}}\end{ocg}
        \end{InnerPrizeBox}%
        }%

    \foreach \i in {1,2,...,5}{%
        \begin{InnerPrizeBox}%
            \begin{ocg}{s\i-500}{s\i-500}{1}{\hyperlink{s\i-500}{500}}\end{ocg}
        \end{InnerPrizeBox}%
        }%
    }

\newtcolorbox{QuestionHeadFoot}[1][]{
    enhanced,
    before=\vskip-.7ex,
    after=,
    arc=0pt,
    width=\paperwidth,
    boxrule=.4pt,
    colframe=white,
    center upper,
    center lower,
    interior style={
        top color=blue,
        bottom color=black
    },
    colupper=white,
    collower=white,
    valign=center,
    fontupper=\LARGE\bfseries,
    fontlower=\LARGE\bfseries,
    height=.176\paperheight,
    sidebyside,
    segmentation style={white,solid,line width=.4pt},
    #1
}

\newcommand{\header}[2]{
    \begin{QuestionHeadFoot}
        Subject #1 \tcblower #2
    \end{QuestionHeadFoot}
}

\newcommand{\footer}[1]{
    \begin{QuestionHeadFoot}[before=\vskip-2.7ex]
        \hyperlink{question#1}{Question} \\ \hyperlink{answer#1}{Answer} \tcblower
        \hideocg{#1}{Done!} \\ \hyperlink{home}{Home}
    \end{QuestionHeadFoot}
}

\newcommand{\content}[4]{
\begin{frame}
    \hypertarget<1>{answer#1}{}
    \hypertarget<2>{question#1}{}
    \hypertarget{#1}{}
    \header{#2}{#3}
  #4
    \footer{#1}
\end{frame}
}

\newtcolorbox{textarea}[1][]{
    nobeforeafter,
    height=6.2cm,
    boxrule=0pt,
    center upper,
    valign=center,
    #1
}

\begin{document}
\begin{frame}
\hypertarget{home}{}
\vspace*{-.5cm}
    \subjects{Subject 1}{Subject 2}{Subject 3}{Subject 4}{Subject 5}
    \prizes
\end{frame}

\content                       % 4 arguments
    {s1-100}                     % question internal identifier
    {1}                          % subject number
    {100}{                       % question prize
        \begin{textarea}[]         % question/answer content
        \only<1>{                  % answer content
            $4$
        }
        \only<2>{                  % question content
            How much is $2+2$ ?
        }
        \end{textarea}
    }
\end{document}

I'm not going to explain everything step by step, but it should be clear that I used the tcolorbox package for the blocks (much more flexible than the standard beamer blocks) and the ocgx package for implementing and "disappearing" effect for already visited questions.

This code is fully automatic, what you need to do is to fill it with the actual content. The correct links from/to questions are already there. Each question/answer will be included in a \content macro like this:

\content                       % 4 arguments
    {s1-100}                     % question internal identifier
    {1}                          % subject number
    {100}{                       % question prize
        \begin{textarea}[]         % question/answer content
        \only<1>{                  % answer content
            $4$
        }
        \only<2>{                  % question content
            How much is $2+2$ ?
        }
        \end{textarea}
}

which should be self-explanatory. By default I centered the question/answer content both vertically and horizontally, but it can be easily changed customizing the textarea environment.

After the user checks the answer by clicking "Answer", he must click "Done!" (to activate the ocg that hides the prize from the home page) and then "Home" to go back to the home page, which will have one less prize.

The entire preambleshould be placed in a .sty file or whatever so that the actual .tex files consists only of a "home" frame plus 25 \content macros.

Limitations

  • As already noted in Hide button after it's selected in Beamer Keyboard navigation breaks the entire game. This can be workarounded by employing a snarky host.
  • Since it uses the ocgx package this only works in Acrobat reader/pro/whatever. It is possible to remove the ocgx dependecy but then there is no simple way to hide already visited questions.
  • Unfortunately it seems there's no way to have a single button for both hiding the prize and going home.
  • This is not perfect by any means and should be more thoroughly tested.
  • I don't like this "jeopardy" game nor the BYOjeopardy layout ;)
  • 1
    Just an addendum: note that without leaning on something like ocgx/JavaScript/etc., you would have to generate pages for every possible path down the game tree. That means a game board for every configuration and a set of question pages for each game board (since the links would change). This blows up very, very, quickly. Exponential time/space, I'm pretty sure. – Sean Allred Sep 15 '14 at 15:07
  • 1
    @SeanAllred true story: at a certain point I was actually going to try that, but gave up very quickly :) – Nico Boni Sep 15 '14 at 15:11
  • Sorry, you didn't pose your answer in the form of a question. – Alan Munn Sep 15 '14 at 16:28
  • @AlanMunn what do you mean? Do you mean my answer is more suited to be a question? – Nico Boni Sep 15 '14 at 16:32
  • I guess you've never actually watched the show. :) The form of the game is that the clues are answers to questions, and the only valid way to get the points in the game is to pose your response in the form of a question. – Alan Munn Sep 15 '14 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.