@drghaliasri/butex 8.0.0 → 8.0.1

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.
@@ -2169,6 +2169,15 @@ var ATOMIC_COMMANDS = {
2169
2169
  title: "\u0641\u0631\u0627\u063A \u0633\u0627\u0644\u0628 \u0631\u0641\u064A\u0639",
2170
2170
  spacing: { direction: "negative", level: 1 }
2171
2171
  },
2172
+ thinSpace: {
2173
+ id: "thinSpace",
2174
+ category: "spacing",
2175
+ englishTex: "\\,",
2176
+ arabicTex: "\\,",
2177
+ arabicLabel: "",
2178
+ title: "\u0641\u0631\u0627\u063A \u0631\u0641\u064A\u0639",
2179
+ spacing: { direction: "positive", level: 1 }
2180
+ },
2172
2181
  mediumSpace: {
2173
2182
  id: "mediumSpace",
2174
2183
  category: "spacing",
@@ -3393,6 +3402,10 @@ function renderNodeEnglish(node, options) {
3393
3402
  }
3394
3403
  if (node.kind === "char") {
3395
3404
  if (node.sourceLatex) {
3405
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
3406
+ const boldSource = node.sourceLatex.startsWith("\\mathbf{") ? node.sourceLatex : `\\mathbf{${node.sourceLatex}}`;
3407
+ return `${boldSource}${latinScripts(node, options)}`;
3408
+ }
3396
3409
  return `${node.sourceLatex}${latinScripts(node, options)}`;
3397
3410
  }
3398
3411
  if (node.wrapperCommand) {
@@ -4334,6 +4347,7 @@ var ENGLISH_COMMAND_TITLES = {
4334
4347
  C: "Complex numbers",
4335
4348
  H: "Quaternions",
4336
4349
  negThinSpace: "Negative thin space",
4350
+ thinSpace: "Thin space",
4337
4351
  mediumSpace: "Medium space",
4338
4352
  thickSpace: "Thick space",
4339
4353
  quadSpace: "Large space",
@@ -8504,20 +8518,27 @@ function editableWrapperCommand(node) {
8504
8518
  return null;
8505
8519
  }
8506
8520
  const child = singleCommandChar(node);
8507
- if (!child) {
8508
- return null;
8509
- }
8510
- const normalized = normalizeCharImportExpr(child.expr);
8511
- const editorNode = createEditorNode("char", normalized.expr);
8512
- if (normalized.characterFont !== "default") {
8513
- editorNode.characterFont = normalized.characterFont;
8521
+ let editorNode;
8522
+ if (child) {
8523
+ const normalized = normalizeCharImportExpr(child.expr);
8524
+ editorNode = createEditorNode("char", normalized.expr);
8525
+ if (normalized.characterFont !== "default") {
8526
+ editorNode.characterFont = normalized.characterFont;
8527
+ }
8528
+ } else {
8529
+ if (node.optionalArgs.length || node.mandatoryArgs.length !== 1) return null;
8530
+ const nodes = node.mandatoryArgs[0]?.chain;
8531
+ if (!nodes || nodes.length !== 1 || !(nodes[0] instanceof CommandNode)) return null;
8532
+ const nested = charFromTextLikeCommand(nodes[0]);
8533
+ if (!nested?.editable) return null;
8534
+ editorNode = nested.node;
8514
8535
  }
8515
8536
  editorNode.wrapperCommand = node.name === "\\mathtt" ? "\\mathtt" : node.name === "\\mathbf" ? "\\mathbf" : node.name === "\\boldarabic" ? "\\boldarabic" : "\\unit";
8516
8537
  const scripts = attachScripts(node, editorNode);
8517
8538
  if (scripts) {
8518
8539
  return scripts;
8519
8540
  }
8520
- if (!editorNode.sourceLatex && node.name === "\\mathsf") {
8541
+ if (!editorNode.sourceLatex && node.name === "\\mathsf" && child) {
8521
8542
  editorNode.sourceLatex = `\\mathsf{${child.expr}}`;
8522
8543
  }
8523
8544
  return { editable: true, node: editorNode };