@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.
@@ -1912,6 +1912,15 @@ var ATOMIC_COMMANDS = {
1912
1912
  title: "\u0641\u0631\u0627\u063A \u0633\u0627\u0644\u0628 \u0631\u0641\u064A\u0639",
1913
1913
  spacing: { direction: "negative", level: 1 }
1914
1914
  },
1915
+ thinSpace: {
1916
+ id: "thinSpace",
1917
+ category: "spacing",
1918
+ englishTex: "\\,",
1919
+ arabicTex: "\\,",
1920
+ arabicLabel: "",
1921
+ title: "\u0641\u0631\u0627\u063A \u0631\u0641\u064A\u0639",
1922
+ spacing: { direction: "positive", level: 1 }
1923
+ },
1915
1924
  mediumSpace: {
1916
1925
  id: "mediumSpace",
1917
1926
  category: "spacing",
@@ -3072,6 +3081,10 @@ function renderNodeEnglish(node, options) {
3072
3081
  }
3073
3082
  if (node.kind === "char") {
3074
3083
  if (node.sourceLatex) {
3084
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
3085
+ const boldSource = node.sourceLatex.startsWith("\\mathbf{") ? node.sourceLatex : `\\mathbf{${node.sourceLatex}}`;
3086
+ return `${boldSource}${latinScripts(node, options)}`;
3087
+ }
3075
3088
  return `${node.sourceLatex}${latinScripts(node, options)}`;
3076
3089
  }
3077
3090
  if (node.wrapperCommand) {
@@ -4197,20 +4210,27 @@ function editableWrapperCommand(node) {
4197
4210
  return null;
4198
4211
  }
4199
4212
  const child = singleCommandChar(node);
4200
- if (!child) {
4201
- return null;
4202
- }
4203
- const normalized = normalizeCharImportExpr(child.expr);
4204
- const editorNode = createEditorNode("char", normalized.expr);
4205
- if (normalized.characterFont !== "default") {
4206
- editorNode.characterFont = normalized.characterFont;
4213
+ let editorNode;
4214
+ if (child) {
4215
+ const normalized = normalizeCharImportExpr(child.expr);
4216
+ editorNode = createEditorNode("char", normalized.expr);
4217
+ if (normalized.characterFont !== "default") {
4218
+ editorNode.characterFont = normalized.characterFont;
4219
+ }
4220
+ } else {
4221
+ if (node.optionalArgs.length || node.mandatoryArgs.length !== 1) return null;
4222
+ const nodes = node.mandatoryArgs[0]?.chain;
4223
+ if (!nodes || nodes.length !== 1 || !(nodes[0] instanceof CommandNode)) return null;
4224
+ const nested = charFromTextLikeCommand(nodes[0]);
4225
+ if (!nested?.editable) return null;
4226
+ editorNode = nested.node;
4207
4227
  }
4208
4228
  editorNode.wrapperCommand = node.name === "\\mathtt" ? "\\mathtt" : node.name === "\\mathbf" ? "\\mathbf" : node.name === "\\boldarabic" ? "\\boldarabic" : "\\unit";
4209
4229
  const scripts = attachScripts(node, editorNode);
4210
4230
  if (scripts) {
4211
4231
  return scripts;
4212
4232
  }
4213
- if (!editorNode.sourceLatex && node.name === "\\mathsf") {
4233
+ if (!editorNode.sourceLatex && node.name === "\\mathsf" && child) {
4214
4234
  editorNode.sourceLatex = `\\mathsf{${child.expr}}`;
4215
4235
  }
4216
4236
  return { editable: true, node: editorNode };