The number of left curly brackets equal to the number of right curly brackets but some extra curly brackets are still shown outside the cloze.
Here’s the third cloze:
Here’s what the fourth and fifth look like for me:
The number of left curly brackets equal to the number of right curly brackets but some extra curly brackets are still shown outside the cloze.
Here’s the third cloze:
Here’s what the fourth and fifth look like for me:
I tried this and something else I found out was the 4th cloze doesn’t even generate any cards.
Possibly related:
So, this is here to stay?
Anyway, if someone is interested, please add this to the documentation. I opened an issue here: Number of Cloze is limited in Nested Cloze · Issue #313 · ankitects/anki-manual · GitHub
…but shouldn’t it be, well, not limited? I remember that this used to work before in some update but it no longer works anymore.
Pardon my ignorance but it seems like instead of there being some fundamental problem with having nested clozes, this is just removing or restricting a feature because actually fixing the bug was too hard.
I’d also prefer to be able to nest more than just 3 clozes. This used to work before one of the recent updates
After updating to 24.11, Anki reports empty cards for a few of my cloze cards. The reported cards have no missing clozes (the clozes Anki reports as missing are in fact there).
Redacted example card where Anki reports card 2 (and only card 2) as missing:
Title
A: {{c5::{{c4::{{c3::{{c2::{{c1::a}}::redacted}}::redacted}}::redacted}}::redacted}}
B: {{c5::{{c4::{{c3::{{c1::{{c2::b}}::redacted}}::redacted}}::redacted}}::redacted}}
C: {{c5::{{c4::{{c1::{{c2::{{c3::c}}::redacted}}::redacted}}::redacted}}::redacted}}
D: {{c5::{{c1::{{c3::{{c2::{{c4::d}}::redacted}}::redacted}}::redacted}}::redacted}}
E: {{c1::{{c4::{{c3::{{c2::{{c5::e}}::redacted}}::redacted}}::redacted}}::redacted}}
I think you’re seeing the outcome of this recent change, which hasn’t been resolved. Your marker for c2 is the only one that is always past the 3rd level of nesting (4, 5, 4, 4, 4), so it would be missing entirely.
Let’s see what the developers have to say.
Looking at the other incorrectly handled clozes, this seems to be the source, thanks.
It’s a dealbreaker for clozes imo, as cards using clozes to hide information that would give the answer away are basically impossible to create without a lot of nesting (or overlapping clozes, which aren’t a thing in anki).
I guess I will try to revert to an Anki version that supports nested clozes to a higher level…
Deeply-nested clozes require exponential amounts of computation (= hangs), and a library we depend on also has a hard limit on nesting depth, so it’s not feasible to support arbitrarily-deep nesting I’m afraid. The best we could do is increase the limit we’ve imposed a little, which might make existing users happier, but means future users who are trying to use cloze deletions for incremental reveal are more likely to invest more heavily in them before discovering the computational runaway or hard limits of the library.
The best we could do is increase the limit we’ve imposed a little, which might make existing users happier
OP’s workflow was a little complex but in both of their cases, the nested clozes were being used to hide more information than what was clozed. I think some of the nested cloze users can be helped with a “hide all, ask one” mode like there is with Image Occlusions. I personally often use an IO where I could’ve just used raw text with clozes because of this.
I believe nested clozes are the only way to properly break down complex mathematical information in Anki, hiding away steps of a proof independently or parts of a multi-step definition does almost nothing to help understanding. I have built a custom addon to automatically generate all subsets of N clozes and then select M out of them, allowing me to breakdown mathematics textbooks. Generally I use M=2*number of original clozes+1.
I have never experienced serious issues with hangs, albeit on fairly good hardware, while generating upwards of 20 cards from the same note.
I believe a limit should be imposed based on the number of subsets one can generate, for example with 3 facts one can generate 2^3-1 non-trivial clozes. Or based on the nesting level needed to hide subsets of a list in ascending order, e.g hide 1,2,3,4 independently and then {1,2}, {1,2,3}, {1,2,3,4}. For my collection a depth limit of 5-6 would still allow me to use most of my cards, although a limit of 10 would be necessary for me to be able to use all of my cards.
If the limit stays this low I would roll back to a previous version or fork anki, my primary concern however is ankimobile on IOS as this has rendered most of my collection unusable on mobile and I cannot roll back. For context my collection is over 20k notes with 60k cards. Since this is the only functionality that I care about, I would stop using ankimobile entirely with such a low limit.
I would also support making the limit customisable with a clear warning that it will increase compute time exponentially.
This is very intriguing. Since I have never used nested clozes myself, I am having a bit of trouble imagining how such notes are formatted. Do you have an example note to help educate me on how they work?
in the case of definitions, it is fairly straightforward as it involves hiding relevant pieces of information both independently and in a progressive fashion.
For example, hide the concept’s name first, then the main mathematical formula for computing it, and then part of the mathematical machinery needed to understand the formula.
In the following example, I hide the concept of volume, then the sum, then the fact that we take the infimum of the sum, and then I hide both the fact that we take the infimum and the sum. Thus, one has to learn atomic facts distinctly and then learn how to combine them. Proofs are much more involved and may have to be broken down into several notes, but I hope this helps illustrate the point.
In terms of actual generation they look like this
{{c1::{{c4::{{c6::{{c7::1}}}}}}}}
{{c2::{{c4::{{c5::{{c7::2}}}}}}}}
{{c3::{{c5::{{c6::{{c7::3}}}}}}}}
Or like this if the generation hits a limit early
{{c1::{{c5::{{c6::{{c9::1}}}}}}}}
{{c2::{{c5::{{c6::{{c7::{{c9::2}}}}}}}}}}
{{c3::{{c6::{{c7::{{c8::{{c9::3}}}}}}}}}}
{{c4::{{c8::{{c9::4}}}}}}
I’ll spin this out into an issue so it can be discussed further: Provide a 'hide all, show one' option for cloze deletions? · Issue #3626 · ankitects/anki · GitHub
@alx would such an option work for you, or are you relying on all previous context being revealed already?
Thanks a lot for looking into this,
Such a mode would be very useful but not sufficient for my collection. I would much prefer having the limit set low and customizable in some deep section of the settings for desktop and ankimobile with an ample flashing warning.
First, “hide all ask one” cannot progressively reveal the steps of a proof or ordered properties used in a definition. Thus, the “hide all ask one” would be still be inadequate for mathematics. The supermemo tips for learning directly recommend replacing enumerations with overlapping clozes.
Second, some of my cards also rely on clozing sub-groups. The selection procedure of my generator will prefer closeby clozes to combine into one cloze if it hits the cloze limit before generating all subsets, thus if I have an operator followed by a formula like: the determinant of a given function, it will hide each one independently and then both while providing clozes for all other facts I request as well.
In the simplest case of three facts 1,2,3, they could be arranged like this
In this case it is beneficial to be able to cloze all three independenly, to cloze Fact 1 and Fact 2 together, and to cloze all facts.
Finally, keeping all information from a note structured via nested clozes has advantages. For example, the FSRS add-on allows one to disperse siblings. Achieving this same nested-closed effect by refactoring the code to create new notes as soon as it reaches the depth limit on one note would make it impossible to track those siblings and thus to use the dispersion functionality. It would also inflate the number of notes in memory and thus storage needs.
To chime in as another nested cloze user:
I believe the hide all option (assuming it can be set to not reveal the other hints) solves the issues with simple (unordered) lists like my example above.
However, it creates a problem for cards solving a task too difficult or extensive for a singular card by approaching the problem step-by-step. These rely on the previous cards being visible (as context), but the following cards being hidden. Perhaps some sort of hide all following cards option could remedy this, if that is alright performance-wise?
Small example card:
Premise
{{c1::Answer 1::Q1}}
{{c1::{{c2::Answer 2 - using answer 1::Q2}}
{{c2::{{c3::Answer 3 - using answer 2, maybe also 1 - {{c4::Speciality about 3::Specialties?}}::Q3}}
{{c3::{{c4::More Content
::redacted}}::redacted}}::redacted}}::redacted}}
Thank you both for your detailed answers. Could I trouble you for a minimal example of where ‘hide all, ask one’ would not be sufficient? Coming from a background in the “minimal informational principle” and my own studies being primarily language-based, I don’t have a strong handle on when incremental reveal may be more appropriate.
The latest anki update appears to not allow nested clozes beyond three nests. For example:
In Egyptian Mythology, {{c3::Amon}} (or more accurately called {{c3::{{c6::Amun}}}}) was {{c2::king}} of {{c1::the gods}}. He was depicting with {{c4::blue::what color}} {{c5::skin}}. {{c1::{{c2::He was later {{c7::fused}} with {{c8::Ra::who?}} to form {{c3::{{c6::{{c8::{{c9::Amun-Ra}}}}}}}}}}}}.
will be rendered as:
In Egyptian Mythology, Amon (or more accurately called Amun) was king of the gods. He was depicting with blue skin. He was later fused with Ra to form Amun-Ra }}}}}}.
Note, the “}}}}}}” at the end of the card which should not be there. The latest version of anki will additionally not recognize cloze c9 in this example.
There was a bug with deeply nested clozes which is why in recent versions you cannot have more than 3 clozes nested. The limit might be increased in future versions and there is also the idea of having a “Hide all, Guess one” mode for clozes.
Ref: