1

While creating a deck for Anki using the import functionality from csv, I've run into an issue getting the line breaks to function properly.

Here is the situation:

  • This is for the front card
  • It is imported from a csv file
  • Starts out with a question and is followed by an equation
  • There needs to be a line break between the equation and question
  • the equation and question should be centered

This is what has been tried so far:

Inserting <br>

How is the following matrix-vector product computed? <br>
\( y^{T}=x^{T}A 
\)

When using <br> as a line break, it seems to get ignored for some reason. The result can be seen here. And yes, the option to "allow HTML in fields" is selected.

Use \\ linebreaks inside of mathjax/latex math equation using \displaylines{}

How is the following matrix-vector product computed?
\( \displaylines{
\\y =Ax
}\)

This does create a line break but did not center the equation. You can see the result here. Note: without \displaylines{}, the \\ line breaks wouldn't work.

How is a line break created in Anki when importing from a csv file?

  • Have you tried using `\[...\]` rather than `\(...\)'? The former is for displayed equations that appear centered on a separate line while the latter is for in-line equations that are part of a paragraph. If you want an equation on a separate line, you are using the wrong delimiters. – Davide Cervone Jun 11 '23 at 17:40
  • \\[...\\] is working, fantastic! – Still Learning Jun 12 '23 at 19:33
  • I just found out that using
    started to work, but it wasn't working before ... not sure what I was actually doing wrong previously.
    – Still Learning Jun 12 '23 at 19:35

1 Answers1

0

I read through the docs here

Anki docs importing

And everything you are saying is represented.

However it would seem you're asking a seperate question about how to center the equation which would seem to be a question of latex markup.

have you tried this ?

latex text alignment

If latex is working but html is not, consider trying to use the latex tag.

As to what another programmers code looks like, eg the developers of anki, there is really no way of knowing without seeing it.

Try using the \centering latex tag. Its specified as a builtin.

This will of course expect that whatever renderer anki is using supports this command, which it probably does as its likely using the standard LaTex compiler.

Hope this helps.

  • I wasn't able to figure out how to apply the \centering. I think its actually using mathjax (which seems related to latex) and there is some more setup required to use latex, but I'm not an expert at this latex stuff, so maybe what I tried wasn't correct – Still Learning Jun 12 '23 at 19:39
  • thats why I included the caveat, there are some web applications that accept for example only the math portion of LaTex but nothing else. I saw one such named Aleks when I was in college last. – MysteriousMadCoder Jun 14 '23 at 00:14