Skip to content

LaTeX ; double slash or single slash #71

Open
@firasm

Description

@firasm

This was testing using pbs v0.8.1.

Standard LaTeX to produce this code

gif latex

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions