From 1e8f43f52ebc98f0f13878fdcced994e87650246 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 10 Feb 2019 22:17:06 +0100 Subject: [PATCH] DOC: Make LaTeX math definitions LaTeX compatible --- doc/conf.py | 6 ++++++ doc/math-definitions.rst | 31 ++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index a542b276..bd4d9596 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -82,6 +82,12 @@ plot_pre_code = '' plot_formats = ['svg', 'pdf'] +mathjax_config = { + 'TeX': { + 'extensions': ['newcommand.js', 'begingroup.js'], # Support for \gdef + }, +} + # Add any paths that contain templates here, relative to this directory. templates_path = ['_template'] diff --git a/doc/math-definitions.rst b/doc/math-definitions.rst index 33c66b2c..f5bba748 100644 --- a/doc/math-definitions.rst +++ b/doc/math-definitions.rst @@ -1,13 +1,22 @@ +.. raw:: latex + + \marginpar{% Avoid creating empty vertical space for the math definitions + .. rst-class:: hidden .. math:: - \newcommand{\dirac}[1]{\operatorname{\delta}\left(#1\right)} - \newcommand{\e}[1]{\operatorname{e}^{#1}} - \newcommand{\Hankel}[3]{\mathop{{}H_{#2}^{(#1)}}\!\left(#3\right)} - \newcommand{\hankel}[3]{\mathop{{}h_{#2}^{(#1)}}\!\left(#3\right)} - \newcommand{\i}{\mathrm{i}} - \newcommand{\scalarprod}[2]{\left\langle#1,#2\right\rangle} - \renewcommand{\vec}[1]{\mathbf{#1}} - \newcommand{\wc}{\frac{\omega}{c}} - \newcommand{\w}{\omega} - \newcommand{\x}{\vec{x}} - \newcommand{\n}{\vec{n}} + + \gdef\dirac#1{\operatorname{\delta}\left(#1\right)} + \gdef\e#1{\operatorname{e}^{#1}} + \gdef\Hankel#1#2#3{\mathop{{}H_{#2}^{(#1)}}\!\left(#3\right)} + \gdef\hankel#1#2#3{\mathop{{}h_{#2}^{(#1)}}\!\left(#3\right)} + \gdef\i{\mathrm{i}} + \gdef\scalarprod#1#2{\left\langle#1,#2\right\rangle} + \gdef\vec#1{\mathbf{#1}} + \gdef\wc{\frac{\omega}{c}} + \gdef\w{\omega} + \gdef\x{\vec{x}} + \gdef\n{\vec{n}} + +.. raw:: latex + + }