## WeBWorK Problems

### Re: Getting dollar signs to show in TeX

by Davide Cervone -
Number of replies: 0
Apparently the extra processing being done on material in a BEGIN_TEXT/END_TEXT block (by EV3?) is causing the problem.

Bob is right, it is EV3 that is doing the damage. It lies behind the scenes for BEGIN_TEXT/END_TEXT, and it does three things: it processes commands between \{...}, it does variable substitution for $varname and it does math processing for $$...$$ and $...$. The three jobs are done in the order listed above. The commands are done first so that variables within the commands are not accidentally replaced before they are executed, and variable substitution is done next so that mathematics contained in the variables (or in the output of commands) will be processed properly. But that means that dollar signs that appear in the output of a command will have have variable substitution performed on it. That is what is happening with the output of your list. (That is why you saw "$10,000" turn into ",100", since the $10 is viewed as a variable with name 10 (which was empty, so substituted as nothing). The TEXT() call that Bob suggested does not process the text, but simply outputs it, so the variable substitution doesn't occur. Another approach would be to save the output in a variable and use that within the BEGIN_TEXT/END_TEXT instead of command execution (since it the result of variable substitution do not have additional variable substitutions performed on them). For example, $questions = $mc->print_q;$answers = $mc->print_a; BEGIN_TEXT$questions
$PAR$answers
END_TEXT


Hope that clears up some of it.

Davide