katex 0.18.6 → 0.18.7

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/katex.mjs CHANGED
@@ -12207,6 +12207,38 @@ defineFunction({
12207
12207
  }
12208
12208
  });
12209
12209
 
12210
+ var handler = (_ref, args) => {
12211
+ var parser = _ref.parser;
12212
+ return {
12213
+ type: "reflectbox",
12214
+ mode: parser.mode,
12215
+ body: args[0]
12216
+ };
12217
+ };
12218
+ defineFunction({
12219
+ type: "reflectbox",
12220
+ names: ["\\reflectbox"],
12221
+ numArgs: 1,
12222
+ argTypes: ["hbox"],
12223
+ allowedInText: true,
12224
+ handler,
12225
+ htmlBuilder(group, options) {
12226
+ return makeSpan(["mord", "reflectbox"], [buildGroup$1(group.body, options)], options);
12227
+ },
12228
+ mathmlBuilder(group, options) {
12229
+ return buildGroup(group.body, options);
12230
+ }
12231
+ });
12232
+ // Parse math directly so the shared builders inherit the surrounding style.
12233
+ // \reflectbox instead uses an hbox argument for LaTeX's text-box behavior.
12234
+ defineFunction({
12235
+ type: "reflectbox",
12236
+ names: ["\\mathreflectbox"],
12237
+ numArgs: 1,
12238
+ argTypes: ["math"],
12239
+ handler
12240
+ });
12241
+
12210
12242
  defineFunction({
12211
12243
  type: "internal",
12212
12244
  names: ["\\relax"],
@@ -14086,6 +14118,8 @@ defineMacro("\u27e6", "\\llbracket"); // blackboard bold [
14086
14118
  defineMacro("\u27e7", "\\rrbracket"); // blackboard bold ]
14087
14119
  defineMacro("\\lBrace", "\\html@mathml{" + "\\mathopen{\\{\\mkern-3.2mu[}}" + "{\\mathopen{\\char`\u2983}}");
14088
14120
  defineMacro("\\rBrace", "\\html@mathml{" + "\\mathclose{]\\mkern-3.2mu\\}}}" + "{\\mathclose{\\char`\u2984}}");
14121
+ defineMacro("↤", "\\mapsfrom");
14122
+ defineMacro("\\mapsfrom", "\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}");
14089
14123
  defineMacro("\u2983", "\\lBrace"); // blackboard bold {
14090
14124
  defineMacro("\u2984", "\\rBrace"); // blackboard bold }
14091
14125
  // TODO: Create variable sized versions of the last two items. I believe that
@@ -16275,7 +16309,7 @@ var renderToHTMLTree = function renderToHTMLTree(expression, options) {
16275
16309
  return renderError(error, expression, settings);
16276
16310
  }
16277
16311
  };
16278
- var version = "0.18.6";
16312
+ var version = "0.18.7";
16279
16313
  var __domTree = {
16280
16314
  Span,
16281
16315
  Anchor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "katex",
3
- "version": "0.18.6",
3
+ "version": "0.18.7",
4
4
  "description": "Fast math typesetting for the web.",
5
5
  "main": "dist/katex.js",
6
6
  "types": "types/katex.d.ts",
@@ -0,0 +1,43 @@
1
+ import defineFunction from "../defineFunction";
2
+ import type {FunctionHandler} from "../defineFunction";
3
+ import {makeSpan} from "../buildCommon";
4
+
5
+ import * as html from "../buildHTML";
6
+ import * as mml from "../buildMathML";
7
+
8
+ const handler: FunctionHandler<"reflectbox"> = ({parser}, args) => ({
9
+ type: "reflectbox",
10
+ mode: parser.mode,
11
+ body: args[0],
12
+ });
13
+
14
+ defineFunction({
15
+ type: "reflectbox",
16
+ names: ["\\reflectbox"],
17
+ numArgs: 1,
18
+ argTypes: ["hbox"],
19
+ allowedInText: true,
20
+
21
+ handler,
22
+
23
+ htmlBuilder(group, options) {
24
+ return makeSpan(
25
+ ["mord", "reflectbox"],
26
+ [html.buildGroup(group.body, options)],
27
+ options,
28
+ );
29
+ },
30
+ mathmlBuilder(group, options) {
31
+ return mml.buildGroup(group.body, options);
32
+ },
33
+ });
34
+
35
+ // Parse math directly so the shared builders inherit the surrounding style.
36
+ // \reflectbox instead uses an hbox argument for LaTeX's text-box behavior.
37
+ defineFunction({
38
+ type: "reflectbox",
39
+ names: ["\\mathreflectbox"],
40
+ numArgs: 1,
41
+ argTypes: ["math"],
42
+ handler,
43
+ });
package/src/functions.ts CHANGED
@@ -37,6 +37,7 @@ import "./functions/ordgroup";
37
37
  import "./functions/overline";
38
38
  import "./functions/phantom";
39
39
  import "./functions/raisebox";
40
+ import "./functions/reflectbox";
40
41
  import "./functions/relax";
41
42
  import "./functions/rule";
42
43
  import "./functions/sizing";
package/src/macros.ts CHANGED
@@ -811,6 +811,12 @@ defineMacro("\\rBrace", "\\html@mathml{" +
811
811
  "\\mathclose{]\\mkern-3.2mu\\}}}" +
812
812
  "{\\mathclose{\\char`\u2984}}");
813
813
 
814
+ defineMacro("↤", "\\mapsfrom");
815
+ defineMacro(
816
+ "\\mapsfrom",
817
+ "\\html@mathml{\\mathrel{\\mathreflectbox{\\mapsto}}}{\\mathrel{\\char`↤}}",
818
+ );
819
+
814
820
  defineMacro("\u2983", "\\lBrace"); // blackboard bold {
815
821
  defineMacro("\u2984", "\\rBrace"); // blackboard bold }
816
822
 
@@ -602,6 +602,11 @@ $display-margin: 1em 0 !default;
602
602
  padding: 0 0.03889em; // pad 1mu left and right (in scriptstyle)
603
603
  }
604
604
 
605
+ .reflectbox {
606
+ display: inline-block;
607
+ transform: scaleX(-1);
608
+ }
609
+
605
610
  .eqn-num::before {
606
611
  counter-increment: katexEqnNo;
607
612
  content: "(" counter(katexEqnNo) ")";
@@ -69,7 +69,8 @@ export type AnyParseNode =
69
69
  | SmashNode
70
70
  | SqrtNode
71
71
  | VerticalCenterNode
72
- | ExtensibleArrowNode;
72
+ | ExtensibleArrowNode
73
+ | ReflectBoxNode;
73
74
 
74
75
  // ParseNode's corresponding to Symbol `Group`s in symbols.js.
75
76
  export type SymbolParseNode =
@@ -454,3 +455,8 @@ type ExtensibleArrowNode = BaseNode & {
454
455
  body: AnyParseNode;
455
456
  below: AnyParseNode | null;
456
457
  }
458
+
459
+ type ReflectBoxNode = BaseNode & {
460
+ type: "reflectbox";
461
+ body: AnyParseNode;
462
+ };