TentativeConvert / LaTeX-Note-Importer-for-Anki

Add-on for the memory training program Anki, allowing to import and export notes written in LaTeX.
GNU Affero General Public License v3.0
32 stars 8 forks source link

Support a way to import images #2

Closed tomtom closed 4 years ago

tomtom commented 7 years ago

It would be nice to have a way to import images using the usual latex commands -- or, if there already is a way to achieve this, to explain this in the user doc. Thanks for this wonderful plugin.

Regards

TentativeConvert commented 7 years ago

There are at least two questions here:

  1. Is it possible to include graphics in Anki notes via LaTeX?
  2. Can the importer somehow „import the image files“, i.e. copy them to a place where Anki finds them?

The answer to (1) seems to be yes, though I’ve never tried it myself. Have a look at this stackoverflow thread, for example. I’ve also had a report of success for the command \includegraphics[natwidth=550,natheight=642]{path}. I agree that it would be nice to include some advice on this in the documentation, so if you have any success, please let me know and/or edit the docs accordingly.

As for (2), the answer is: no, not at the moment. Perhaps with a better understanding of (1) (i.e. of what actually needs to be done), this functionality could be added, but I don’t think I’ll have enough time on my hands in the near future to look into this.

jrotheneder commented 4 years ago

Somewhat related: Importing a plain field converts < and > to their html equivalents < and > - without this behaviour, images and gifs could be displayed via \<img src = ... >. Is there a way to circumvent this?

Thanks for the amazing tool btw!

TentativeConvert commented 4 years ago

I think that would be against the philosophy of this add-on. The internal format of Anki is html. In order to write cards in html, you do not need an add-on. Also, any built-in import tool should work well with html. So if you want to include images with <img src = ... >, you're most likely looking at the wrong tool here. LaTeX-Note-Importer aims to provide a plain-text interface. The conversion of "<", ">", "&" etc. is exactly what it is supposed to do.