4

Is there an easy way of rendering LaTeX equations in p5.js?

I naively tried to use KaTeX by including their auto-render starting template in the index.html of a p5.js editor template and then writing an "equation" like

text("$$\\epsilon = 0.4$$", 30, 30);

in the draw() function. This failed, see here.

Malte
  • 556
  • 5
  • 11
  • 1
    I'm not sure about KaTeX, but moste LaTeX libraries only work in HTML, which means that `createDiv("latex code here)` should work. (Again, not sure) – Bagel03 Jun 03 '20 at 22:52
  • 1
    @Bagel03 thanks! mcintyre from the processing forum [answered my question here](https://discourse.processing.org/t/latex-in-processing/19691/3) using a similar idea: create a HTML

    element using the p5 `createP()` function and inserting a KaTeX-rendered string there.
    – Malte Jun 04 '20 at 08:50

0 Answers0