From 96d1e6aea789a5816bf7866c5ba2789c917c90ff Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Fri, 6 Jan 2017 19:45:51 +0100 Subject: [PATCH] Introduce defineMacro function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … as suggested by Erik Demaine, to future-proof the code. --- src/macros.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/macros.js b/src/macros.js index 197145c..f88935f 100644 --- 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}");