Skip to content

Commit 1e8f43f

Browse files
committed
DOC: Make LaTeX math definitions LaTeX compatible
1 parent e96f334 commit 1e8f43f

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

doc/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@
8282
plot_pre_code = ''
8383
plot_formats = ['svg', 'pdf']
8484

85+
mathjax_config = {
86+
'TeX': {
87+
'extensions': ['newcommand.js', 'begingroup.js'], # Support for \gdef
88+
},
89+
}
90+
8591
# Add any paths that contain templates here, relative to this directory.
8692
templates_path = ['_template']
8793

doc/math-definitions.rst

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
.. raw:: latex
2+
3+
\marginpar{% Avoid creating empty vertical space for the math definitions
4+
15
.. rst-class:: hidden
26
.. math::
3-
\newcommand{\dirac}[1]{\operatorname{\delta}\left(#1\right)}
4-
\newcommand{\e}[1]{\operatorname{e}^{#1}}
5-
\newcommand{\Hankel}[3]{\mathop{{}H_{#2}^{(#1)}}\!\left(#3\right)}
6-
\newcommand{\hankel}[3]{\mathop{{}h_{#2}^{(#1)}}\!\left(#3\right)}
7-
\newcommand{\i}{\mathrm{i}}
8-
\newcommand{\scalarprod}[2]{\left\langle#1,#2\right\rangle}
9-
\renewcommand{\vec}[1]{\mathbf{#1}}
10-
\newcommand{\wc}{\frac{\omega}{c}}
11-
\newcommand{\w}{\omega}
12-
\newcommand{\x}{\vec{x}}
13-
\newcommand{\n}{\vec{n}}
7+
8+
\gdef\dirac#1{\operatorname{\delta}\left(#1\right)}
9+
\gdef\e#1{\operatorname{e}^{#1}}
10+
\gdef\Hankel#1#2#3{\mathop{{}H_{#2}^{(#1)}}\!\left(#3\right)}
11+
\gdef\hankel#1#2#3{\mathop{{}h_{#2}^{(#1)}}\!\left(#3\right)}
12+
\gdef\i{\mathrm{i}}
13+
\gdef\scalarprod#1#2{\left\langle#1,#2\right\rangle}
14+
\gdef\vec#1{\mathbf{#1}}
15+
\gdef\wc{\frac{\omega}{c}}
16+
\gdef\w{\omega}
17+
\gdef\x{\vec{x}}
18+
\gdef\n{\vec{n}}
19+
20+
.. raw:: latex
21+
22+
}

0 commit comments

Comments
 (0)