LaTeX into Cloze

LaTeX into Cloze

Roberto Catanuto -
Erantzun kopurua: 6

Moodle 3.9.8+

I tried repeatedly to find a solution to this problem, but none was found. If I want to write something like this

{2:MULTICHOICE_S:=$$2^8$$#Right~3.6#Wrong}

Moodle only interprets the second option and skips the first one.

How do you (Math(s) teachers) insert code into cloze (if any) ?

Thank you

Puntuazioen batez bestekoa: -
Roberto Catanuto(e)ri erantzunda

Re: LaTeX into Cloze

Dominique Bauer -
Documentation writers-ren irudia Particularly helpful Moodlers-ren irudia Plugin developers-ren irudia

Hello Roberto,

The MULTICHOICE (MC) sub-question, as well as the MULTICHOICE_S (MCS) sub-question, of the Cloze question type rely on the <option> tag, where the answer is presented as a dropdown list of choices. There is no way to pass code with this tag because its permitted content is only "text, possibly with escaped characters". In other words, you cannot have equations with the MC or MCS questions.

However, you can have equations in the MULTICHOICE_V (MCV) and MULTICHOICE_H (MCH) sub-questions, as well as in the MULTICHOICE_VS (MCVS) and MULTICHOICE_HS (MCHS) sub-questions, where the answer is presented as a list of radio button choices. You can also have equations in the feedback of MCV, MCH, MCVS and MCHS questions. You can use LaTeX, MathML or AsciiMath.

With MCV, MCH, MCVS and MCHS questions, because { and } are used as delimiters by the Cloze question, if you're using LaTeX, you need to replace { with its HTML entity reference &#123; and } with &#125;. Also, most of the time, you will want to use \( and \) as delimiters for display within text, not on its own line with \[ and \] and not the older delimiters $$ and $$.

Here is an example:


https://moodleformulas.org/course/view.php?id=89&section=15 ↗

Puntuazioen batez bestekoa:Useful (2)
Dominique Bauer(e)ri erantzunda

Re: LaTeX into Cloze

Roberto Catanuto -
Good to know.
Any way yo use something simpler than "{ }" ?
Roberto Catanuto(e)ri erantzunda

Re: LaTeX into Cloze

Dominique Bauer -
Documentation writers-ren irudia Particularly helpful Moodlers-ren irudia Plugin developers-ren irudia

{ and } are used as delimiters by the Cloze question. They are also used quite often in LaTeX syntax.

If you find the syntax of LaTeX too complicated, you could use AsciiMath ↗ which is very simple. On my site, I sometimes have to reload the page for AsciiMath equations to display correctly, but maybe it's my settings that are set incorrectly.

If you only want to display 2⁸, you can use the ⁸ characters. You will find the superscript digits for example at http://www.amp-what.com/unicode/search/super ↗.

Dominique Bauer(e)ri erantzunda

Re: LaTeX into Cloze

Roberto Catanuto -
Sorry for the misunderstanding.
When I wrote '{' and '}', I originally typed their HTML entity references, beginning with "&#"...
Hence, the html converted them to { and }.

The question was about using something simpler than the entity references beginning with "&#" ...

Thanks
Roberto Catanuto(e)ri erantzunda

Re: LaTeX into Cloze

Dominique Bauer -
Documentation writers-ren irudia Particularly helpful Moodlers-ren irudia Plugin developers-ren irudia

With a client-side workaround that uses a little JavaScript code, equations can still be displayed in a multiple-choice Cloze question with a drop-down list. The workaround is to simply disguise radio buttons as a drop down list.

Here is an example:


https://moodleformulas.org/course/view.php?id=89&section=31 ↗