You
want to use $CARET if you are using ^ outside of math mode (that is, if
you plan to have a literal ^ in the output). You need to be careful
about any of the characters that TeX considers as special characters,
namely #, %, ^, &, _, ~, {, }, and \, and any that HTML uses as
special characters, namely &, < and >, if you are wanting
them to appear in the text of your problem. Some of these have macros
(like $CARET and $PERCENT) defined for them already, but others don't.
In those cases, you can define your own, such as
$POUND = MODES(TeX=>'\#', HTML=>'#");
You can put these into your own .pl file in your course's
templates/macros file and use loadMacros() to call them up when you
need them. You may need to be tricky to get some of the characters to
appear properly in TeX. For example,
$TILDE = MODES(TeX=>'{\tt\char`\~}', HTML=>'~');
should do. (Note that you can't use just \~, since that means put a tilde accent on the character that follows).If
you need to have letter or number follow one of these references with
no space in between, you need to use ${CARET} instead, as in
"10${CARET}n".
If you really want to do things right, you would also do things like
$LQ = MODES(TeX=>"``", HTML=>'"'); $RQ = MODES(TeX=>"''", HTML=>'"'); $LQS = MODES(TeX=>"`", HTML=>"'"); $RQS = MODES(TeX=>"'", HTML=>"'");
and then use ${LQ}Hello world!${RQ} rather than "Hello world!" (which
would have the wrong kinds of open quotes in TeX output), but few
problem authors are that careful.
If you are concerned about making things work in plain text mode (in
addition to images, formatted text and jsMath modes), then there are
even MORE characters macros you should be using (for example, $GE
rather than ge), but VERY few authors write with plain text mode in
mind (and I don't blame them, in fact, I've disabled it on our site
entirely).
Hope that helps.
Davide
<| Post or View Comments |>
|