@drghaliasri/butex 5.5.4 → 5.6.0

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 CHANGED
@@ -64,7 +64,7 @@ Peer dependency: `mathjax` ^4.x (aligned with MathJax 4 components). If you use
64
64
  5. When using **SVG** (`tex-svg.js`), call `BuTeX.registerBuTeXSvgTextWrapper(MathJax)` **after** `defaultReady()` so Takween/Diwani/Maghribi text, `\ad`, and Arabic atomic commands (`\arsin`, etc.) render in the preview with the correct fonts. CommonHTML (`tex-chtml.js`) uses the injected CSS classes instead.
65
65
  6. Render math with `renderBuTeXMathIsland(tex, options?)` or mount into a host element via `mountBuTeXMathIsland(host, tex, options?)`. Pass `output: 'svg'` when the host loads `tex-svg.js`, or `output: 'chtml'` with `tex-chtml.js`. For raw Arabic TeX that did not come from the editor AST, pass `mirrorOperators: true` to wrap directional operators according to BuTeX's shared operator table. `ButexEditor` picks SVG vs CHTML automatically from the loaded MathJax bundle (`tex2svg` vs `tex2chtml`).
66
66
 
67
- Ensure TeX `packages` includes `butex-arabic-math` (use `BUTEX_TEX_PACKAGE` in config when using `{ '[+]': [...] }`).
67
+ Ensure TeX `packages` includes `butex-arabic-math` (use `BUTEX_TEX_PACKAGE` in config when using `{ '[+]': [...] }`). BuTeX registers lightweight browser compatibility macros for toolbar symbols such as `\coloneqq` and `\eqqcolon`; XeLaTeX export still relies on the document preamble's `mathtools`.
68
68
 
69
69
  ## Usage (npm / bundler)
70
70
 
@@ -254,7 +254,7 @@ const latex = document2Latex(documentNode);
254
254
  const preview = document2Preview(documentNode, 'svg');
