0

I use beamer slides to make flashcards for myself when learning new subjects. I would like to randomize the order in which the slides are presented (which helps me to memorize).

Is there an easy way to do this in beamer? Or maybe there is a package available?

There seem to be few flashcard document classes available, but these seem to have been designed so that one prints out the flashcards, and hence there is no "randomize" or "shuffle" option. I don't want to print the flashcards out. I just want to look at them on a screen.

Thanks in advance for any help and suggestions!

  • Can you show us, how you create the flashcarts? It might be easier to randomize the words being placed on the cards. – user36296 Jul 31 '16 at 17:22
  • Just to get a few side conditions: Should the order of frames be random or should the order just be shuffled (each card appearing exactly once, no more, no less)? – user36296 Jul 31 '16 at 17:26
  • Using Linux (or similar) you can produce the pdf in fixed order in LaTeX and then shuffle the pages randomly as many times as you like, see, e.g., unix.stackexchange.com/questions/209637/… – Marijn Jul 31 '16 at 22:25
  • It would be nice to know, if it's just single frame to be shuffled of if two frames with Q&A should stay in consecutive order. – user36296 Aug 1 '16 at 8:25
1

Based on How do I generate in LaTeX a list of random questions avoiding repetitions? and still very hacky.

The first slide will show the word in one language, on the next slide a translation in another language is added.

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{pgfmath,pgffor}

\makeatletter
\def\pgfmathrandomitemwithoutreplacement#1#2{%
    \pgfmath@ifundefined{pgfmath@randomlist@#2}{\pgfmath@error{Unknown random list `#2'}}{%
        \edef\pgfmath@randomlistlength{\csname pgfmath@randomlist@#2\endcsname}%
        \ifnum\pgfmath@randomlistlength>0\relax%
            \pgfmathrandominteger{\pgfmath@randomtemp}{1}{\pgfmath@randomlistlength}%
            \def\pgfmath@marshal{\def#1}%
            \expandafter\expandafter\expandafter\pgfmath@marshal\expandafter\expandafter\expandafter{\csname pgfmath@randomlist@#2@\pgfmath@randomtemp\endcsname}%
            % Now prune.
            \c@pgfmath@counta=\pgfmath@randomtemp\relax%
            \c@pgfmath@countb=\c@pgfmath@counta%
            \advance\c@pgfmath@countb by1\relax%
            \pgfmathloop%
            \ifnum\c@pgfmath@counta=\pgfmath@randomlistlength\relax%
            \else%
                \def\pgfmath@marshal{\expandafter\global\expandafter\let\csname pgfmath@randomlist@#2@\the\c@pgfmath@counta\endcsname=}%
                \expandafter\pgfmath@marshal\csname pgfmath@randomlist@#2@\the\c@pgfmath@countb\endcsname%
                \advance\c@pgfmath@counta by1\relax%
                \advance\c@pgfmath@countb by1\relax%
            \repeatpgfmathloop%
            \advance\c@pgfmath@counta by-1\relax%
            \expandafter\xdef\csname pgfmath@randomlist@#2\endcsname{\the\c@pgfmath@counta}%        
        \else%
            \pgfmath@error{Random list `#2' is empty}%
        \fi%        
    }}


\def\pgfmathrandomlistcopy#1#2{%
    \pgfmath@ifundefined{pgfmath@randomlist@#2}{\pgfmath@error{Unknown random list `#2'}}{%
        \edef\pgfmath@randomlistlength{\csname pgfmath@randomlist@#2\endcsname}%
        \pgfmathloop%
        \ifnum\pgfmathcounter>\pgfmath@randomlistlength\relax%
        \else%
            \def\pgfmath@marshal{\expandafter\global\expandafter\let\csname pgfmath@randomlist@#1@\pgfmathcounter\endcsname=}%
            \expandafter\pgfmath@marshal\csname pgfmath@randomlist@#2@\pgfmathcounter\endcsname%
        \repeatpgfmathloop%
        \expandafter\xdef\csname pgfmath@randomlist@#1\endcsname{\pgfmath@randomlistlength}%
    }%  
}
\makeatother


\begin{document}
\pgfmathsetseed{\number\pdfrandomseed} % seed for random generator

\pgfmathdeclarerandomlist{WordsMaster}{%
 {Canard \textcolor<1>{white}{Duck} }%
 {Poisson \textcolor<1>{white}{Fish} }%    
 {Chat \textcolor<1>{white}{Cat} }%          
}%

\newcommand*{\NumberOfQuizes}{3}%
\pgfmathrandomlistcopy{Words}{WordsMaster}

\foreach \QuizNumber in {1,...,\NumberOfQuizes} {%
    \pgfmathrandomitemwithoutreplacement{\RandomQuestion}{Words} 

\begin{frame}<1>
    \RandomQuestion
\end{frame}

\begin{frame}<2>
    \RandomQuestion
\end{frame}

}%

\end{document}

enter image description here

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.