[LON-CAPA-users] More elegant conditional text?

Todd Ruskell lon-capa-users@mail.lon-capa.org
Thu, 07 Feb 2008 16:36:59 -0700


Hello master problem coders,

I'm wondering if there's a more elegant way to do something like the
following:

<startouttext />
A bunch of text
<block condition="$smallChoice == 1">
 <m>$\mathrm{KE}_1=(1/2)Mv^2$</m>
</block>
<block condition="$smallChoice == 2">
<m>$p=mv$</m>
</block>
More text.
<endouttext />

What I'd like to do is more like this:

<startouttext />
A bunch of text $array[$smallChoice] More text
<endouttext />

The difficulty for me is the math tags.  I haven't found the magic
incantation to embed the math tags in perl variables such that it
actually gets passed through the parser before being displayed.

I also explored randomlist, but it appears as though that is pretty much
limited to choosing between different <part> or <response> tags, rather
than simple text.

Can someone enlighten me?

Thanks,

Todd
-- 
Dr. Todd Ruskell
Senior Lecturer, Department of Physics       Office:  Meyer Hall 326
Colorado School of Mines                     Phone: 303-384-2080
1523 Illinois Street                         Fax: 303-273-3919
Golden, CO 80401