The reason you are seeing the results that you are is that commands are performed before math is processed within BEGIN_TEXT/END_TEXT, so after the RadioButton menu is inserted into the problem, with something like
<input type="radio button" value="\(\frac{2x}{3x}\)"> \(\frac{2x}{3x}
both copies of the math are processed, and that inserted HTML into the value
attribute, which is illegal, and it turns out that it ends the <input>
element early, leaving part of the rest of the HTML as plain text rather than tags. This is why you see things like ">
or [math]
with a second copy of the math.
I will need to see what I can do with the RadioButton object to improve the situation, but haven't had the chance to work on it yet.