Dear list,

I would like to create cloze texts for my students with ConTeXt.

Ideally, I would have a command \cloze[<width>]{<solution>} with the following 
functionality:

1) \cloze{<solution>} would insert an underlined gap in the text with a width 
of (say) 1.3 times the width of solution and puts the solution on top of it 
with centered alignment. I will then color the text read if the mode is 
‘teacher’ and in white if not.
2) \cloze[<width>]{<solution>} would do the same, but with a fixed width of the 
underline. The solution should then be flush left, maybe with a horizontal 
space of \quad.
3) The underline should allow for line breaks and hyphenation, but not such 
that only empty space is broken into the next line of left in the previous (see 
MNWE).

In this way, the student’s and teacher’s versions of the script will look 
exactly the same, except for the visible solution in the teacher’s version.

The macro \underbar does a good job in terms of line breaks and hyphenation. 
But it is "too smart" in the sense that it does not underline horizontal 
spaces. The MNWE below showcases problems with my naive attempts to achieve 
underlining:
- CLOZE 1 does not have any extra space.
- CLOZE 2 does not underline the horizontal spaces.
- CLOZE 3 does not show the underline, supposedly because the first text 
elements in it are white.
- CLOZE 4 shows that introducing fake characters is not a good idea anyways 
because the cloze is broken without any “real” solution in the first line.
- CLOZE 5 shows the same for trailing space.

MNWE:
\starttext
\input ward
\underbar{\color[red]{CLOZE 1}}
\input ward
\underbar{\quad\color[red]{CLOZE 2}\quad}
\input ward
\underbar{\color[white]{x}\quad\color[red]{CLOZE 3}\quad\color[white]{x}}
\input ward
\underbar{\color[green]{x}\quad\color[red]{CLOZE 4}\quad\color[white]{x}}
\input ward
space \underbar{\color[red]{CLOZE 5}\qquad\color[white]{x}} space
\input ward
\stoptext

I would greatly appreciate help with this problem.

Thanks so much in advance!
Florian

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to