0

I would like to create slides where some sections of texts are replaced by underscores (or an underline of equivalent length) in the student handouts.

I have seen this solution but it only "blanks" the text. What I would like to do is replace it with underscores.

I have also seen this solution based on a customized \hideit command but I do not know how to replace the mbox by the appropriate number of underscores _ characters.

ECM taken from the second link:

\documentclass[handout]{beamer} 

\begin{document}

\begin{frame}{Test}

\begin{itemize}
\item Example of itemize:
  \mode<handout>{%
  \item Some text _____________________ 
  }%
  \mode<beamer>{%
  \item Some text to be replaced by underscores
  }%
  \item This is visible in both handout and presentation.
\end{itemize}
\end{frame}

\end{document}
Peutch
  • 2,182
  • 1
    See the censor package at, for example, http://tex.stackexchange.com/questions/125840/create-fill-in-the-blank-version-of-a-document-with-ability-to-toggle-blanks-on or this, http://tex.stackexchange.com/questions/165248/an-underline-with-texts-one-both-ends-of-a-line/165302#165302 – Steven B. Segletes Sep 01 '16 at 18:16

1 Answers1

2

If you want to replace some text with the equivalent width of underscores, you could use \underline{\phantom{some text}}. The following command creates both versions:

\documentclass[%
handout
]{beamer} 

\newcommand{\hide}[1]{%
\only<handout>{\underline{\phantom{#1}}}%
\only<beamer>{#1}%
}

\begin{document}

\begin{frame}{Test}

\begin{itemize}
\item Example of itemize:
\item Some text to \hide{be replaced with underscores}
\item This is visible in both handout and presentation.
\end{itemize}
\end{frame}

\end{document}

enter image description here