maths / moodle-qtype_stack

Stack question type for Moodle
GNU General Public License v3.0
138 stars 147 forks source link

Shortcut for stackvector() #1198

Closed Famondir closed 2 days ago

Famondir commented 1 month ago

Hi all, a teacher here wants her students to type in formulas marking vector elements. Instead of $F = m \cdot a$ she wants to get $\vec{F} = m \cdot \vec{a}$. Unfortunately the stackvector() function ist pretty long. Defining vec(x) := stackvector(x)in the question variables helps shorten the required input for students but does not get evaluated in the validation.

Using JS to parse the input of the student and replacing vec( with stackvector( did not work out, because the AJAX validation does not get triggered and would have been a workaround anyhow.

Is there a way to let students specifiy which elements are vectors and which not already or planned for future?

Furthermore it would be nice if the stackvectortex option gets send to the validation not only texput options.

Sincerely Simon

aharjula commented 1 month ago

Sounds very much like yet another case for that "preamble", i.e. some way of declaring that this part of question variables should be present when validation gets processed.

So, at this point, the preamble could contain:

sangwinc commented 1 month ago

@LukeLongworth would you like to comment on how this relates to your work on a linear algebra library?

LukeLongworth commented 1 month ago

Thanks for the ping Chris! I think that my thoughts are summed up in #1133 which Matti referenced above. The things that I would most like to have access to would be:

aharjula commented 1 month ago

That omitting of library texput rules is a great example, we can even take it one step further, just imagine a common linear algebra library with tunable rules so that the logic stays the same, but if one, for example, wants to have arrows on top of their vectors (or not), they can simply set an option (some library-specific variable before including the library) to pick that particular styling. But for that to be possible, we really need to have the ability to have arbitrary logic wrappers for those texput rules.

sangwinc commented 2 days ago

Yes, this will ne fixed with issue #1133.