// Numbas version: exam_results_page_options {"name": "How to substitute randomised raw LaTeX into question text", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"maxRuns": 100, "condition": ""}, "rulesets": {}, "variables": {"a": {"group": "Ungrouped variables", "definition": "\"x\"", "description": "", "templateType": "anything", "name": "a"}}, "functions": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "
A table showing how to substitute raw LaTeX code into question text.
\nNOTE: You probably don't want to do this! There's usually a more robust way, where you get Numbas to make the expression for you.
"}, "name": "How to substitute randomised raw LaTeX into question text", "advice": "", "tags": [], "preamble": {"css": "td {\n padding-bottom: 0.6em !important;\n padding-top: 0.6em !important;\n}\ntr:not(:last-child) td {\n border-bottom: 1px dashed #ccc;\n}\ntd:first-child {\n text-align: left !important;\n}\ntd:nth-child(2) {\n text-align: center !important;\n}\ntd:last-child {\n padding-left: 2em !important;\n font-size: 0.8em;\n}", "js": ""}, "ungrouped_variables": ["a"], "statement": "In the following, the variable a
has the value \"x\"
Code | \nDisplay | \nExplanation | \n
---|---|---|
$\\simplify{ {a} }$ | \n$\\simplify{ {a} }$ | \na is a string, so set in \\textrm | \n
$\\var{a}$ | \n$\\var{a}$ | \na is a string, so set in \\textrm | \n
${a}$ | \n${a}$ | \nNo substitution - this is plain LaTeX | \n
{a} | \n{a} | \nSubstituted in plain text, not LaTeX | \n
$\\simplify{ {latex(a)} }$ | \n$\\simplify{ {latex(a)} }$ | \n\\simplify can't have bits of stray LaTeX inside it since it needs to rearrange the expression, so the latex() function is ignored. | \n
$\\var{latex(a)}$ | \n$\\var{latex(a)}$ | \nThe latex() function marks the string as raw LaTeX code | \n
${latex(a)}$ | \n${latex(a)}$ | \nNo substitution - this is plain LaTeX | \n
{latex(a)} | \n{latex(a)} | \nSubstituted in plain text, not LaTeX | \n
$\\simplify{{a_undefined}}$ | \n$\\simplify{{a_undefined}}$ | \nThe variable a_undefined is not defined, so the name is rendered as-is without substitution. | \n
$\\var{a_undefined}$ | \n$\\var{a_undefined}$ | \nThe variable a_undefined is not defined, so the name is rendered as-is without substitution. | \n
$\\var{latex(a_undefined)}$ | \nMath Processing Error | \nThe latex() function expects a string, not an unbound variable name, so fails. | \n
{a_undefined} | \n{a_undefined} | \nThe variable a_undefined is not defined, so the name is rendered as-is without substitution. | \n