<text><![CDATA[<p>This question shows one can use client-side JavaScript to pre-process the answer and thus allow custom syntax, like operators. This is largely inspired by the issue <ahref="https://github.com/maths/moodle-qtype_stack/issues/938">#938</a>. What we do is as follows:</p>
<ol>
<li>We have some magical operator like <code>a £ b</code> that maps to a function like <code>pound(a,b)</code>. But we do not and cannot define it as an operator on the CAS side.</li>
<li>On the CAS side we have two things, firstly a `texput` rule rendering that function as an operator. And secondly, something that turns the teacher's answer into a string where we map that function into operator-like syntax.</li>
<li>We then have a hidden algebraic input <code>ans1</code> with a visible validation and the special option of <code>hideanswer</code> to stop the teachers answer from being shown. This will be the input that goes into PRTs. The teacher's answer for this will be the function form of the correct answer.</li>
<li>What the student acts on is a secondary string type input <code>ans1b</code> which has no validation and no direct role in PRTs. The teacher's answer for this will be the operator form of the correct answer.</li>
<li>Finally, we will have a <code>[[escape]][[javascript]]][[/escape]]</code>-block that listens to <code>ans2</code> for changes parses it and converts it to the function format to be pushed into <code>ans1</code>.</li>