www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

macros.js (736B)


      1 /**
      2  * Predefined macros for KaTeX.
      3  * This can be used to define some commands in terms of others.
      4  */
      5 
      6 // This function might one day accept additional argument and do more things.
      7 function defineMacro(name, body) {
      8     module.exports[name] = body;
      9 }
     10 
     11 //////////////////////////////////////////////////////////////////////
     12 // basics
     13 defineMacro("\\bgroup", "{");
     14 defineMacro("\\egroup", "}");
     15 defineMacro("\\begingroup", "{");
     16 defineMacro("\\endgroup", "}");
     17 
     18 //////////////////////////////////////////////////////////////////////
     19 // amsmath.sty
     20 
     21 // \def\overset#1#2{\binrel@{#2}\binrel@@{\mathop{\kern\z@#2}\limits^{#1}}}
     22 defineMacro("\\overset", "\\mathop{#2}\\limits^{#1}");
     23 defineMacro("\\underset", "\\mathop{#2}\\limits_{#1}");