### Discussed in https://github.com/quarto-dev/quarto-cli/discussions/1682

<div type='discussions-op-text'>

<sup>Originally posted by **stuvjordan-uroc** August  4, 2022</sup>
I'm wanting to include some Observable charts in a website I'm building with Quarto.  I'd like these charts to include nicely-typeset math, and for that purpose I'm wanting to use MathJax's `tex2svg` function in the source code.  Relative to other math typesetting solutions one can use in Observable, `tex2svg` is nice because it outputs pure SVG paths...Thus they scale as the svg containing them is resized without any additional code, so the math looks great on every screen size.

I'm running into this **very** weird difference in the result of a call to `require` when that call is made in an Observable Notebook, as opposed to when I make it in an `ojs` cell in a Quarto sourcefile.

First, let's look at what happens when we require `tex2svg` in an Observable Notebook.  You can see the results in [this notebook](https://observablehq.com/@stuvjordan/requiring-mathjax-tex2svg).  Open up the object in the first cell after the title and notice the full list of methods that the object returned by the call to `require` includes.  Notice the list includes the method `.tex2svg`, which is the function I need.  Below is a screenshot.  You'll see `tex2svg` as the fourth method from the bottom.

![image](https://user-images.githubusercontent.com/78857503/182877558-aec76537-8983-4f36-876a-8053401248f8.png)

OK, great, so we can use `tex2svg` in an Observable notebook!

But what happens when we do the same call to `require` in an `ojs` cell in a `.qmd` file?  Here are two cells from my current `.qmd` source:
```{ojs}
//| output: true
MathJax = require('https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js').catch(
  () => window['MathJax']
)
```

```{ojs}
MathJax
```
Here's a screenshot of the output from the second of the above two `ojs` cells when I render/preview the sourcefile:

![image](https://user-images.githubusercontent.com/78857503/182878897-538a83da-691c-47be-b621-d7935ada8515.png)

**Notice that the list of methods does not include `tex2svg`!!!!**  As a result, when I do something like
```{ojs}
MathJax.tex2svg(
    String.raw`\int_0^1 \exp(x)dx`
 );
```
In the quarto sourcefile, the output on render/preview is:

![image](https://user-images.githubusercontent.com/78857503/182879785-70a332fe-3e53-488f-8d99-a671d42624b7.png)

I'm kind of amazed by this.

Help?</div>
cscheid
2022-08-15T16:53:45Z
jjallaire
v1.1
closed
require-ing MathJax fully working in Observerable notebook, but NOT in Quarto ojs cell
https://github.com/quarto-dev/quarto-cli/issues/1893