@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.
package/dist/document2.js CHANGED
@@ -670,7 +670,7 @@ var DelimiterNode = class extends BaseAstNode {
670
670
  this.rightDelimExpr = rightDelimExpr2;
671
671
  }
672
672
  latex() {
673
- return this.leftDelimExpr + this.innerExpr.latex() + this.rightDelimExpr + this.latexScripts();
673
+ return this.leftDelimExpr + " " + this.innerExpr.latex() + this.rightDelimExpr + this.latexScripts();
674
674
  }
675
675
  arabicLatex() {
676
676
  const sup = this.superscript !== null ? this.superscript.arabicLatex() : "";
@@ -3276,6 +3276,21 @@ function renderDivideOperatorLatex(side) {
3276
3276
  return side === "arabic" ? "\\backslash" : DIVIDE_OPERATOR_EN;
3277
3277
  }
3278
3278
 
3279
+ // src/editor/rawOperatorPresentation.ts
3280
+ var RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE = {
3281
+ "<": ">",
3282
+ ">": "<"
3283
+ };
3284
+ function renderRawOperatorLatex(expr, side) {
3285
+ if (isDivideOperatorExpr(expr)) {
3286
+ return renderDivideOperatorLatex(side);
3287
+ }
3288
+ if (side === "arabic" && Object.prototype.hasOwnProperty.call(RTL_DIRECTIONAL_RAW_OPERATOR_SURFACE, expr)) {
3289
+ return `\\butexmirror{${expr}}`;
3290
+ }
3291
+ return expr;
3292
+ }
3293
+
3279
3294
  // src/editor/render.ts
3280
3295
  function selectedDigitForm(options) {
3281
3296
  return options?.digitForm ?? "western";
@@ -3383,7 +3398,7 @@ function renderCharContent(node, options) {
3383
3398
  }
3384
3399
  function renderNodeEnglish(node, options) {
3385
3400
  if (node.kind === "delimiter" && node.innerExpr) {
3386
- return `${node.leftDelimExpr}${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
3401
+ return `${node.leftDelimExpr} ${renderChainEnglish(node.innerExpr, options)}${node.rightDelimExpr}${latinScripts(node, options)}`;
3387
3402
  }
3388
3403
  if (node.kind === "boxed" && node.innerExpr) {
3389
3404
  const body = `\\boxed{${renderChainEnglish(node.innerExpr, options)}}`;
@@ -3435,8 +3450,8 @@ function renderNodeEnglish(node, options) {
3435
3450
  }
3436
3451
  return `${renderCharContent(node, options)}${latinScripts(node, options)}`;
3437
3452
  }
3438
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3439
- return `${renderDivideOperatorLatex("english")}${latinScripts(node, options)}`;
3453
+ if (node.kind === "operator") {
3454
+ return `${renderRawOperatorLatex(node.expr, "english")}${latinScripts(node, options)}`;
3440
3455
  }
3441
3456
  return `${formatDigits(node.expr, selectedDigitForm(options))}${latinScripts(node, options)}`;
3442
3457
  }
@@ -3496,8 +3511,8 @@ function renderNodeArabic(node, options) {
3496
3511
  }
3497
3512
  return arabicScripts(node, (node.characterFont ?? "default") === "default" ? `\\text{${escapeText(expr)}}` : content, options);
3498
3513
  }
3499
- if (node.kind === "operator" && isDivideOperatorExpr(node.expr)) {
3500
- return arabicScripts(node, renderDivideOperatorLatex("arabic"), options);
3514
+ if (node.kind === "operator") {
3515
+ return arabicScripts(node, renderRawOperatorLatex(node.expr, "arabic"), options);
3501
3516
  }
3502
3517
  return arabicScripts(node, formatDigits(node.expr, selectedDigitForm(options)), options);
3503
3518
  }