@drghaliasri/butex 7.3.2 → 7.3.4

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.
@@ -166,7 +166,7 @@ var DelimiterNode = class extends BaseAstNode {
166
166
  this.rightDelimExpr = rightDelimExpr2;
167
167
  }
168
168
  latex() {
169
- return this.leftDelimExpr + this.innerExpr.latex() + this.rightDelimExpr + this.latexScripts();
169
+ return this.leftDelimExpr + " " + this.innerExpr.latex() + this.rightDelimExpr + this.latexScripts();
170
170
  }
171
171
  arabicLatex() {
172
172
  const sup = this.superscript !== null ? this.superscript.arabicLatex() : "";
@@ -2882,6 +2882,21 @@ function renderDivideOperatorLatex(side) {
2882
2882
  return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
2883
2883
  }
2884
2884
 
2885
+ // src/editor/rawOperatorPresentation.ts
2886
+ var RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE = {
2887
+ "<": ">",
2888
+ ">": "<"
2889
+ };
2890
+ function renderRawOperatorLatex(expr, side) {
2891
+ if (isDivideOperatorExpr(expr)) {
2892
+ return renderDivideOperatorLatex(side);
2893
+ }
2894
+ if (side === "arabic" && Object.prototype.hasOwnProperty.call(RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE, expr)) {
2895
+ return `\\butexmirror{${expr}}`;
2896
+ }
2897
+ return expr;
2898
+ }
2899
+
2885
2900
  // src/editor/render.ts
2886
2901
  function selectedDigitForm(options) {
2887
2902
  return options?.digitForm ?? "western";
@@ -2989,7 +3004,7 @@ function renderCharContent(node, options) {
2989
3004
  }
2990
3005
  function renderNodeEnglish(node, options) {
2991
3006
  if (node.kind === "delimiter" && node.innerExpr) {
2992
- return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
3007
+ return `${node.leftDelimExpr} ${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
2993
3008
  }
2994
3009
  if (node.kind === "boxed" && node.innerExpr) {
2995
3010
  const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
@@ -3041,8 +3056,8 @@ function renderNodeEnglish(node, options) {
3041
3056
  }
3042
3057
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
3043
3058
  }
3044
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3045
- return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
3059
+ if (node.kind === "operator") {
3060
+ return `${renderRawOperatorLatex(node.expr, "english")}${latinScripts(node, options)}`;
3046
3061
  }
3047
3062
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
3048
3063
  }
@@ -3102,8 +3117,8 @@ function renderNodeArabic(node, options) {
3102
3117
  }
3103
3118
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
3104
3119
  }
3105
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3106
- return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
3120
+ if (node.kind === "operator") {
3121
+ return arabicScripts(node, renderRawOperatorLatex(node.expr, "arabic"), options);
3107
3122
  }
3108
3123
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
3109
3124
  }