Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add space between double curly braces to fix issues with cloze cards #508

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

niposch
Copy link
Contributor

@niposch niposch commented Jan 25, 2024

Without spaces between double curly braces in Equations inside cloze deletions, this happens in anki:
image

If we change the math from this:

\frac{\{P\land E\} S \{P\}}{\{P\}\text{while E do S}\{P\land \lnot E\}}

to this:

\frac{\{P\land E\} S \{P\} }{\{P\}\text{while E do S}\{P\land \lnot E\} }

It solves the issue and displays the math properly when reviewing cards.

Resolves #313

@niposch
Copy link
Contributor Author

niposch commented Jan 25, 2024

Apparently it is possible to do cloze deletions inside math in anki, so this might need a more elaborate approach than just adding a space between every curly.

Anki seems to use this regex for clozes so maybe just matching that and leaving them as is and adding spaces to all other double curlies should resolve this issue:
https://github.com/ankitects/anki/blob/29f9f0dca7799cf270eb41c51a9db0c3ad9fa47d/ts/editable/mathjax.ts#L85

@ShootingKing-AM
Copy link
Member

ShootingKing-AM commented Jan 27, 2024

Maybe you can add as an Custom fix, and with a setting which is default off, else it may have unintended side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants