anki.latex
==========

.. py:module:: anki.latex


Attributes
----------

.. autoapisummary::

   anki.latex.pngCommands
   anki.latex.svgCommands


Classes
-------

.. autoapisummary::

   anki.latex.ExtractedLatex
   anki.latex.ExtractedLatexOutput


Functions
---------

.. autoapisummary::

   anki.latex.on_card_did_render
   anki.latex.render_latex
   anki.latex.render_latex_returning_errors
   anki.latex.setup_hook


Module Contents
---------------

.. py:data:: pngCommands
   :value: [['latex', '-interaction=nonstopmode', 'tmp.tex'], ['dvipng', '-bg', 'Transparent', '-D', '200',...


.. py:data:: svgCommands
   :value: [['latex', '-interaction=nonstopmode', 'tmp.tex'], ['dvisvgm', '--no-fonts', '--exact', '-Z',...


.. py:class:: ExtractedLatex

   .. py:attribute:: filename
      :type:  str


   .. py:attribute:: latex_body
      :type:  str


.. py:class:: ExtractedLatexOutput

   .. py:attribute:: html
      :type:  str


   .. py:attribute:: latex
      :type:  list[ExtractedLatex]


   .. py:method:: from_proto(proto: anki.card_rendering_pb2.ExtractLatexResponse) -> ExtractedLatexOutput
      :staticmethod:



.. py:function:: on_card_did_render(output: anki.template.TemplateRenderOutput, ctx: anki.template.TemplateRenderContext) -> None

.. py:function:: render_latex(html: str, model: anki.models.NotetypeDict, col: anki.collection.Collection) -> str

   Convert embedded latex tags in text to image links.


.. py:function:: render_latex_returning_errors(html: str, model: anki.models.NotetypeDict, col: anki.collection.Collection, expand_clozes: bool = False) -> tuple[str, list[str]]

   Returns (text, errors).

   errors will be non-empty if LaTeX failed to render.


.. py:function:: setup_hook() -> None

