l3kn / org-fc

Spaced Repetition System for Emacs org-mode
https://www.leonrische.me/fc/index.html
GNU General Public License v3.0
258 stars 31 forks source link

Using latex with curly braces results in improper cloze deletion cards #113

Closed vkar-hub closed 11 months ago

vkar-hub commented 11 months ago

Working example:

Some function {{ \(f: N \to R\) }}
Let {{ \(a_n\) }} be a sequence

Not working example:

Some function {{ \(f:\mathbb{N} \to \mathbb{R}\) }}
Let {{ \( \{ a_n \} \) }} be a sequence

The improper cards look like this:

* Let {{ \( \{ a_n \} \) }} be a sequence :fc: 
:PROPERTIES:
:FC_CREATED: 2023-09-18T11:50:14Z
:FC_TYPE:  cloze
:ID:       f1c05190-8e11-43d2-b8c3-c7e9bffbb526
:FC_CLOZE_MAX: -1
:FC_CLOZE_TYPE: deletion
:END:
:REVIEW_DATA:
| position | ease | box | interval | due |
|----------+------+-----+----------+-----|
:END:
l3kn commented 11 months ago

Because the cloze-hole syntax uses curly braces, it's hard to detect where a hole begins or ends when it is combined with latex. If you're fine with using the alternative $f:\mathbb{N} \to \mathbb{R}$ latex syntax, there's a special case in the regex for that and so far I haven't run into issues with it.

I'll take a look at the regex to see if a similar special case is possible for \(....\) inline-latex.

vkar-hub commented 11 months ago

Yeah $...$ works. I'll switch to using that. Thanks :)