• In the katex documentation, there’s a macro option detailed. Example:

    katex.render(“c = \\pm\\sqrt{a^2 + b^2}\\in\\RR”, element, {
    displayMode: true,
    macros: {
    “\\RR”: “\\mathbb{R}”
    }
    });

    Is is possible to set a default set of macros in WP-Katex, either for the page in question, or for all pages?

    With the Mathjax-Latex plugin this is possible using something like:

    Macros: {
    ifrac: [‘{#1}/{#2}’, 2],
    Real: [‘{\\textrm{Re}}’, 0],
    lr: [‘{\\left(#1\\right)}’, 1],
    biglr: [‘{\\Bigl(#1\\Bigr)}’, 1],
    Biglr: [‘{\\Biggl(#1\\Biggr)}’, 1],
    setlr: [‘{\\left\\{#1\\right\\}}’, 1],
    evalbar: [‘{{\\left.{#1}\\right\\vert}_{#2}}’, 2],
    evalrange: [‘{{\\left.{#1}\\right\\vert}_{#2}^{#3}}’, 3],
    evalnobar: [‘{{#1}_{#2}}’, 2],
    Ba: [‘{\\mathbf{a}}’, 0],

    },

    (where the macros are placed in the MathJax/config/mathjax.js configuration file)

    • This topic was modified 7 years, 2 months ago by peeterjoot.
  • The topic ‘macros’ is closed to new replies.