@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.
@@ -137,7 +137,7 @@ var DelimiterNode = class extends BaseAstNode {
137
137
  this.rightDelimExpr = rightDelimExpr2;
138
138
  }
139
139
  latex() {
140
- return this.leftDelimExpr + this.innerExpr.latex() + this.rightDelimExpr + this.latexScripts();
140
+ return this.leftDelimExpr + " " + this.innerExpr.latex() + this.rightDelimExpr + this.latexScripts();
141
141
  }
142
142
  arabicLatex() {
143
143
  const sup = this.superscript !== null ? this.superscript.arabicLatex() : "";
@@ -2853,6 +2853,21 @@ function renderDivideOperatorLatex(side) {
2853
2853
  return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
2854
2854
  }
2855
2855
 
2856
+ // src/editor/rawOperatorPresentation.ts
2857
+ var RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE = {
2858
+ "<": ">",
2859
+ ">": "<"
2860
+ };
2861
+ function renderRawOperatorLatex(expr, side) {
2862
+ if (isDivideOperatorExpr(expr)) {
2863
+ return renderDivideOperatorLatex(side);
2864
+ }
2865
+ if (side === "arabic" && Object.prototype.hasOwnProperty.call(RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE, expr)) {
2866
+ return `\\butexmirror{${expr}}`;
2867
+ }
2868
+ return expr;
2869
+ }
2870
+
2856
2871
  // src/editor/render.ts
2857
2872
  function selectedDigitForm(options) {
2858
2873
  return options?.digitForm ?? "western";
@@ -2960,7 +2975,7 @@ function renderCharContent(node, options) {
2960
2975
  }
2961
2976
  function renderNodeEnglish(node, options) {
2962
2977
  if (node.kind === "delimiter" && node.innerExpr) {
2963
- return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
2978
+ return `${node.leftDelimExpr} ${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
2964
2979
  }
2965
2980
  if (node.kind === "boxed" && node.innerExpr) {
2966
2981
  const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
@@ -3012,8 +3027,8 @@ function renderNodeEnglish(node, options) {
3012
3027
  }
3013
3028
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
3014
3029
  }
3015
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3016
- return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
3030
+ if (node.kind === "operator") {
3031
+ return `${renderRawOperatorLatex(node.expr, "english")}${latinScripts(node, options)}`;
3017
3032
  }
3018
3033
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
3019
3034
  }
@@ -3073,8 +3088,8 @@ function renderNodeArabic(node, options) {
3073
3088
  }
3074
3089
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
3075
3090
  }
3076
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3077
- return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
3091
+ if (node.kind === "operator") {
3092
+ return arabicScripts(node, renderRawOperatorLatex(node.expr, "arabic"), options);
3078
3093
  }
3079
3094
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
3080
3095
  }