Hey everyone,
I’ve run into something that’s been bugging me while working with MathJax inline blocks. When I cut a function using cmd+x (I’m on Mac) and paste it elsewhere, it gets inserted on a new line below instead of staying inline where my cursor is.
I’d expect the pasted content to appear right where I’m clicking, continuing on the same line. Having to manually click and delete the line break every single time adds up when you’re writing a lot of formulas - probably at least 3 extra actions each time.
I’ve recorded a video showing what’s happening that I’ll attach. Basically the paste behavior doesn’t respect the inline nature of the MathJax block.
Not sure if this is intentional or a quirk of how MathJax blocks are handled, but it definitely slows down the workflow. Would be great if paste could just insert inline by default when working with inline MathJax.
Thanks for all the amazing work on Anki btw, really appreciate what you all do!
video link : Watch Screen Recording 2025-10-31 at 8.17.07 AM | Streamable
version : 25.09.2 (Mac OS Silicon)
screen :
Arthur
1 Like
Can you send the cards html in a codeblock please?
I tried to reproduce but couldn’t on debian linux with:
Anki 25.09.2 (3890e12c) (ao)
Python 3.13.5 Qt 6.9.1 PyQt 6.9.1
Platform: Linux-6.12.41+deb13-amd64-x86_64-with-glibc2.41
Sure I’ll go back to you as soon as possible
Hey,
To be honest, I’m not sure how to export the HTML from a card. However, I noticed something interesting: when I create a new card, the bug doesn’t happen anymore! It works correctly now.
Apparently, the problem only persists on the old cards I had created, but all the new cards I’m making now paste the MathJax content inline as expected, without jumping to a new line.
So it seems like it’s been fixed somehow already previously? Maybe it’s related to a change in how new cards are formatted by default.
If you still need the HTML to investigate, could you explain how to export it?
Thanks!
Maybe the cards you are editing contain html that causes the effect you are seeing. Or, you are right and it has been fixed for new cards. You can find the html by opening the browser, selecting the card and then clicking on the <> icon.
Thanks for the suggestion! I checked the HTML of the affected cards by clicking the <> icon, and here’s what I found:
<ol><li>
<div><b>Relation</b> : <anki-mathjax>\\equiv</anki-mathjax> est une relation d’équivalence (réflexive, symétrique, transitive).</div></li><li>
<div><b>Partition</b> : X peut être partitionné en ensembles disjoints </div>
<div> - chaque élément est dans un seul ensemble,</div>
<div> - <anki-mathjax>x \\equiv y \\iff x \\land y</anki-mathjax></div></li><li><div> sont dans le <b>même</b> sous-ensemble. <anki-mathjax>A_1, A_2, \\dots</anki-mathjax> tels que :</div></li><li>
<div><b>Fonction</b> : Il existe une fonction f :<anki-mathjax>X \\to F</anki-mathjax></div><div> - <anki-mathjax>x \\equiv y \\iff f(x) = f(y)</anki-mathjax>.</div></li></ol>
Thanks for your help!
1 Like
I know I said before that I cannot reproduce, and I couldn’t. But now, I can reproduce it every single time.
Steps to reproduce
- Paste
A<anki-mathjax>R</anki-mathjax> into the html view.
- Go to the “render” view, select the mathjax and cut it out.
- Paste at the same position.
Additional Info
Here’s what happens:
In step 1 the html looks like this: A<anki-mathjax>R</anki-mathjax>.
In step 2 it becomes this: A.
In step 3 it becomes this: A<br><anki-mathjax>R</anki-mathjax>.
Other possibly related bug:
If you start with the above steps and do each of those steps, continue to do step number 3 multiple times in succession. Don’t change the cursor position. What you will see is that the cursor position jumps infront of the mathjax at some point and then refused to paste the mathjax; it only pastes <br>.
Important notice
This only seems to occure if you do not select the entire mathjax container. E.g. do this to trigger the bugs:
- Start with step 1 from above.
- Place your cursor at the end of the mathjax / the end of the row.
- Hold Shift and press the LeftArrow key twice.
You can now reproduce the above issues. But if you press the LeftArrow key three times, then you won’t see those bugs.
3 Likes