Use SVG images of LaTeX formulas, when required#4724
Conversation
|
@dae def mungeQA(html, type, fields, model, data, col): |
| String fname = "latex-" + Utils.checksum(txt) + ".png"; | ||
|
|
||
| String ext = "png"; | ||
| if (model.optBoolean("latexsvg", false)) |
This works the same way as the current Anki 2.1 code: - if the note type specifies it, look for an svg file - otherwise, look for a png one
|
The LaTeX code doesn't need the unused parameters, but they may be used by some add-ons. |
|
Thanks, any comment on this?
It would seem that the setting should just control whether or not svg files are generated, and clients should be able to handle both file types. Obviously we want old .png files to still work on non-rendering clients even after the user changes to the setting to svg. Clients that do render may want to re-render as svg however. |
|
If a user has opted in to svg generation, then I think it's reasonable for the mobile clients to only look for svg files. Falling back on any png files that may be lying around is likely to only cause confusion, as users may wonder why some images are being rendered in a different font. If the user is stuck on an old Android version, then it does not make sense for them to enable the svg generation option as any new LaTeX they add would not appear in AnkiDroid. |
|
Released in v2.9 alpha 12 |
As this pull request was merged into Anki 2.1, LaTeX can now be exported to SVG instead of PNG, by enabling an option in the note type (see this commit).
This works the same way as the current Anki 2.1 code:
I'm not sure if it should be done this way or if AnkiDroid should check for both files, ignoring the note type.