255
255
  ```
256
256
 
257
- `document2Latex(doc)` emits a **complete Arabic XeLaTeX document** by default (preamble + `\begin{document}` + body + `\end{document}`). Structured and editor-authored Arabic roots serialize with the canonical `\arsqrt`; the bundled preamble also accepts raw legacy `\arabsqrt` with the same optional-index signature. It defines BuTeX font wrappers (`\butextakween`, `\butexdiwani`, `\butexdiwanioutline`, `\butexmaghribi`) and the MathJax-compatible `\butexmirror` bridge. Pass `{ wrapDocument: false }` for body-only blocks. Paragraph blocks export as `\par` followed by the inline content, so prose, citations, and math are not wrapped inside `\paragraph{...}`. Optional `digitsMapping: 'arabicdigits' | 'digits'` controls eastern vs western digit font mapping in the preamble (default `'arabicdigits'`). Pass `{ twocolumn: true }` for `\documentclass[12pt,a4paper,notitlepage,twocolumn]{article}` (title block stays in-column; figures use `\columnwidth`). See [`examples/example-latex-export.tex`](examples/example-latex-export.tex) for a full sample (regenerated by the wrap vitest). Hosts can also call `getArabicXeLatexPreamble()` alone.
257
+ `document2Latex(doc)` emits a **complete Arabic XeLaTeX document** by default (preamble + `\begin{document}` + body + `\end{document}`). Structured and editor-authored Arabic roots serialize with the canonical `\arsqrt`; the bundled preamble also accepts raw legacy `\arabsqrt` with the same optional-index signature. It defines BuTeX font wrappers (`\butextakween`, `\butexdiwani`, `\butexdiwanioutline`, `\butexmaghribi`) and the MathJax-compatible `\butexmirror` bridge. The fixed basmala and closing hamdala use `\butexmaghribi`. Pass `{ wrapDocument: false }` for body-only blocks. Paragraph blocks export as `\par` followed by the inline content, so prose, citations, and math are not wrapped inside `\paragraph{...}`. Optional `digitsMapping: 'arabicdigits' | 'digits'` controls eastern vs western digit font mapping in the preamble (default `'arabicdigits'`). Pass `{ twocolumn: true }` for `\documentclass[12pt,a4paper,notitlepage,twocolumn]{article}` (title block stays in-column; figures use `\columnwidth`). See [`examples/example-latex-export.tex`](examples/example-latex-export.tex) for a full sample (regenerated by the wrap vitest). Hosts can also call `getArabicXeLatexPreamble()` alone.
258
258
 
259
259
  For XeLaTeX compiler images, install `src/fonts/Almaghribi-Warsh-Quran.otf` as a system font and refresh fontconfig (`fc-cache -f -v`). Verify with `fc-match "Almaghribi Warsh Quran"`; the preamble uses that installed family name.
260
260
 
package/dist/document.js CHANGED
@@ -1379,6 +1379,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1379
1379
  category: "operators1",
1380
1380
  Tex: "\\neq",
1381
1381
  mirror: true,
1382
+ compileMirror: true,
1382
1383
  Label: "\u2260",
1383
1384
  title: "\u0644\u0627 \u064A\u0633\u0627\u0648\u064A",
1384
1385
  svg_path: null
@@ -1418,6 +1419,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1418
1419
  Tex: "\\leq",
1419
1420
  mirror: true,
1420
1421
  displayMirror: false,
1422
+ compileMirror: true,
1421
1423
  Label: "\u2264",
1422
1424
  title: "\u0623\u0635\u063A\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
1423
1425
  svg_path: null
@@ -1428,6 +1430,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1428
1430
  Tex: "\\geq",
1429
1431
  mirror: true,
1430
1432
  displayMirror: false,
1433
+ compileMirror: true,
1431
1434
  Label: "\u2265",
1432
1435
  title: "\u0623\u0643\u0628\u0631 \u0645\u0646 \u0623\u0648 \u064A\u0633\u0627\u0648\u064A",
1433
1436
  svg_path: null
@@ -1438,6 +1441,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1438
1441
  Tex: "\\coloneqq",
1439
1442
  mirror: true,
1440
1443
  displayMirror: false,
1444
+ compileMirror: true,
1441
1445
  Label: "\u2254",
1442
1446
  title: "\u064A\u0639\u0631\u0641 \u0628\u0623\u0646\u0647 \u064A\u0633\u0627\u0648\u064A",
1443
1447
  svg_path: null
@@ -1448,6 +1452,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1448
1452
  Tex: "\\eqqcolon",
1449
1453
  mirror: true,
1450
1454
  displayMirror: false,
1455
+ compileMirror: true,
1451
1456
  Label: "\u2255",
1452
1457
  title: "\u064A\u0633\u0627\u0648\u064A \u0628\u0627\u0644\u062A\u0639\u0631\u064A\u0641",
1453
1458
  svg_path: null
@@ -1459,6 +1464,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1459
1464
  Tex: "\\propto",
1460
1465
  mirror: true,
1461
1466
  displayMirror: false,
1467
+ compileMirror: true,
1462
1468
  Label: "\u221D",
1463
1469
  title: "\u064A\u062A\u0646\u0627\u0633\u0628 \u0645\u0639",
1464
1470
  svg_path: null
@@ -1469,6 +1475,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1469
1475
  Tex: "\\in",
1470
1476
  mirror: true,
1471
1477
  displayMirror: false,
1478
+ compileMirror: true,
1472
1479
  Label: "\u2208",
1473
1480
  title: "\u064A\u0646\u062A\u0645\u064A \u0625\u0644\u0649",
1474
1481
  svg_path: null
@@ -1489,6 +1496,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1489
1496
  Tex: "\\subset",
1490
1497
  mirror: true,
1491
1498
  displayMirror: false,
1499
+ compileMirror: true,
1492
1500
  Label: "\u2282",
1493
1501
  title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0645\u0646",
1494
1502
  svg_path: null
@@ -1499,6 +1507,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1499
1507
  Tex: "\\supset",
1500
1508
  mirror: true,
1501
1509
  displayMirror: false,
1510
+ compileMirror: true,
1502
1511
  Label: "\u2283",
1503
1512
  title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0644\u0640",
1504
1513
  svg_path: null
@@ -1509,6 +1518,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1509
1518
  Tex: "\\subseteq",
1510
1519
  mirror: true,
1511
1520
  displayMirror: false,
1521
+ compileMirror: true,
1512
1522
  Label: "\u2286",
1513
1523
  title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
1514
1524
  svg_path: null
@@ -1519,6 +1529,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1519
1529
  Tex: "\\supseteq",
1520
1530
  mirror: true,
1521
1531
  displayMirror: false,
1532
+ compileMirror: true,
1522
1533
  Label: "\u2287",
1523
1534
  title: "\u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
1524
1535
  svg_path: null
@@ -1559,6 +1570,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1559
1570
  Tex: "\\nsubseteq",
1560
1571
  mirror: true,
1561
1572
  displayMirror: false,
1573
+ compileMirror: true,
1562
1574
  Label: "\u2288",
1563
1575
  title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u062C\u0632\u0626\u064A\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
1564
1576
  svg_path: null
@@ -1569,6 +1581,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1569
1581
  Tex: "\\nsupseteq",
1570
1582
  mirror: true,
1571
1583
  displayMirror: false,
1584
+ compileMirror: true,
1572
1585
  Label: "\u2289",
1573
1586
  title: "\u0644\u064A\u0633\u062A \u0645\u062C\u0645\u0648\u0639\u0629 \u0634\u0627\u0645\u0644\u0629 \u0623\u0648 \u062A\u0633\u0627\u0648\u064A",
1574
1587
  svg_path: null
@@ -1616,6 +1629,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1616
1629
  Tex: "\\ddots",
1617
1630
  mirror: true,
1618
1631
  displayMirror: false,
1632
+ compileMirror: true,
1619
1633
  Label: "\u22F1",
1620
1634
  title: "\u0646\u0642\u0627\u0637 \u0642\u0637\u0631\u064A\u0629",
1621
1635
  svg_path: null
@@ -1635,6 +1649,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1635
1649
  category: "operators3",
1636
1650
  Tex: "\\implies",
1637
1651
  mirror: true,
1652
+ compileMirror: true,
1638
1653
  Label: "\u21D2",
1639
1654
  title: "\u064A\u0633\u062A\u0644\u0632\u0645",
1640
1655
  svg_path: null
@@ -1644,6 +1659,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1644
1659
  category: "operators3",
1645
1660
  Tex: "\\impliedby",
1646
1661
  mirror: true,
1662
+ compileMirror: true,
1647
1663
  Label: "\u21D0",
1648
1664
  title: "\u0645\u0633\u062A\u0644\u0632\u0645 \u0645\u0646",
1649
1665
  svg_path: null
@@ -1662,6 +1678,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1662
1678
  category: "operators3",
1663
1679
  Tex: "\\Longrightarrow",
1664
1680
  mirror: true,
1681
+ compileMirror: true,
1665
1682
  Label: "\u27F9",
1666
1683
  title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
1667
1684
  svg_path: null
@@ -1671,6 +1688,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1671
1688
  category: "operators3",
1672
1689
  Tex: "\\Longleftarrow",
1673
1690
  mirror: true,
1691
+ compileMirror: true,
1674
1692
  Label: "\u27F8",
1675
1693
  title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0637\u0648\u064A\u0644 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
1676
1694
  svg_path: null
@@ -1680,6 +1698,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1680
1698
  category: "operators3",
1681
1699
  Tex: "\\to",
1682
1700
  mirror: true,
1701
+ compileMirror: true,
1683
1702
  Label: "\u2192",
1684
1703
  title: "\u064A\u0624\u0648\u0644 \u0625\u0644\u0649",
1685
1704
  svg_path: null
@@ -1689,6 +1708,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1689
1708
  category: "operators3",
1690
1709
  Tex: "\\rightleftharpoons",
1691
1710
  mirror: true,
1711
+ compileMirror: true,
1692
1712
  Label: "\u21CC",
1693
1713
  title: "\u0627\u062A\u0632\u0627\u0646",
1694
1714
  svg_path: null
@@ -1698,6 +1718,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1698
1718
  category: "operators3",
1699
1719
  Tex: "\\leftarrow",
1700
1720
  mirror: true,
1721
+ compileMirror: true,
1701
1722
  Label: "\u2190",
1702
1723
  title: "\u0633\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
1703
1724
  svg_path: null
@@ -1707,6 +1728,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1707
1728
  category: "operators3",
1708
1729
  Tex: "\\rightarrow",
1709
1730
  mirror: true,
1731
+ compileMirror: true,
1710
1732
  Label: "\u2192",
1711
1733
  title: "\u0633\u0647\u0645 \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
1712
1734
  svg_path: null
@@ -1716,6 +1738,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1716
1738
  category: "operators3",
1717
1739
  Tex: "\\Leftarrow",
1718
1740
  mirror: true,
1741
+ compileMirror: true,
1719
1742
  Label: "\u21D0",
1720
1743
  title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
1721
1744
  svg_path: null
@@ -1725,6 +1748,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1725
1748
  category: "operators3",
1726
1749
  Tex: "\\Rightarrow",
1727
1750
  mirror: true,
1751
+ compileMirror: true,
1728
1752
  Label: "\u21D2",
1729
1753
  title: "\u0633\u0647\u0645 \u0645\u0632\u062F\u0648\u062C \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
1730
1754
  svg_path: null
@@ -1734,6 +1758,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1734
1758
  category: "operators3",
1735
1759
  Tex: "\\leftharpoonup",
1736
1760
  mirror: true,
1761
+ compileMirror: true,
1737
1762
  Label: "\u21BC",
1738
1763
  title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
1739
1764
  svg_path: null
@@ -1743,6 +1768,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1743
1768
  category: "operators3",
1744
1769
  Tex: "\\rightharpoonup",
1745
1770
  mirror: true,
1771
+ compileMirror: true,
1746
1772
  Label: "\u21C0",
1747
1773
  title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0639\u0644\u0648\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
1748
1774
  svg_path: null
@@ -1752,6 +1778,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1752
1778
  category: "operators3",
1753
1779
  Tex: "\\leftharpoondown",
1754
1780
  mirror: true,
1781
+ compileMirror: true,
1755
1782
  Label: "\u21BD",
1756
1783
  title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0633\u0641\u0644\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631",
1757
1784
  svg_path: null
@@ -1761,6 +1788,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1761
1788
  category: "operators3",
1762
1789
  Tex: "\\rightharpoondown",
1763
1790
  mirror: true,
1791
+ compileMirror: true,
1764
1792
  Label: "\u21C1",
1765
1793
  title: "\u0633\u0647\u0645 \u062E\u0637\u0627\u0641\u064A \u0633\u0641\u0644\u064A \u0625\u0644\u0649 \u0627\u0644\u064A\u0645\u064A\u0646",
1766
1794
  svg_path: null
@@ -1771,6 +1799,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1771
1799
  category: "integrals",
1772
1800
  Tex: "\\int",
1773
1801
  mirror: true,
1802
+ compileMirror: true,
1774
1803
  Label: "\u222B",
1775
1804
  title: "\u062A\u0643\u0627\u0645\u0644",
1776
1805
  svg_path: null
@@ -1781,6 +1810,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1781
1810
  Tex: "\\iint",
1782
1811
  mirror: true,
1783
1812
  displayMirror: false,
1813
+ compileMirror: true,
1784
1814
  Label: "\u222C",
1785
1815
  title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u0632\u062F\u0648\u062C",
1786
1816
  svg_path: null
@@ -1791,6 +1821,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1791
1821
  Tex: "\\iiint",
1792
1822
  mirror: true,
1793
1823
  displayMirror: false,
1824
+ compileMirror: true,
1794
1825
  Label: "\u222D",
1795
1826
  title: "\u062A\u0643\u0627\u0645\u0644 \u062B\u0644\u0627\u062B\u064A",
1796
1827
  svg_path: null
@@ -1801,6 +1832,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1801
1832
  Tex: "\\iiiint",
1802
1833
  mirror: true,
1803
1834
  displayMirror: false,
1835
+ compileMirror: true,
1804
1836
  Label: "\u2A0C",
1805
1837
  title: "\u062A\u0643\u0627\u0645\u0644 \u0631\u0628\u0627\u0639\u064A",
1806
1838
  svg_path: null
@@ -1811,6 +1843,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1811
1843
  Tex: "\\oint",
1812
1844
  mirror: true,
1813
1845
  displayMirror: false,
1846
+ compileMirror: true,
1814
1847
  Label: "\u222E",
1815
1848
  title: "\u062A\u0643\u0627\u0645\u0644 \u0645\u063A\u0644\u0642",
1816
1849
  svg_path: null
@@ -1821,6 +1854,7 @@ var ATOMIC_OPERATOR_COMMANDS = {
1821
1854
  Tex: "\\oiint",
1822
1855
  mirror: true,
1823
1856
  displayMirror: false,
1857
+ compileMirror: true,
1824
1858
  Label: "\u222F",
1825
1859
  title: "\u062A\u0643\u0627\u0645\u0644 \u0633\u0637\u062D\u064A \u0645\u063A\u0644\u0642",
1826
1860
  svg_path: null
@@ -1831,12 +1865,14 @@ var ATOMIC_OPERATOR_COMMANDS = {
1831
1865
  Tex: "\\oiiint",
1832
1866
  mirror: true,
1833
1867
  displayMirror: false,
1868
+ compileMirror: true,
1834
1869
  Label: "\u2230",
1835
1870
  title: "\u062A\u0643\u0627\u0645\u0644 \u062D\u062C\u0645\u064A \u0645\u063A\u0644\u0642",
1836
1871
  svg_path: null
1837
1872
  }
1838
1873
  };
1839
1874
  var MIRRORED_OPERATOR_TEX = Object.values(ATOMIC_OPERATOR_COMMANDS).filter((command) => command.mirror).map((command) => command.Tex).sort((a, b) => b.length - a.length);
1875
+ var COMPILE_MIRRORED_OPERATOR_TEX = Object.values(ATOMIC_OPERATOR_COMMANDS).filter((command) => "compileMirror" in command && command.compileMirror).map((command) => command.Tex).sort((a, b) => b.length - a.length);
1840
1876
  function atomicOperatorCommandSpec(id) {
1841
1877
  return Object.prototype.hasOwnProperty.call(ATOMIC_OPERATOR_COMMANDS, id) ? ATOMIC_OPERATOR_COMMANDS[id] : null;
1842
1878
  }