commit 96d1e6aea789a5816bf7866c5ba2789c917c90ff
parent 7ec455083feef02deebb0e64d0e5414213ed4196
Author: Martin von Gagern <gagern@ma.tum.de>
Date: Fri, 6 Jan 2017 19:45:51 +0100
Introduce defineMacro function
… as suggested by Erik Demaine, to future-proof the code.
Diffstat:
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/macros.js b/src/macros.js
@@ -3,13 +3,14 @@
* This can be used to define some commands in terms of others.
*/
-module.exports = {
+// This function might one day accept additional argument and do more things.
+function defineMacro(name, body) {
+ module.exports[name] = body;
+}
- //////////////////////////////////////////////////////////////////////
- // amsmath.sty
+//////////////////////////////////////////////////////////////////////
+// amsmath.sty
- // \def\overset#1#2{\binrel@{#2}\binrel@@{\mathop{\kern\z@#2}\limits^{#1}}}
- "\\overset": "\\mathop{#2}\\limits^{#1}",
- "\\underset": "\\mathop{#2}\\limits_{#1}",
-
-};
+// \def\overset#1#2{\binrel@{#2}\binrel@@{\mathop{\kern\z@#2}\limits^{#1}}}
+defineMacro("\\overset", "\\mathop{#2}\\limits^{#1}");
+defineMacro("\\underset", "\\mathop{#2}\\limits_{#1}");