Problems adding multiple card types to a note

Hey guys and girls, I know this is not new, in fact, I saw that the same issue was posted last year but with no answer. I have watched the youtube videos and read up on this with no luck in finding a solution :sob: So Iā€™m going to repost and hope someone can help. I am using the desktop app for Mac and I have a note that looks like this:


I want to create multiple cards from this one note. When I click on the top right ā€œOptionā€ button, all it says is ā€œBrowser Appearanceā€. I have no way to add multiple card types to this note here.
Any solutions would be greatly appreciated. I have a bunch of excel sheets that I want to import into this so I can start studying and this is the second to last step holding me back, Iā€™m new to Anki and pretty excited Iā€™ve gotten this far :joy:
Thanks, Amanda

Hello,
unfortunately, what is blocking you is the fact that your note type is a cloze-deletion. Currently, since a cloze deletion note generates cards not based on template, but based on the content of fields, cloze-deletion are a special type of note, which handles cards on its own. You simply cannot change / add / remove cards from a cloze-deletion note.

Thus, try switching to a ā€œnormalā€ note type.

2 Likes

@BlackBeans Thanks for the info, that is very helpful and good to understand how that works. If I do switch to a ā€œnormalā€ card is there a way to add a Hint Card with a Cloze-deletion? I was trying that yesterday and it didnā€™t seem to workā€¦
Thanks, Amanda

No, but cloze-deletion are not supposed to be made for hints. Actually, Iā€™m not sure I understand what you mean by a hint-card with cloze-deletion.

If you are thinking of making so that one note will generate multiple cards, with different difficulties (ie. one which is a cloze-deletion with context, one without context, ā€¦), I think you should instead consider making a single card which modifies its view according to its state (ie. is a new card, a review card, a learning card, ā€¦).

As an aside, if you wanted to ā€œmimicā€ the behavior of a cloze card, you could simply do that with some javascript.
For instance, if I wanted to have something like This is a {{c1::great}} example in the cloze-hint field, you could add some ā€œcustomā€ delimiter like This is a {%great%} example, then simply have a card that shows this field both in the front and back template, but like in the front template you would also have a javascript script that would replace {%great%} by [...], and in the back template, it would replace {%great%} by great. I am not a javascript developer, so I couldnā€™t give you the code, but this idea should work.

@BlackBeans Thanks for taking the time to provide the good and thorough info. What I am ultimately trying to do is to have the following cards. I would like to avoid using any coding (Javascript/ CSS) as possible as Iā€™ve never done any coding. What are your thoughts on this?

Card 1:
Front: English Word + Hint (with a Cloze Deletion) ā†’ Back: Hint Answer + German Word
Example: Front: the motorcycle + Ein {Cloze 1: Motorrad} ist lauter als ein Velo. ā†’ Back: Ein Motorrad ist lauter als ein Velo. + das Motorrad

Card 2:
Front: German Word + Hint (no Cloze) ā†’ Back: English Word
Example: Front: das Motorrad + Ein Motorrad ist lauter als ein Velo. ā†’ Back: the motorcycle

Card 3:
Front: English Word + Hint (with a Cloze Deletion) ā†’ Back: Hint Answer + German Word Type in Answer
Example: Front: the motorcycle + Ein {Cloze 1: Motorrad} ist lauter als ein Velo. ā†’ Back: Ein Motorrad ist lauter als ein Velo. + das Motorrad (but as a type in answer)

Thanks, Amanda

Ok, I understand what you are trying to do. I have the impression that Card 1 is a duplicated of Card 3, in the sense that you are asking the same information. I would suggest merging them into a single type in card. This is because the type in feature is to help you if you think you cannot reliably assert whether your answer was correct, so it is meant as a replacement of the simply show the back.

Also, I am afraid you cannot do what you want without javascript. But, no worries! First, there might be already some shared decks that have this pseudo-cloze-deletion feature. Secondly, we are here to help you if you really struggle.
For instance, I would recommend this deck as a starting point. Itā€™s a good starting point, because each note produces only one card. I will try to explain how it is built.

