-
Notifications
You must be signed in to change notification settings - Fork 351
require-ing MathJax fully working in Observerable notebook, but NOT in Quarto ojs cell #1893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've discovered the problem. In a On the other hand, in a Should I report this as a bug? Or is this expected behavior? |
From @kwangkim A quarto template is using chtml instead of svg as a default. Line 189 in 8d0e6ba url: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js",
To solve this problem permanently, I think we can use one of ideas to fix the quarto template. |
@jjallaire I don't think this is a bug, but maybe we can offer some improvements. Fundamentally, the problem comes from importing two different versions of mathjax, one in our template, and the other from the We might be able to improve the situation in this case by allowing our template to import a user-customizable version of MathJax (via YAML) EDIT: I just learned that we already have support for that! |
@stuvjordan-uroc Another update in our discussion. If you want our version of mathjax to match exactly what you're importing, you can use the following yaml: format:
html:
html-math-method:
method: mathjax
url: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js |
Discussed in #1682
Originally posted by stuvjordan-uroc August 4, 2022
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 anojs
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. 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 torequire
includes. Notice the list includes the method.tex2svg
, which is the function I need. Below is a screenshot. You'll seetex2svg
as the fourth method from the bottom.OK, great, so we can use
tex2svg
in an Observable notebook!But what happens when we do the same call to
require
in anojs
cell in a.qmd
file? Here are two cells from my current.qmd
source:Here's a screenshot of the output from the second of the above two
ojs
cells when I render/preview the sourcefile:Notice that the list of methods does not include
tex2svg
!!!! As a result, when I do something likeIn the quarto sourcefile, the output on render/preview is:
I'm kind of amazed by this.
Help?
The text was updated successfully, but these errors were encountered: