Open VincentPf opened 6 years ago
Hi Vincent, Thanks for the report. The issue could either be due to the way LaTeX is handled by Anki's templating engine, or caused by the JavaScript code used to remove the cloze markers in the original hint.
As this issue likely only facts a very small portion of the add-on's userbase, I don't have time to investigate it right now. However, if you get the chance yourself you could try messing around with the following lines in your OC card templates and see if you can get things to work properly:
var hint = document.querySelector('.fullhint>[id^="hint"]')
var html = hint.innerHTML.replace(/\[\[oc(\d+)::(.*?)(::(.*?))?\]\]/mg, "$2")
(If this is crucial to your workflow and you don't have time to look into it yourself I would also be happy to work on it against a small fee. In that case feel free to send me an email at ankiglutanimate[αt]gmail.com).
Thank you for your reply.
I think the problem is that the LaTeX part generates an image and then the JavaScript code tries to remove the cloze markers from that image (which obviously won't work). In order for it to work properly, the cloze markers would have to be removed before the image of the LaTeX part is generated. Therefore, I don't think that changing the lines in the card templates will help.
Right, that's definitely it. With all of the recent porting efforts I was thinking in "Anki 2.1 mode" where MathJax is the preferable way to render LaTex.
In that case I'm afraid there isn't much I can do. It's possible to modify the card renderer and apply changes to the source text before it's passed on to the LaTeX compiler, I did so for Sequence Inserter. However, modifying the card rendering code is a very ugly affair and not portable across other platforms.
So perhaps the best way to handle this would be to set it aside until the add-on is 2.1 compatible and then look into making the hints work with MathJax.
So perhaps the best way to handle this would be to set it aside until the add-in is 2.1 compatible and then look into making the hints work with MathJax.
Sounds good.
I want to use the cloze-overlapper addon and LaTeX together. The following example works fine except that somehow the cloze syntax does not get removed from the Show Original hint.
I would be very grateful for any help.
Sincerely, Vincent