Letā€™s pick an example note from the deck, for instance ā€œto be hadā€. On the note, there is a short definition of the word that will be shown when studying. There are also two examples which contain the expression. I would like to point out that, if you look at the content of the fields, you might have the impression that the expression is used in the examples without markers, however when you actually preview the front side, the expression have been replaced with underscores. It will show something like

to be victimized or cheated

āš¬ When the jeweler confirmed that the diamonds that the woman had purchased abroad were really fake, she exclaimed, "___"!
āš¬ The angry customer complained about being overcharged at the store, asserting that this was the third time that he ___.

When you preview the back, it will turn into

to be had: to be victimized or cheated

āš¬ When the jeweler confirmed that the diamonds that the woman had purchased abroad were really fake, she exclaimed, "I've been had"!
āš¬ The angry customer complained about being overcharged at the store, asserting that this was the third time that he had been had.

Sweet, isnā€™t it? Itā€™s actually very simple.
In the front template, you have to add the following snippet at the bottom.

<script>
var cloze = document.querySelectorAll(".clozeDeleted");
for (var i = 0; i < cloze.length; i++) {
  cloze[i].textContent = "___";
}
</script>

This will automatically hide the cloze-deleted parts in the example. But, how does it specify which are these?

If you edit a field, and press [Ctrl+Shift+x] (or alternatively press the HTML Editor button which looks like </>), it will switch the current field editing to HTML editing (when the field is in HTML editing mode, lines are numbered, the font changes and the background darkens). Click again to switch back to normal mode.
To cloze-delete a portion of text, go in HTML editing mode, then add <span class="clozeDeleted"> on the left, and </span> on the right.
For instance, the first example

When the jeweler confirmed that the diamonds that the woman had purchased abroad were really fake, she exclaimed, "I've been had"!

will turn into

When the jeweler confirmed that the diamonds that the woman had purchased abroad were really fake, she exclaimed, "<span class="clozeDeleted">I've been had</span>"!

When you switch back to normal mode, you will see no difference.

Furthermore, if you look at the deck, you will see that they have different font faces and colors for the part of the text when the expression is used, which helps focusing the attention and remembering the right part of the example sentence, which IMO is quite nice. You could copy some of the design ideas.

1 Like

Also, you might want to learn the very basics of HTML, CSS and JavaScript. It might sound intimidating, but itā€™s actually some of the most beginner-friendly languages there are in the world. There are straightforward and easy-to-find tutorials for almost any questions you might have as a beginner. If you spend, letā€™s say, five hours of your time, it will pay off for the rest of your life if you consider using tools like Anki (five hours is a conservative estimation, assuming you never touched coding before). It might even be fun, if you enjoy learning (which is likely if you are using Anki) :slight_smile: .

2 Likes

@BlackBeans Amazingly helpful!!! It solved almost everything I wanted to do. Thank you so much for taking the time to be so thorough and provide examples. I donā€™t know if you saw my post that I deleted :upside_down_face: If so, I apologize, I got so caught up in creating the cards and diving into the example you gave me that I forgot you already addressed the cloze-deletion styling and formatting :crazy_face: The cards and styling turned out exactly as I wanted them :rocket: :smiley: Itā€™s so exciting to be able to learn the basics of code through Anki and create the study tools that will help me learn German :nerd_face:

