How can I properly format those diagonals using mathjax?

1. Goal

I am trying to create a card which contains the following formular using mathjax:

2. Issue

I thought I might need to use \diagup and \diagdown. Using

x \left(ax^2+bx+c \right)=0 \diagup x=0

is being displayed as the following, though:
anki

3. Question

How can I use ankis mathjax to display the formular, so that it’s looking just like the first image I posted?

Thanks!

If it were regular TeX, using a package that allows plotting graphs might be the way to go. A quick search suggests TikZ, which also has a TikZJax js library to use as a substitute with MathJax. It might be a pain to set up though and not worth the effort if you will only be needing simple diagrams. For those you might be better off using basic inline svg. For example, this code

<div style="display: flex; align-items: center; gap: .25em;">
  <anki-mathjax>x=\pm1</anki-mathjax>
  <svg width="2em" height="2em">
    <line x1="0" y1="17" x2="40" y2="7" stroke="black" stroke-width="1"></line>
    <line x1="0" y1="23" x2="40" y2="33" stroke="black" stroke-width="1"></line>
  </svg>
  <anki-mathjax> 
    \begin{gather}
      x = +1 \\ 
      x = -1
    \end{gather}
  </anki-mathjax>
</div>

should give you the following result:

image

2 Likes

Another way to consider would be rewriting the equation using common mathematical notation, e.g.:

image

2 Likes