\(
\require{mathtools}
\require{ams}
\require{physics}
\let\div\divergence
% Bold symbol
\newcommand{\x}{\mathbf{x}}
\newcommand{\y}{\mathbf{y}}
\newcommand{\z}{\mathbf{z}}
\newcommand{\f}{\mathbf{f}}
\newcommand{\u}{\mathbf{u}}
\newcommand{\s}{\mathbf{s}}
\newcommand{\w}{\mathbf{w}}
\newcommand{\xx}{\mathbf{X}}
\newcommand{\yy}{\mathbf{Y}}
\newcommand{\zz}{\mathbf{Z}}
% Shorthand
\newcommand\bf{\mathbf}
\newcommand\mbf{\mathbf}
\newcommand\tbf{\textbf}
% Number field
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\F}{\mathbb{F}}
% Probability
\newcommand{\E}{\mathrm{E}}
\newcommand{\Var}{\mathrm{Var}}
\newcommand{\Cov}{\mathrm{Cov}}
\newcommand{\Normal}{\mathcal{N}}
% Trace
\DeclareMathOperator{\Tr}{Tr}
% Norm
\DeclarePairedDelimiterX{\norm}[1]{\lVert}{\rVert}{#1}
\)
As a MathJax and javascript noob, it seems the most convenient way to define MathJax macros is to write a preamble file and include it by:
format:
html:
include-in-header: ../_utils/mathjax_preamble.html
Example: \[
\pdv{\rho}{t} + \div (\rho \u) = 0
\]
Back to topCitation
BibTeX citation:
@online{li2023,
author = {Li, Chengkun},
title = {MathJax Macros in {Quarto}},
date = {2023-08-06},
url = {https://pipme.github.io/posts/2023-08-06-Mathjax/index-gist.html},
langid = {en}
}
For attribution, please cite this work as:
Li, Chengkun. 2023.
“MathJax Macros in Quarto.” August 6,
2023.
https://pipme.github.io/posts/2023-08-06-Mathjax/index-gist.html.