Filter: text: html + mathjax not working

Hi!

I’m trying to add equations using https://www.mathjax.org/ to a html/text filter. However it doesn’t seem to render at all?

I just added the example from the mathjax page:

  <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
  <script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
  </script>
  </head>

  <body style="font-size: 72pt;">
<p>
  When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
  \[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]
</p>

Inserted so that the html documents structure was fine.

What am I doing wrong? Or is this just not possible?

Kind regards,
Michael

You may need to use Mathjax v2.7.5 to get it to work in Shotcut,

Great idea.
I tried, unfortunately it did not work.
I used below html:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>MathJax example</title>
  <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
  <script id="MathJax-script" async
          src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js">
  </script>
</head>
<body>
<p>
  When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
  \[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]
</p>
</body>
</html>

Is there something else I should try?

I’m sorry, I’ve tried 5 or 6 different ways to get it to work with Shotcut, but none of them was successful, none of them produced any error messages. A pity really.

My only suggestion would be to run the script in a browser and take a high-resolution screenshot of that, edit it if necessary then add the image to your Shotcut project.

1 Like

Thanks for taking the time to test it!

My “work around” for now is to create a standalone document in Latex, color the text white and create a transparent background png file.
Because it is white I can color it using color grading.

Here is an example:

\documentclass{standalone}
\usepackage{xcolor}
\begin{document}
$\displaystyle \color{white}A=\int_{0}^{10} \frac{2}{t + 4} dt$
\end{document}

I then create the .png file by running:

latex eq1.tex
dvipng -D 1000 -bg Transparent eq1.dvi

However, this requires a local latex installation.

This topic was automatically closed after 90 days. New replies are no longer allowed.