@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.
@@ -1883,6 +1883,15 @@ var ATOMIC_COMMANDS = {
1883
1883
  title: "\u0641\u0631\u0627\u063A \u0633\u0627\u0644\u0628 \u0631\u0641\u064A\u0639",
1884
1884
  spacing: { direction: "negative", level: 1 }
1885
1885
  },
1886
+ thinSpace: {
1887
+ id: "thinSpace",
1888
+ category: "spacing",
1889
+ englishTex: "\\,",
1890
+ arabicTex: "\\,",
1891
+ arabicLabel: "",
1892
+ title: "\u0641\u0631\u0627\u063A \u0631\u0641\u064A\u0639",
1893
+ spacing: { direction: "positive", level: 1 }
1894
+ },
1886
1895
  mediumSpace: {
1887
1896
  id: "mediumSpace",
1888
1897
  category: "spacing",
@@ -3043,6 +3052,10 @@ function renderNodeEnglish(node, options) {
3043
3052
  }
3044
3053
  if (node.kind === "char") {
3045
3054
  if (node.sourceLatex) {
3055
+ if (node.wrapperCommand === "\\boldarabic" || node.wrapperCommand === "\\mathbf") {
3056
+ const boldSource = node.sourceLatex.startsWith("\\mathbf{") ? node.sourceLatex : `\\mathbf{${node.sourceLatex}}`;
3057
+ return `${boldSource}${latinScripts(node, options)}`;
3058
+ }
3046
3059
  return `${node.sourceLatex}${latinScripts(node, options)}`;
3047
3060
  }
3048
3061
  if (node.wrapperCommand) {
@@ -4168,20 +4181,27 @@ function editableWrapperCommand(node) {
4168
4181
  return null;
4169
4182
  }
4170
4183
  const child = singleCommandChar(node);
4171
- if (!child) {
4172
- return null;
4173
- }
4174
- const normalized = normalizeCharImportExpr(child.expr);
4175
- const editorNode = createEditorNode("char", normalized.expr);
4176
- if (normalized.characterFont !== "default") {
4177
- editorNode.characterFont = normalized.characterFont;
4184
+ let editorNode;
4185
+ if (child) {
4186
+ const normalized = normalizeCharImportExpr(child.expr);
4187
+ editorNode = createEditorNode("char", normalized.expr);
4188
+ if (normalized.characterFont !== "default") {
4189
+ editorNode.characterFont = normalized.characterFont;
4190
+ }
4191
+ } else {
4192
+ if (node.optionalArgs.length || node.mandatoryArgs.length !== 1) return null;
4193
+ const nodes = node.mandatoryArgs[0]?.chain;
4194
+ if (!nodes || nodes.length !== 1 || !(nodes[0] instanceof CommandNode)) return null;
4195
+ const nested = charFromTextLikeCommand(nodes[0]);
4196
+ if (!nested?.editable) return null;
4197
+ editorNode = nested.node;
4178
4198
  }
4179
4199
  editorNode.wrapperCommand = node.name === "\\mathtt" ? "\\mathtt" : node.name === "\\mathbf" ? "\\mathbf" : node.name === "\\boldarabic" ? "\\boldarabic" : "\\unit";
4180
4200
  const scripts = attachScripts(node, editorNode);
4181
4201
  if (scripts) {
4182
4202
  return scripts;
4183
4203
  }
4184
- if (!editorNode.sourceLatex && node.name === "\\mathsf") {
4204
+ if (!editorNode.sourceLatex && node.name === "\\mathsf" && child) {
4185
4205
  editorNode.sourceLatex = `\\mathsf{${child.expr}}`;
4186
4206
  }
4187
4207
  return { editable: true, node: editorNode };