My last and final step is to get me lists of vocabulary from Google Sheets into Anki. Iā€™ve done my research and found that there are several ways, downloading it as a .csv file, using LibreOffice (I have accents on words (ex. ƶ) so maybe this is best to use. But I was wondering if you know a way to link it directly or export directly from Google Sheets? I also saw there is a way to link Anki to Excel so it automatically updates on Anki if you change something in Excel, but I donā€™t have excel (just Apple Numbers). Anyways, just wondering what you would recommend here?

Thanks, Amanda

I have never personally used any spreadsheet to create Anki cards, but I know this is quite a common practice, so there is likely an add-on that will fit you. For instance, you might try this one, which seems close to what you are looking for.

You may also try this one, which allows you - if I understood well - to modify your deck either from the spreadsheet or directly from within Anki, and then to sync.

@BlackBeans Thanks, that link was helpful.
So I finally got everything sorted and did my first import. All went well except for some reason my 3rd Card - Type in the Answer doesnā€™t seem to be working now. The card is missing the Type in Answer option, but when I look at the preview it shows it with Type in Answer. I thought I would run it by you to see if you see any issues with the code or have any suggestions as to why its not showing up.



Here is the code Iā€™m using:

As always, many, many thanks! Amanda

Strange, there doesnā€™t seem to be anything wrong to me. Since you have two copies of the same card, one with the type-in, and one without, are you sure it is not showing you the one without?

@BlackBeans Could be. Iā€™ll get on with studying and see how it works out. So excited, thanks for all of your help and encouragement :pray: :hugs:
Amanda

This has been a fascinating conversation which I have also learned from, so thanks to you both!

I am trying to include 2 clozeDeleted items in my cards - which is working fineā€¦ but in the example you have used (BlackBeans) each card has manual entries for the answers. So, I am trying to include the field names instead to make that more automated. Suffice to say, it ainā€™t working! Below is my html codeā€¦

<span>For the Greek word <i><span class="greek">{{Greek}}</span></i> the transliteration is <i><span class="clozeDeleted headword-example transliteration">ho</span></i> and the English meaning is <i><span class="clozeDeleted headword-example english">the.</span></i></span>

The first field is where Iā€™m trying to automate things. I will extend this to the other fields when itā€™s working. Below is the preview of this cardā€¦

Would really appreciate your thoughtsā€¦
Many thanks once again for this threadā€¦

p.s. the back of the card is not yet finishedā€¦ Iā€™m just looking at the frontside first.

In fact I have streamlined the htmlā€¦ but for some reason the answers are not showing up on the back of the cardā€¦

<span>For the Greek word <span class="greek">į½</span> the transliteration is <i><span class="transliteration clozeDeleted">ho</span></i> and the English meaning is <i><span class="english clozeDeleted">the.</span></i></span>

Many thanks!

Hi @martinhansell. I see what you are trying to do. I honestly do not have any answers for you, unfortunately. I am a complete novice at this myself and it was @BlackBeans who showed me how to do everything. It would save so much time if there were a solution for what you are trying to do. It takes me ages to create my cards for every new set of vocabulary. If you find a solution please share it with me. I hope someone out there is able to help as it can be very frustrating. Best of luck and sorry I cannot be of any help.

The snippet

<script>
var cloze = document.querySelectorAll(".clozeDeleted");
for (var i = 0; i < cloze.length; i++) {
  cloze[i].textContent = "___";
}
</script>

hides everything that should be cloze deleted. You only put it in the front side, hoping it would only affect that side. However, in your Back Template, you have {{FrontSide}}, which is replaced by the content of the Front Template, including the hiding snippet. I think thatā€™s why it does not work.

To solve this issue, you could simply remove {{FrontSide}}, and replace it by {{Question}}, since this seems to be the only content of you Front Template that you want in the Back Template too. This solution might seem a little bit ugly, in the sense that if, in the future, you want to add things in your front template, youā€™ll have to add them twice (even though, for now, it will probably Just WorkĀ©). Iā€™m sorry for this inconvenience, but I wouldnā€™t know how to patch that. Despite the appearances, I am not a javascript programmer (actually I kinda despise that language), so all I do is harvest code from other sources. In this case, this snippet comes from the deck I gave a link to previously. All this to say Iā€™m not capable of improving the code to patch this minor issue. Hope it doesnā€™t annoy you too much. :slight_smile: