AnkiMobile inserting linebreak before inline MathJax

It seems that AnkiMobile sometimes inserts an (unwanted) linebreak before an inline MathJax equation.

See the example picture provided. The same card displayed on AnkiDroid or on Windows Anki does not include a linebreak.

An idea what’s going on and how to fix it?

2021-12-29 15_34_40-Window

I seem to recall a previous report of this being triggered by styling added by the resize image add-on - you could try removing the styling it’s added to your notetype to see if that helps.

I have now deleted the resize image add-on, removed the automatic styling, and synchronized all my devices.

In fact, I removed all the styling associated with the note type. This causes the text on Windows and AnkiDroid to be left-aligned (as expected), but there is no change at all in the styling on AnkiMobile (text is still center-aligned, and there’s still the unwanted line break), indicating that the changed styling doesn’t propagate to my iPad.

However, when I create a new deck and move cards around (on Windows) and synchronize, the changes show up on AnkiMobile (as expected), so the sync isn’t completely broken. Looks like it only affects the styling or something?

Closing AnkiMobile, restarting my iPad, forcing a one-way sync, checking empty cards, rebuilding database, etc. doesn’t seem to fix it.

Any idea what’s going on?

Hei there,

The styles in the fields you see are not the same as templates. You can fix this issue by removing the <p></p> tags in your markup, f.eks. use another tag or make it plaintext.

If you look at the back of your card you can see it’s adding a margin-bottom. In the Anki source code for some reason (I don’t know why), some styles are being applied to the p tag. Maybe @dae knows?

@ccscanf That’s code from the editor, and is not used in the review screen.

@Emul I did some experimentation, and it appears to be caused by the <tts> tag that your front field is nested in. Adding the following to the styling seems to fix it: tts { display: block; }.

2 Likes

Yes, it’s from the editor. I misunderstood Emul’s issue. I thought they were referring to the Backfield which has a new line (first screenshot).

@dae Thank you!! This solved the issue. :grinning:

@ccscanf Thanks for looking into it. It cool to see a fellow norwegian ankier on here. :slightly_smiling_face:

1 Like