Closed LoganLim2271 closed 3 years ago
Can be worked around by extending genanki.Model
and overriding to_json. Here is an example:
class CustomLatexModel(genanki.Model):
def __init__(self, latex_pre = None, latex_post = None, *args, **kwargs):
super().__init__(*args, **kwargs)
self.latex_pre = latex_pre
self.latex_post = latex_post
def to_json(self, *args, **kwargs):
json = super().to_json(*args, **kwargs)
if self.latex_pre is not None:
json['latexPre'] = self.latex_pre
if self.latex_post is not None:
json['latexPost'] = self.latex_post
return json
In genanki 0.11.0 you can pass latex_pre
and latex_post
to Model.__init__
.
Hi there, thank you for this great package. When I was looking into the code for Model.to_json in model.py I noticed that the LaTex preamble for the Note type is constant.
Is there some way to change the LaTex preamble for a Model object to use more LaTex packages & define environments?