## WeBWorK Problems

by Jay Belanger -
Number of replies: 2
Adding knowlLinks in a problem works fine, until I try to add some LaTeX in the knowlLink. When I try that, clicking on the link results in a series of characters instead of the message. (See attachment below.) This happens whether I use mathjax or images. I tried adding the LaTeX as shown on
http://webwork.maa.org/wiki/Knowls
(although that page seems to be missing the "\{", "value =>" and "\}".
Here's the (more-or-less) minimal example I used, and the output. (I don't know why there is a hash before "TEXT(beginproblem());, but I tried it with and without the has.)

Example
=======
DOCUMENT();

"PGstandard.pl",
"MathObjects.pl",
);

# TEXT(beginproblem());
Context("Numeric");
$ans = Compute("6"); Context()->texStrings; BEGIN_TEXT The answer is \{$ans->ans_rule\}
\{
value => escapeSolutionHTML(EV3P("the sine function is $$\sin(x)$$")));
\}
END_TEXT

Context()->normalStrings;
ANS( \$ans->cmp() );
ENDDOCUMENT();

### Re: LaTeX in a knowlLinks

by Davide Cervone -
You need to add base64=>1 to the knowlLink() call if you use escapeSolutionHTML(). You also need to double the backslashes if you use the knowl inside the BEGIN_TEXT/END_TEDT block.

So your call should look like

knowlLink("a math knowl",
value =>escapeSolutionHTML(EV3P("the sine function is \$$\\sin(x)\$$")), base64=>1);

I've edited the wiki page you linked to.