st3v3nmw / obsidian-spaced-repetition

Fight the forgetting curve by reviewing flashcards & entire notes on Obsidian.md
https://www.stephenmwangi.com/obsidian-spaced-repetition/
MIT License
1.49k stars 183 forks source link

[FEAT]: Cloze within LaTeX blocks and snippets. #1100

Open JackHunt opened 2 hours ago

JackHunt commented 2 hours ago

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

It would be really great if cloze cards could be generated from LaTeX blocks, like so:

Pythagoras Theorem is: 
$$
{{ c^{2} }} = {{ a^{2} + b^{2} }}
$$

In the above example, I have used {{ and }} to indicate the cloze ({ and } aren't rendered in LaTeX unless escaped).

Similarly, this could work for inline LaTeX, like so:

Pythagoras Theorem is ${{ c^{2} }} = {{ a^{2} + b^{2} }}$

I have looked through the documentation, and as far as I can see, there is no way currently to achieve this, unless one were to split the LaTeX snippet like so:

Pythagoras Theorem is ==$c^{2}$== $=$ ==$a^{2} + b^{2}$==

where I have used == to indicate the cloze. Also, this would not work for more complex, multiline maths like so:

$$
\begin{align}
\left| \mathbf{u} \right| - \left| \mathbf{v} \right| &
\leq \left| \mathbf{u} + \mathbf{v} \right| \\
&{}\leq \left| \mathbf{u} \right| + \left| \mathbf{v} \right|
\end{align}
$$

Additional context

No response

ronzulu commented 2 hours ago

Hi @JackHunt there is code in the pipeline that I believe will help.

See the section "Custom Cloze Patterns" in https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/943

JackHunt commented 2 hours ago

Brilliant; looks like a nice PR in the works!