Monday, 11 March 2019

Creating fill-in-the-blanks handouts with LaTeX beamer

For some of my lectures I wanted to create handouts with blanks to fill in for the students. latex/beamer allows you to do this in a very convenient way. But it took me a while to figure out how to do this. This is why I just wanted to write a little memo in this blog post.

The preamble looks like this
\documentclass[compress,transparent,10pt
,handout
]{beamer}

% toggle print-out to the handout for fill-in-the-blanks part
%\newcommand{\ho}{}
\newcommand{\ho}{|handout:0}
With the initial handout tag I can toggle between handout mode and normal mode in latex. With the \ho tag I can decide whether the handouts are filled in or not.

Let's look at the following code
\begin{frame}
\frametitle{Energy and waves}
\begin{block}{Planck law}
\onslide<2-\ho>{\[ E = h\nu \]}
\end{block}

\begin{block}{Speed of light}
\onslide<3-\ho>{\[ c = \nu\lambda \]}
\end{block}

\begin{description}
\item[$E$] Energy
\item[$h$] Planck constant, $h=6.626\times 10^{-34}Js$
\item[$c$] Speed of light, $c=2.997\times 10^8 m/s$
\item[$\lambda$] Wavelength of light
\end{description}

\end{frame}
This can be compiled in three different ways. For the initial student printout I am using the commands as shown above to obtain:

If I want to fill in the blanks, I just change the following:

% toggle print-out to the handout for fill-in-the-blanks part
\newcommand{\ho}{}
%\newcommand{\ho}{|handout:0}
to get

And for my lecture I uncomment the "handout" part to get three separate slides where the equations appear on click:


No comments: