7.3 Math Environments

Display math enclosed in double dollar signs ($$...$$), but note that

  • the dollar signs ($$) should not appear on separate lines
  • No space between $$ and the math content

This won't work:
$$
E = mc^2
$$

This will work:
$$E = mc^2$$

In html tags, math should be enclosed in \( ... \) for inline math and \[ ... \] for display math.

  • If using $...$, there are backticks surrounding the math after rendering…

7.3.1 Color equations

  1. In mathjax configuration file, define color macros, e.g., in libs/mathjax.html:

    <!-- MathJax V2 Configuration -->
    <script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      TeX: {
        extensions: ["color.js"], // load the color extension, support color names, RGB, and grey-scale color spaces
        equationNumbers: { autoNumber: "AMS" }, // use ams rules to number equations
        Macros: {
          // define colors
          red: ["{\\color[RGB]{185,64,71}{#1}}", 1],
        }
      }
    });
    </script>
  2. In your slide, you can use the macros, e.g., \red{...}, \blue{...}, etc.

    $$\red{Y_t} \equiv I_tI_{t-1} + (1-I_t)(1-I_{t-1})$$