LaTeX-Note-Importer-for-Anki icon indicating copy to clipboard operation
LaTeX-Note-Importer-for-Anki copied to clipboard

Handling of backslash in plain fields

Open tomtom opened this issue 7 years ago • 1 comments

When I import plain fields, \% gets imported verbatim. I'd have to just use %, which causes problems when typesetting the tex file via latex.

Are users supposed to use (1) \% or (2) % in plain fields? If 1, the import algorthm should remove the backslash. If 2, the manual should give some guidelines how users can typeset the tex file.

It would be nice, if the manual included some sort of template with all environments and commands defined so that the file can be imported and typeset via latex. (Or if the export included definitions for such environments and commands.)

Anyway, many thanks for this great addon.

Regards

tomtom avatar Mar 05 '17 15:03 tomtom

To be honest, I'm positively surprised the add-on does anything even half-sensible with % used in a field. And I'm not quite sure what it ideally should do.

My initial impuls would be that users should expect (2), i.e. just %, to be imported as % in plain fields. If I understand correctly, this is indeed how the add-on currently behaves. To get things displayed correctly when running pdf-latex on your file, you could try to (re)define the \xplain fields such that the contents are wrapped in a latex verbatim environment. Something like:

\newcommand{\xplain}[1]{\begin{verbatim}#1\end{verbatim}}

(I haven't tested this.)

If you're mainly interested in importing "plain text", then you're probably better off without this add-on. In that case, it should be easier to type-set notes in a csv-file and use Anki's built-in importer. Anki's internal format is HTML, and type-setting plain text in LaTeX in order to later convert it to HTML seems a very round-about routine.

TentativeConvert avatar Mar 06 '17 18:03 TentativeConvert