// Numbas version: finer_feedback_settings {"name": "Ben's copy of Displaying a randomised LaTeX command", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Ben's copy of Displaying a randomised LaTeX command", "tags": [], "metadata": {"description": "

Demonstrates how to create variables containing LaTeX commands, and how to use them in the question text.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

If you don't wrap the string in the latex function, it's displayed as plain text: $\\var{expression}$

\n

The correct way to do it is as follows: $\\var{latex(expression)}$

\n

$\\var{latex(join(split(\"123 123\",\" \"),\"\\\\ \"))}$

\n

$\\var{latex(tryThis)}$ vs $\\simplify{{latex('\\frac{3}{2}')}}$

\n

$\\simplify{{latex(tryThis)}}$ !!

\n

$\\simplify{4*{expression('x')}}$  --- is this how to get random variables?!

\n

\n

$\\var{latex('\\frac{1}{2}')}$

\n

\n

$\\var{test}$ $\\var{blah}$

\n

\n

{text} {math}

\n

{if(a=0,\"\\$\\\\frac\\{\\\\simplify\\{x^2-2x+12\\}\\}\\{x(\\\\simplify\\{x-\\{b\\}\\})(\\\\simplify\\{x-\\{c\\}\\})\\}\\$\",\"\\$\\\\simplify\\{(x^2-2x+12)\\/((x-\\{a\\})(x-\\{b\\})(x-\\{c\\}))\\}\\$\")}

\n

{latex(something)} 88

\n

pro

\n

{pro}

\n

{latex(pro)}

\n

$4\\var{pro}$

\n

$4\\var{latex(pro)}$

\n

latex(pro)

\n

{lpro}

\n

$4\\var{lpro}$

\n

$\\simplify{4{expression(pro)}}$

\n

epro

\n

{epro}

\n

$\\var{epro}$

\n

$\\simplify{4{epro}}$

", "advice": "", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"test": {"name": "test", "group": "Ungrouped variables", "definition": "latex(\"\\\\sqrt{2}\")", "description": "", "templateType": "anything", "can_override": false}, "expressions": {"name": "expressions", "group": "Ungrouped variables", "definition": "[\n\"\\\\frac\\{1\\}\\{2\\}\",\n\"\\\\sin(x)\",\n\"2 + \\\\hat\\{x\\}\"\n]", "description": "", "templateType": "anything", "can_override": false}, "tryThis": {"name": "tryThis", "group": "Ungrouped variables", "definition": "'\\\\sqrt\\{x\\}'", "description": "", "templateType": "anything", "can_override": false}, "text": {"name": "text", "group": "Ungrouped variables", "definition": "\"blah\"", "description": "", "templateType": "anything", "can_override": false}, "math": {"name": "math", "group": "Ungrouped variables", "definition": "5^2", "description": "", "templateType": "anything", "can_override": false}, "expression": {"name": "expression", "group": "Ungrouped variables", "definition": "random(expressions)", "description": "", "templateType": "anything", "can_override": false}, "blah": {"name": "blah", "group": "Ungrouped variables", "definition": "5", "description": "", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(0,1)", "description": "", "templateType": "anything", "can_override": false}, "something": {"name": "something", "group": "Ungrouped variables", "definition": "if(a=0,\"\\\\frac\\{\\\\simplify\\{x^2-2x+12\\}\\}\\{x(\\\\simplify\\{x-\\{b\\}\\})(\\\\simplify\\{x-\\{c\\}\\})\\}\",\"\\\\simplify\\{(x^2-2x+12)\\/((x-\\{a\\})(x-\\{b\\})(x-\\{c\\}))\\}\")", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "2", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "2", "description": "", "templateType": "anything", "can_override": false}, "pro": {"name": "pro", "group": "Ungrouped variables", "definition": "random('x','y','z')", "description": "", "templateType": "anything", "can_override": false}, "lpro": {"name": "lpro", "group": "Ungrouped variables", "definition": "latex(pro)", "description": "", "templateType": "anything", "can_override": false}, "epro": {"name": "epro", "group": "Ungrouped variables", "definition": "expression(pro)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["expressions", "expression", "test", "tryThis", "blah", "text", "math", "a", "something", "b", "c", "pro", "lpro", "epro"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

type in {pro}

", "answer": "{epro}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}