This is a testing page for the render_math extension and the MathJax output in general.

Custom macros

We can also define custom macros in the MathML blocks, which will be available on the whole page:

\newcommand{\dif}{\textup d}
\newcommand{\der}[2]{\frac{\dif #1}{\dif #2}}
\newcommand{\pder}[2]{\frac{\partial #1}{\partial #2}}

\renewcommand{\vec}[1]{\boldsymbol{#1}}              % vectors: bold, math italic
\renewcommand{\matrix}[1]{\boldsymbol{\mathrm{#1}}}  % matrices: bold, upright
\newcommand{\tensor}[1]{\boldsymbol{\mathrm{#1}}}    % tensors: bold, upright

(Unfortunately an empty math block is rendered with positive height.)

$$ \newcommand{\dif}{\textup d} \newcommand{\der}[2]{\frac{\dif #1}{\dif #2}} \newcommand{\pder}[2]{\frac{\partial #1}{\partial #2}} % \renewcommand{\vec}[1]{\boldsymbol{#1}} % vectors: bold, math italic \renewcommand{\matrix}[1]{\boldsymbol{\mathrm{#1}}} % matrices: bold, upright \newcommand{\tensor}[1]{\boldsymbol{\mathrm{#1}}} % tensors: bold, upright $$

Simple example

Simple in-text formula: \(\lambda_\alpha = \frac{k_{r,\alpha}}{\mu_\alpha}\)

And some display math mode:

$$ \begin{align} \Phi \pder{(S_w \rho_w)}{t} + \nabla \cdot (\rho_w \vec v_w) &= f_w , \\ \vec v_w &= - \lambda_w \tensor K (\nabla p_w - \rho_w \vec g) , \\ % \Phi \pder{(S_n \rho_n)}{t} + \nabla \cdot (\rho_n \vec v_n) &= f_n , \\ \vec v_n &= - \lambda_n \tensor K (\nabla p_n - \rho_n \vec g) , \\ % p_c &= p_n - p_w , \\ S_w + S_n &= 1 , \end{align} $$

Symbols from AMSsymbols

Using \dfrac: \(\dfrac \varDelta \varPhi\)

Using \frac: \(\frac \varDelta \varPhi\)