I am making notes with blanks to fill in and would like to produce an instructor version with blanks filled in and a student version with blanks unfilled.
I would like a \fillin{ . . . }
command that wraps text and allows math. The solution from Create fill-in-the-blank version of a document with ability to toggle blanks on and off works well for wrapping text, but censor
does not allow math (or other font switching):
\documentclass{article}
\usepackage{censor}
\censorruledepth=-.2ex
\censorruleheight=.1ex
\begin{document}
\xblackout{this works fine this works fine this works fine this works fine this works fine this works fine this works fine this works fine this works fine this works fine }
\xblackout{this does not work $a+b$ this does not work $a+b$ this does not work $a+b$ this does not work $a+b$ this does not work $a+b$ this does not work $a+b$ this does not work $a+b$ this does not work $a+b$ this does not work $a+b$}
\end{document}
One idea I tried was to use ulem
's uline
, but color text white for the student version. This works for math mode, but text-wrapping fails:
\documentclass{article}
\usepackage{ulem,xcolor}
\newcommand{\fillin}[1]{\uline{\textcolor{white}{#1}}}
\begin{document}
\fillin{This allows math mode $a+b=c$, but the text-wrapping is broken This allows math mode $a+b=c$, but the text-wrapping is broken This allows math mode $a+b=c$, but the text-wrapping is broken}
\end{document}
Best Answer
Both
ulem
andsoul
can achieve what you're after, although it seems that the latter is slightly preferred. In the following examples, texts are colored red only for illustration purposes. Changing the color to white will "hide" the texts.Code
Output