AD2 adds HTML codes to some cards might be the reason for bad LaTeX images

364 views
Skip to first unread message

Xiao Sun

unread,
Jun 25, 2013, 9:44:04 AM6/25/13
to anki-a...@googlegroups.com
Why does AD automatically random HTML data ( <span style .../span ) to the fields of some notes of the same note type but leave other notes alone?

From my observations the cards generated from notes with added HTML data have a chance of generating corrupt LaTeX image. 

The extra HTML information seem to do nothing as the cards without the HTML operate just fine and can display all their LaTeX image.

Flavio Lerda

unread,
Jun 26, 2013, 4:57:50 AM6/26/13
to anki-a...@googlegroups.com
Does this happen if you edit the cards on the phone/tablet?
Did you modify the LaTeX source?

FYI, modifying the LaTeX on the device will not be reflected in the corresponding card because AnkiDroid does not generate the LaTeX
images but delegates to Anki desktop for this to be done (as AnkiDroid does not include LaTeX, which would probably be a major requirement).

It might be possible to identify the LaTeX fields and either not allow editing or limit the editing to simple text.

Flavio



--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anki-android...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Flavio Lerda

Xiao Sun

unread,
Jul 23, 2013, 4:14:38 AM7/23/13
to anki-a...@googlegroups.com
Hi Flavio 

Sorry for the late reply. I don't quite understand your question, seems to technical for me however, to prove to you my theory that HTML codes corrupts LaTaX images I have uploaded 8 screenshots of four cards, two with corrupted LaTeX images and two with working LaTeX images. 

As you can see from the images, the ones with corrupted images have html codes added in by Andidroid in their LaTeX field. 


ddot.png
ddot2.png
mathbb1.png
mathbb2.png
mathbf.png
mathbf2.png
overleftarrow.png
overleftarrow2.png

Xiao Sun

unread,
Jul 23, 2013, 4:23:36 AM7/23/13
to anki-a...@googlegroups.com
This is on Samsung galaxy note 2 btw. No modifications have been made on the mobile device.  

Flavio Lerda

unread,
Jul 26, 2013, 1:52:39 PM7/26/13
to anki-a...@googlegroups.com
Looking at how the code has been modified, it would seem this was modified by the Desktop app's HTML editor.
AnkiDroid (as far as I remember) only does simple things like adding <br/> to fields where it finds newlines.
Is it possible that you have started editing some of the fields on the desktop and the content has been, somehow,
corrupted?

Flavio

Xiao Sun

unread,
Jul 26, 2013, 11:16:04 PM7/26/13
to anki-a...@googlegroups.com
All the notes on my desktop Anki is HTML code-free, I never used the HTML editor for this type of notes.
Capture1.PNG
Capture2.PNG
Capture3.PNG
Capture4.PNG

Flavio Lerda

unread,
Jul 28, 2013, 5:57:02 PM7/28/13
to anki-a...@googlegroups.com
Hello Xiao,

The field editor in Anki is an HTML editor.
If you want to use a plain-text editor, you need to use the "Edit HTML" button in the note editor overflow menu.
I imagine the content there matches what AnkiDroid is showing: AnkiDroid does not offer an HTML editor and always shows the plain text.

Thanks to your example, I was able to identify a discrepancy in the way Anki and AnkiDroid handle HTML within LaTeX fields.
I prepared a fix, which should be included in the next release.

In the meanwhile, you can use the "Edit HTML" option in Anki on the desktop to strip the unwanted HTML code.

Thanks,
Flavio

Xiao Sun

unread,
Jul 28, 2013, 7:28:05 PM7/28/13
to anki-a...@googlegroups.com
Yep, you're right. The "Edit HTML" did show all the HTML codes, deleting them in Anki made the LaTeX image displayable on Ankidroid. 

Xiao Sun

unread,
Jul 28, 2013, 8:14:23 PM7/28/13
to anki-a...@googlegroups.com
Do you know what might be the cause for the extra HTML codes? Obviously I did not click on "edit HTML" and added all that HTML codes in myself.


On Monday, July 29, 2013 7:57:02 AM UTC+10, Flavio wrote:

glowing...@gmail.com

unread,
Jul 29, 2013, 4:34:24 PM7/29/13
to anki-a...@googlegroups.com

I too have this problem.  I'd classify this bug as devastating and highest priority: it bricks AnkiDroid for me, as all of my cards are LaTeX and almost all are corrupted as above.

It should be extremely simple to add an option somewhere:  "Remove HTML from all cards".  Just go through the deck and brute-force remove all the <div>'s and &nbsp's and so on.  I really wish Ankidroid offered such a feature!

I was considering making cards for my calculus students this semester (starting mid August) but if this feature isn't cleared by then, that's out of the question.

Flavio Lerda

unread,
Aug 10, 2013, 11:13:49 AM8/10/13
to anki-a...@googlegroups.com
Hello,

This is due to a change in the desktop client.
It is not just about removing the HTML, it is about how the image to be used is determined.
We hope to have a release in the coming weeks, which would include the fix to make the Android client do the same as the desktop client.

I think adding a "Remove HTML from all cards" is not something we should support and we should instead fix the actual issue (mirror the change to the desktop client related to LaTeX cards).

Flavio

Flavio Lerda

unread,
Aug 10, 2013, 11:14:19 AM8/10/13
to anki-a...@googlegroups.com
I am not sure where the HTML code came from.

Actually the normal card editor adds HTML to the code when you use things like bold, italics, etc.
Moreover, if you cut and paste your content from somewhere else (e.g., word) it might include those.

I tried it myself (on Mac) and did not see that specific HTML code inserted (I did see <div> and <b>)
but that might very on other platforms (e.g., Windows or Linux) but I did not get a chance to try. It
might also be different in different versions of the application: might have occurred 

AnkiDroid does not add much HTML itself: I think the only exception is converting newlines into <br/>.

steveb...@gmail.com

unread,
Jun 3, 2015, 11:08:02 AM6/3/15
to anki-a...@googlegroups.com
Hi, I am having a problem with HTML showing when importing from LWT Learning with Texts. I had previously imported with no problems and then suddenly the HTML started appearing. Don't really understand why. Or how to get rid of it.
Reply all
Reply to author
Forward
0 new messages