Skip to content

How to make cloze cards inside math and code?

debanjandhar12 edited this page Dec 12, 2021 · 4 revisions

Logseq's Cloze Syntax and Cloze Org Blocks are great for making normal cloze cards. But using those syntax to make cards inside latex math and code is messy. In those cases we can use the replacecloze property.

(a) replacecloze Property

The replacecloze property takes a sequence of strings and regex as input and converts the matching values in the block to clozes. Although, the sequence needs not to be wrapped by quotes ("), it is however recommended to do so as logseq will recognize it as a page otherwise.

Example 1

replacecloze:: " '\sqrt{ a^{2}+b^{2} }' "
The Pythagorean theorem is
$$c=\sqrt{ a^{2}+b^{2} }$$

ReplaceClozeTut1.gif

Example 2

replacecloze:: " 'a^{2}+b^{2}', /(c\^2|c )/gi "
The Pythagorean theorem is
$$c =\sqrt{ a^{2}+b^{2} }$$
$$c^2= a^{2}+b^{2}$$

ReplaceClozeTut2.gif