Extra backslashes when exporting Tex

Extra backslashes when exporting Tex

by Art M -
Number of replies: 3

Hi all,

I'm creating the following numerical question in Tex in Moodle 1.9 (without space between $$):

Simplify $ $\frac{4}{4}$ $.

After exporting as a gift format, this is what I get in the file:

Simplify $ $\frac\{4\}\{4\}$ $.

Can anyone explain why the extra backslashes? When imported back, it reads fine. Thanks.

Average of ratings: -
In reply to Art M

Re: Extra backslashes when exporting Tex

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yes. { and } are special characters in the GIFT syntax, so they need to be escaped.

In reply to Tim Hunt

Re: Extra backslashes when exporting Tex

by Art M -

Thanks for the quick reply. I understand that the gift filter needs these escapes, however, knowing that anything between $$ is a Tex expression, why couldn't the gift filter interpret it literally?

In reply to Art M

Re: Extra backslashes when exporting Tex

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You seem to be assuming that the GIFT import is intelligent.

It actually just parses the input using some regular expressions.