{"id":9849694,"date":"2018-01-10T03:49:45","date_gmt":"2018-01-10T03:49:45","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/macros\/"},"modified":"2018-01-10T03:53:23","modified_gmt":"2018-01-10T03:53:23","slug":"macros","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/macros\/","title":{"rendered":"macros"},"content":{"rendered":"<p>In the <a href=\"https:\/\/github.com\/Khan\/KaTeX#rendering-options\">katex documentation<\/a>, there&#8217;s a macro option detailed.  Example:<\/p>\n<p>katex.render(&#8220;c = \\\\pm\\\\sqrt{a^2 + b^2}\\\\in\\\\RR&#8221;, element, {<br \/>\n  displayMode: true,<br \/>\n  macros: {<br \/>\n    &#8220;\\\\RR&#8221;: &#8220;\\\\mathbb{R}&#8221;<br \/>\n  }<br \/>\n});<\/p>\n<p>Is is possible to set a default set of macros in WP-Katex, either for the page in question, or for all pages?<\/p>\n<p>With the Mathjax-Latex plugin this is possible using something like:<\/p>\n<p>    Macros: {<br \/>\nifrac: [&#8216;{#1}\/{#2}&#8217;, 2],<br \/>\nReal: [&#8216;{\\\\textrm{Re}}&#8217;, 0],<br \/>\nlr: [&#8216;{\\\\left(#1\\\\right)}&#8217;, 1],<br \/>\nbiglr: [&#8216;{\\\\Bigl(#1\\\\Bigr)}&#8217;, 1],<br \/>\nBiglr: [&#8216;{\\\\Biggl(#1\\\\Biggr)}&#8217;, 1],<br \/>\nsetlr: [&#8216;{\\\\left\\\\{#1\\\\right\\\\}}&#8217;, 1],<br \/>\nevalbar: [&#8216;{{\\\\left.{#1}\\\\right\\\\vert}_{#2}}&#8217;, 2],<br \/>\nevalrange: [&#8216;{{\\\\left.{#1}\\\\right\\\\vert}_{#2}^{#3}}&#8217;, 3],<br \/>\nevalnobar: [&#8216;{{#1}_{#2}}&#8217;, 2],<br \/>\nBa: [&#8216;{\\\\mathbf{a}}&#8217;, 0],<br \/>\n&#8230;<br \/>\n},<\/p>\n<p>(where the macros are placed in the MathJax\/config\/mathjax.js configuration file)<\/p>\n","protected":false},"template":"","class_list":["post-9849694","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9849694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9849694\/revisions"}],"predecessor-version":[{"id":9849696,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9849694\/revisions\/9849696"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=9849694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}