Back to blog
May 02, 2024
2 min read

Adventuring with MDX

Really this is just an experimental page to test a variety of MDX features!

KateX in MDX

Let’s start with some fancy KateX to see if I can get math equations working on this page. Here the famous Einstein equation describing the equivalence of mass and energy:

E=mc2E=mc^2

Here is a more complex formula using the aligned environment explaining transmittance using the Power-series expansion and control variates:

T(x,y)=Tc(x,y)Tr(x,y)=eτc(x,y)eτr(x,y)=eτc(x,y)k=01k!i=1k(xyμr(x)dx)=eτc(x,y)k=01k!E[i=1kYi]\begin{aligned}T(x, y) &= T_c(x, y)T_r(x, y)\\&= e^{-\tau_c(x, y)} e^{-\tau_r(x, y)}\\ &= e^{-\tau_c(x, y)} \sum_{k=0}^{\infty} \frac{1}{k!} \prod_{i=1}^{k} \left( -\int_{x}^{y} \mu_r(x')dx \right) \\ &= e^{-\tau_c(x, y)} \sum_{k=0}^{\infty} \frac{1}{k!} \mathbb{E} \left[ \prod_{i=1}^{k} Y_i \right] \end{aligned}

Phew, glad this is working 😄!

Code blocks in MDX

Let’s see if we can write some fancy syntax-highlighted code blocks in MDX. Here is a python example:

def main(name):
    print(f'Hello, {name}!')

The theme I am using is catppuccin-latte for the light theme and catppuccin-macchiato for the dark theme. So far so good! In the future, this post will be edited to include more examples of MDX features. Stay tuned!