Compile latex during add/edition and warn in case of error

AnkiWeb addon 769835008

Compiles LaTeX while adding or editing notes, warns on errors, tags notes LaTeXError, and auto-generates images, though it has bugs on Anki 2.1.20 with cloze notes.
AI-generated summary; may contain mistakes.

taggingformattingbugfix-workaroundobsolete

Open on AnkiWeb GitHub Ask about alternatives

AnkiWeb

Rating
6 (πŸ‘ 4 Β· πŸ‘Ž 2)
Updated
2020-03-19
Anki versions
2.1.22~
Description language
en

Maintenance

abandoned

  • Last update or commit was 2251 days before the snapshot (2020-08-02).

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.02.1.192018-11-21
2.1.202.1.212020-03-19
2.1.22+2020-03-19
History across monthly snapshots

Loading…

Similar addons

Show LaTeX and MathJax result in editor/browser

Displays compiled LaTeX and MathJax as images in Anki's editor, add card, and browser, showing original code only when a field is clicked for editing.

formatting

Rating 19 πŸ‘ 16 Β· πŸ‘Ž 3 ⭐ 7 Anki 2.1.48~ Updated 2021-10-16
Visible Table Borders

Displays table and cell borders while adding, editing, or browsing pasted HTML tables in the editor by converting them to inline tables.

formatting

Rating 3 πŸ‘ 2 Β· πŸ‘Ž 1 Anki 25.02~ Updated 2025-10-20
Edit LaTeX build process

Lets you edit the command-line arguments passed to LaTeX and dvipng when generating LaTeX cards, configured manually and changing nothing by default.

card-templates

Rating 43 πŸ‘ 37 Β· πŸ‘Ž 6 Updated 2018-10-12

README

Compile all LaTeX, warn about compilation errors

Rationale

This add-on repare three related problems with anki's compilation process for LaTeX.

Errors

You never know whether your LaTeX is valid untill you actually see the card containing the LaTeX. When this occur, you are probably learning new cards and don't want to stop to correct your typo.

I thus prefer to know when an error occur when I'm creating or editing a card. When a new card is created with an error, or when I'm creating an error while editing a note, a warning box will pop-up to warn me.

During edition, a tooltip (yellow box) reminding you a bug exists regularly occur. You may know that the bug is solved as soon as you don't see the tooltip.

Finding errors.

Furthermore, a tag #LaTeXError is added to notes with an error in their LaTeX. To find and correct those notes, it suffices to search for this tag.

Synchronization

Ankiweb and smartphone can't compile LaTeX. Thus, when you create new cards, don't click on "check media", synchronize, and use ankiweb, ankidroid, anki on IOS, you have notes without their LaTeX. Since you don't want to always have to remember to use "check media", you may want to use this add-on. Since it compiles LaTeX as soon as it is written, the image will always be generated.

Warning

The browser does not update when a tag is added/removed. Thus you may not trust the tag list in the browser to know whether your last edit created/removed a bug.

A problem when LaTeX header change

If you change the footer/header, Anki will not recompile your LaTeX code. In particular, if it founds an error the last time it tried to compile your LaTeX code, it will believes the error is still present even if, changing the header, you may actually have corrected the error. In order to ensure Anki tries to compile again, you need either to restart anki (it won't recall what it already tried to compile), or edit the code. You can usually add a space or a {} in your LaTeX without changing your output.

Too much images

Assume you write [$]\pi=3[/$], and a little bit later, you add [$]\pi=3.14[/$], and a little bit later [$]\pi=3.1416[/$]. Since this add-on compile often, the three versions of your code will have been compiled, and will have generated LaTeX image, saved in your media folder. It takes space. So you may still want sometime to do a "check media", to delete all of those partial compilations.

Configuration (Version 2.1 only)

"warningBox" configure when should a warning box tell you when you introduce a latex error. When warning are not used, yellow box (tooltips) are used instead. Its possible values are:

  • "never": i.e. always use tooltips
  • "On first error" : with this option, you'll be warned each time you introduce an error in a note. That is, if a note has no LaTeX error and you introduce one, then you'll have a warning message. However, if the note already has a LaTeX error, you won't be notified again. (This is the default)

Internal

This change Note.flush, still calling the former Note.flush.

Links, licence and credits

Key Value
Copyright Arthur Milchior arthur@milchior.fr
Based on Anki code by Damien Elmes anki@ichi2.net
License GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
Source in https://github.com/Arthur-Milchior/anki-compile-latex-early/
Addon number 769835008