Platform
Resources
Pricing
Sign in
Get started
qbane
Web developer from Taiwan
Workspace
Fork
Published
2 collections
By
qbane
Edited
Apr 22, 2020
Insert cell
Insert cell
Insert cell
Insert cell
mjAware
(
md
)
`I believe that ${
String
.
raw
`$$e^{i\pi} + 1 = 0$$`
} is the most beautiful equation in the word.`
Insert cell
Insert cell
tex2chtmlExample
=
{
await
Promises
.
delay
(
1000
)
const
container
=
html
`<div style="font-size: 20px; padding: 2px 0; max-width: 640px"></div>`
const
el
=
MathJax
.
tex2chtml
(
String
.
raw
`F_n = \frac{1}{\sqrt 5} \left[ \left( \frac{1+\sqrt 5} 2 \right)^n - \left( \frac{1-\sqrt 5} 2 \right)^n \right]`
,
{
em
:
20
,
ex
:
10
}
)
container
.
appendChild
(
el
)
return
container
}
Insert cell
md
`Comparing to what ${
tex
`\KaTeX`
} renders:
${
tex
.
block
`F_n = \frac{1}{\sqrt 5} \left[ \left( \frac{1+\sqrt 5} 2 \right)^n - \left( \frac{1-\sqrt 5} 2 \right)^n \right]`
}
`
Insert cell
mjAware
(
md
)
`Custom commands work too! This makes it significantly useful after KaTeX. For example,
${
String
.
raw
`$$\newcommand{\set}[1]{\\{#1\\}}
\mathbb{Z} = \set{\cdots, -1, 0, 1, 2, 3, \cdots}$$`
}
is an infinite set.`
Insert cell
Insert cell
chtmlStylesheet
=
tex2chtmlExample
,
(
includeStyleSheet
?
MathJax
.
chtmlStylesheet
(
)
:
null
)
Insert cell
Insert cell
Insert cell
Insert cell
mjAware
=
tagFunction
=>
{
return
(
strings
,
...
args
)
=>
{
const
el
=
tagFunction
(
strings
,
...
args
)
MathJax
.
typeset
(
[
el
]
)
return
el
}
}
Insert cell
Insert cell
MathJax
=
loadMathJax
(
(
)
=>
(
{
tex
:
{
inlineMath
:
[
[
'$'
,
'$'
]
,
[
'\\('
,
'\\)'
]
]
}
,
chtml
:
{
fontURL
:
'https://cdn.jsdelivr.net/npm/mathjax@3.0.5/es5/output/chtml/fonts/woff-v2'
,
}
}
)
)
Insert cell
mathjaxBlob
=
(
await
fetch
(
'https://cdn.jsdelivr.net/npm/mathjax@3.0.5/es5/tex-chtml.js'
)
)
.
blob
(
)
Insert cell
loadMathJax
=
{
// reusable, disposable, no-conflict (?) MathJax loader
return
async
configThunk
=>
{
delete
window
.
MathJax
delete
window
.
ContextMenu
window
.
MathJax
=
configThunk
(
)
const
MathJax
=
await
import
(
URL
.
createObjectURL
(
await
mathjaxBlob
)
)
.
then
(
(
)
=>
window
.
MathJax
)
return
MathJax
}
}
Insert cell
import
{
checkbox
}
from
'@jashkenas/inputs'
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Listed in...
Playground
qbane
Typesetting
qbane
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
tex2chtmlExample
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
includeStyleSheet
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
chtmlStylesheet
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mjAware
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
MathJax
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mathjaxBlob
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
loadMathJax
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML