Description
This was testing using pbs v0.8.1
.
Standard LaTeX to produce this code
is:
\sqrt{\rho_\mathrm{Cu} / \rho_\mathrm{Al}}
but in PrairieLearn question.html
files, the \rho
needs to be \\rho
when passed in from server.py
via mustache templating
data2["params"]["part1"]["ans1"]["value"] = '$\sqrt{\\rho_\mathrm{Cu} / \\rho_\mathrm{Al}}$'
Alternatively, the string can be made a raw string (which also works):
data2["params"]["part1"]["ans1"]["value"] = r'$\sqrt{\rho_\mathrm{Cu} / \rho_\mathrm{Al}}$'
Aside:
I thought another alternative, in question.html
, would be to surround the passed variable with triple curly braces:
<pl-answer correct= {{{ params.part1.ans1.correct }}}
but this does not work.
Due to recent changes in how pbs
handles unicode (namely #51), I think I have to do a find/replace to convert all \\
to \
in the instructor_physics_bank
, for example in this question from OPBP.
Unfortunately, because of the issue outlined above, it's not a simple matter of doing a find and replace to convert all \\
to \
.
So need to think about a way to do this without reviewing every question one by one.