# LATEX in processing

**URL:** https://discourse.processing.org/t/latex-in-processing/19691
**Category:** Libraries
**Created:** [April 12, 2020, 8:05am UTC](https://discourse.processing.org/t/latex-in-processing/19691 "2020-04-12T08:05:41Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![mcintyre](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mcintyre/32/14561_2.png) [@mcintyre](https://discourse.processing.org/u/mcintyre)
#### Post date: [June 3, 2020, 9:46pm UTC](https://discourse.processing.org/t/latex-in-processing/19691/4 "2020-06-03T21:46:36Z")

</div>

Sure! The sketch below renders Poisson’s equation \nabla^{2}\Phi=\sigma(x) into a paragraph element.

```javascript
let tex;

function setup() {
  createCanvas(400, 400);
  tex = createP();
  tex.style('font-size', '20px');
  tex.position(135, 165);
  katex.render('\\nabla^{2}\\Phi=\\sigma(x)', tex.elt);
}

```

The double `\\` avoids escaping characters unintentionally in the middle of your TeX expression.

You can add KaTeX to the `<head></head>` of your sketch’s HTML file as outlined in the library’s [documentation](https://katex.org/docs/browser.html). Here is the [full example](https://editor.p5js.org/mcintyre/sketches/wpmxTA50u) in the p5.js Web Editor.

---

_[View the full topic](https://discourse.processing.org/t/latex-in-processing/19691)._
