@Martin Scharrer suggested me the following amazing solution to make cloze texts: https://tex.stackexchange.com/a/16004/4011
\documentclass{article}
\usepackage[normalem]{ulem}
\makeatletter
\def\UL@putbox{\ifx\UL@start\@empty \else % not inner
\vrule\@width\z@ \LA@penalty\@M
{\UL@skip\wd\UL@box \UL@leaders \kern-\UL@skip}%
\phantom{\box\UL@box}%
\fi}
\makeatother
\begin{document}
Some text \uline{some text to complete some text to complete
some text to complete some text to complete some text to complete some text
to complete some text to complete} some more text.
\end{document}
Now I have some follow up questions about this approach:
- How can I adjust this such that I can choose all the "underline styles" offered by the ulem package
\dotuline
,\dashuline
,\uwave
and\uuline
? - How can I adjust the vertical space between the phantom text and the underline?
- Is it possible to get a normal working version of
\uline
at the same time? (Call it for example\Uline
,\Uuline
etc.).
Best Answer
Just use them.
\setlength{\ULdepth}{...}
The following example adds the switch
\ifulphantom
that can be set to enable or disable the phantom version for the macros of packageulem
.Full example: