@mathzetta/inlinemath 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -25
- package/dist/cas.external.js +2 -2
- package/dist/cas.js +2 -2
- package/dist/chunks/calculate-BPhXubl4.js +2 -0
- package/dist/chunks/{draw-Bw547gEd.js → draw-BlziYtHI.js} +2 -2
- package/dist/chunks/{edit-CCe3uoyk.js → edit-Bc3TgjS_.js} +2 -2
- package/dist/chunks/{edit-BC9D1cIE.js → edit-DUPFxM7f.js} +2 -2
- package/dist/chunks/html-B5rAcnpJ.js +2 -0
- package/dist/chunks/{html-6HJlblNm.js → html-ItSMWpG6.js} +2 -2
- package/dist/chunks/lite-Dl7abp_j.js +2 -0
- package/dist/inlinemath-cas.external.global.min.js +2 -2
- package/dist/inlinemath-cas.global.min.js +2 -2
- package/dist/inlinemath-lite-calc.global.min.js +2 -2
- package/dist/inlinemath-lite.external.global.min.js +2 -2
- package/dist/inlinemath-lite.global.min.js +2 -2
- package/dist/inlinemath.css +9 -0
- package/dist/inlinemath.external.global.min.js +2 -2
- package/dist/inlinemath.external.js +2 -2
- package/dist/inlinemath.global.min.js +2 -2
- package/dist/inlinemath.js +2 -2
- package/dist/lite-calc.js +2 -2
- package/dist/lite.external.js +2 -2
- package/dist/lite.js +2 -2
- package/dist/markdown.external.js +2 -2
- package/dist/markdown.js +2 -2
- package/inlinemath.css +9 -0
- package/package.json +1 -1
- package/src/layout.js +7 -0
- package/dist/chunks/calculate-DHvovDQK.js +0 -2
- package/dist/chunks/html-DzjcaM8w.js +0 -2
- package/dist/chunks/lite-6yr4ed_k.js +0 -2
package/README.md
CHANGED
|
@@ -60,8 +60,8 @@ import '@mathzetta/inlinemath/fonts/fonts.css'; // optional: Latin Modern, th
|
|
|
60
60
|
|
|
61
61
|
```html
|
|
62
62
|
<!-- or from the CDN -->
|
|
63
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.
|
|
64
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.
|
|
63
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.4/inlinemath.css">
|
|
64
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.4/fonts/fonts.css"> <!-- optional -->
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
### Lite: drawing only
|
|
@@ -80,7 +80,7 @@ el.innerHTML = toHTML('\\frac{d}{dx} x^2 = 2x', { colors: { '2x': 'crimson' } })
|
|
|
80
80
|
## Try it
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
|
-
npm test #
|
|
83
|
+
npm test # 290 checks; every input in mathzetta/test/cases/calculus.tsv
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
[inlinemath.com](https://inlinemath.com) has the live editor, steps and the gallery; its
|
|
@@ -146,8 +146,8 @@ npm run build # dist/ (a few seconds)
|
|
|
146
146
|
|
|
147
147
|
- **`dist/`** — Inline Math with everything inside, no import map or `node_modules` needed:
|
|
148
148
|
- `inlinemath.js`, `markdown.js`, `cas.js` — ES modules (shared code in `dist/chunks/`);
|
|
149
|
-
- `inlinemath.global.min.js` (
|
|
150
|
-
- `inlinemath-cas.global.min.js` (
|
|
149
|
+
- `inlinemath.global.min.js` (207 KB, 71 KB gzipped) — a classic `<script>`: `window.InlineMath`, with Inline Math and the Markdown;
|
|
150
|
+
- `inlinemath-cas.global.min.js` (385 KB, 123 KB gzipped) — the same plus the CAS (`InlineMath.mathCAS`, `casBlocks`, `stepsHTML`);
|
|
151
151
|
- `inlinemath.css` and `fonts/` — put both on the page.
|
|
152
152
|
|
|
153
153
|
```html
|
|
@@ -169,23 +169,23 @@ Every npm release's `dist/` is on jsDelivr (and unpkg); the bundles carry MathZe
|
|
|
169
169
|
page needs nothing else:
|
|
170
170
|
|
|
171
171
|
```html
|
|
172
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.
|
|
173
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.
|
|
172
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.4/dist/fonts/fonts.css">
|
|
173
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.4/dist/inlinemath.css">
|
|
174
174
|
|
|
175
175
|
<!-- a script tag: window.InlineMath -->
|
|
176
|
-
<script src="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.
|
|
176
|
+
<script src="https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.4/dist/inlinemath.global.min.js"></script>
|
|
177
177
|
<script>document.getElementById('out').innerHTML = InlineMath.toHTML('\\frac{d}{dx} x^2');</script>
|
|
178
178
|
|
|
179
179
|
<!-- or modules: inlinemath.js, markdown.js, cas.js (the CAS one holds MathZetta CAS too) -->
|
|
180
180
|
<script type="module">
|
|
181
|
-
import { toHTML } from 'https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.
|
|
182
|
-
import { markdownToHTML } from 'https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.
|
|
181
|
+
import { toHTML } from 'https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.4/dist/inlinemath.js';
|
|
182
|
+
import { markdownToHTML } from 'https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.4/dist/markdown.js';
|
|
183
183
|
</script>
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
`@0.
|
|
186
|
+
`@0.4` follows the latest 0.4.x (a 0.x range never reaches the next minor version); `@0.4.0` pins a release.
|
|
187
187
|
|
|
188
|
-
**The stylesheet is required** — the drawing is HTML laid out by `inlinemath.css` (10.
|
|
188
|
+
**The stylesheet is required** — the drawing is HTML laid out by `inlinemath.css` (10.5 KB, 3.2 KB
|
|
189
189
|
gzipped): without it fractions, radicals and brackets don't line up. The classic builds
|
|
190
190
|
(`*.global.min.js`) carry it and add it to the page themselves (`<style id="inlinemath-css">`; a
|
|
191
191
|
`<link>` to `dist/inlinemath.css` is still fine, it is only added when absent); the ES modules
|
|
@@ -196,17 +196,17 @@ its Greek letters, which Latin Modern lacks, from New Computer Modern in the sam
|
|
|
196
196
|
Greek never fetches those two; without the link the math is drawn in the system serif.
|
|
197
197
|
|
|
198
198
|
Every build comes **with MathZetta inside, or without it** (`*.external.*`), with or without the
|
|
199
|
-
CAS (MathZetta CAS). Sizes, gzipped:
|
|
199
|
+
CAS (MathZetta CAS). Sizes, gzipped (a module with the shared chunks it imports):
|
|
200
200
|
|
|
201
201
|
| | ES module | classic `<script>` (`window.InlineMath`) |
|
|
202
202
|
|---|---|---|
|
|
203
|
-
| Lite (drawing only), MathZetta inside | `lite.js`
|
|
204
|
-
| Lite with the calculator (`{{…}}` worked out) | `lite-calc.js`
|
|
205
|
-
| Lite without MathZetta | `lite.external.js`
|
|
206
|
-
| Inline Math (+ Markdown in the classic build), MathZetta inside | `inlinemath.js`
|
|
207
|
-
| …without MathZetta | `inlinemath.external.js` **
|
|
208
|
-
| with the CAS, MathZetta inside | `cas.js`
|
|
209
|
-
| with the CAS, without MathZetta | `cas.external.js`
|
|
203
|
+
| Lite (drawing only), MathZetta inside | `lite.js` 42 KB | `inlinemath-lite.global.min.js` 43 KB |
|
|
204
|
+
| Lite with the calculator (`{{…}}` worked out) | `lite-calc.js` 58 KB | `inlinemath-lite-calc.global.min.js` 60 KB |
|
|
205
|
+
| Lite without MathZetta | `lite.external.js` 9 KB | `inlinemath-lite.external.global.min.js` 12 KB |
|
|
206
|
+
| Inline Math (+ Markdown in the classic build), MathZetta inside | `inlinemath.js` 62 KB, `markdown.js` 66 KB | `inlinemath.global.min.js` 71 KB |
|
|
207
|
+
| …without MathZetta | `inlinemath.external.js` **13 KB**, `markdown.external.js` 17 KB | `inlinemath.external.global.min.js` 21 KB |
|
|
208
|
+
| with the CAS, MathZetta inside | `cas.js` 113 KB | `inlinemath-cas.global.min.js` 123 KB |
|
|
209
|
+
| with the CAS, without MathZetta | `cas.external.js` 62 KB | `inlinemath-cas.external.global.min.js` 74 KB |
|
|
210
210
|
|
|
211
211
|
Without MathZetta, the page loads it once itself: a classic page puts a MathZetta `<script>` first —
|
|
212
212
|
`mathzetta.min.js`, or the `maths-display` flavor, since speech, text and calculate are used (for
|
|
@@ -221,7 +221,7 @@ map (every name can point at the one MathZetta bundle). The fonts are 94 KB more
|
|
|
221
221
|
"mathzetta/calculate": "https://cdn.jsdelivr.net/npm/mathzetta@1/build/mathzetta.esm.min.js" } }
|
|
222
222
|
</script>
|
|
223
223
|
<script type="module">
|
|
224
|
-
import { toHTML } from 'https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.
|
|
224
|
+
import { toHTML } from 'https://cdn.jsdelivr.net/npm/@mathzetta/inlinemath@0.4/dist/inlinemath.external.js';
|
|
225
225
|
</script>
|
|
226
226
|
```
|
|
227
227
|
|
|
@@ -297,7 +297,8 @@ el.innerHTML = stepsHTML(mathCAS().solve('sqrt(x + 1) = x - 1', 'x', { steps: 'b
|
|
|
297
297
|
```
|
|
298
298
|
|
|
299
299
|
Block functions: `simplify`, `expand`, `factor`, `cancel`, `diff(f, x[, n])`,
|
|
300
|
-
`integrate(f, x[, a, b])`, `solve(eq, x)`, `
|
|
300
|
+
`integrate(f, x[, a, b])`, `solve(eq, x)`, `limit(f, x, a[, right|left])` (or `limit(f, x -> a^+)`),
|
|
301
|
+
`approx(x[, digits])`; `d/dx …`, `\lim_{x \to a} …` and
|
|
301
302
|
`∫ … dx` go to the CAS too; every other block is the calculator, as before.
|
|
302
303
|
`stepsHTML` draws each step with the rewritten part highlighted and its
|
|
303
304
|
explanation. `mathCAS({ rules, names })` uses rule files of your own;
|
|
@@ -309,10 +310,7 @@ playground: any input, any operation, detail level, and a live rule editor).
|
|
|
309
310
|
## What still needs doing
|
|
310
311
|
|
|
311
312
|
**Notation MathZetta doesn't read yet** (Inline Math can only draw what parses):
|
|
312
|
-
- **Evaluation bars:** `[F(x)]_0^1` reads as a power of a subscript, and `\left. F \right|_0^1` is rejected.
|
|
313
313
|
- **Partial derivatives:** `\partial f / \partial x` becomes products.
|
|
314
|
-
- **Derivative orders:** `f^{(4)}` becomes a power.
|
|
315
|
-
- **Lists of answers:** `x = 2, x = -3` is rejected.
|
|
316
314
|
- **Accents:** `\dot x` becomes a product.
|
|
317
315
|
|
|
318
316
|
**Inline Math features worth adding next:**
|