Skip to content

Commit ed82434

Browse files
committed
Fix LaTeX math definitions
An alternative to #80 and #81.
1 parent 059410f commit ed82434

File tree

6 files changed

+23
-30
lines changed

6 files changed

+23
-30
lines changed

doc/conf.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,25 @@
149149
# If true, keep warnings as "system message" paragraphs in the built documents.
150150
#keep_warnings = False
151151

152+
math_definitions = r"""
153+
\newcommand{\dirac}[1]{\operatorname{\delta}\left(#1\right)}
154+
\newcommand{\e}[1]{\operatorname{e}^{#1}}
155+
\newcommand{\Hankel}[3]{\mathop{{}H_{#2}^{(#1)}}\!\left(#3\right)}
156+
\newcommand{\hankel}[3]{\mathop{{}h_{#2}^{(#1)}}\!\left(#3\right)}
157+
\renewcommand{\i}{\mathrm{i}}
158+
\newcommand{\scalarprod}[2]{\left\langle#1,#2\right\rangle}
159+
\renewcommand{\vec}[1]{\mathbf{#1}}
160+
\newcommand{\wc}{\frac{\omega}{c}}
161+
"""
162+
163+
rst_prolog = """
164+
.. only:: html
165+
166+
.. rst-class:: hidden
167+
.. math::
168+
169+
""" + ' '.join(math_definitions.split('\n'))
170+
152171

153172
# -- Options for HTML output ----------------------------------------------
154173

@@ -251,7 +270,7 @@ def setup(app):
251270
#'pointsize': '10pt',
252271

253272
# Additional stuff for the LaTeX preamble.
254-
#'preamble': '',
273+
'preamble': math_definitions,
255274

256275
'printindex': '',
257276
}

doc/math-definitions.rst

Lines changed: 0 additions & 10 deletions
This file was deleted.

sfs/mono/drivingfunction.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
"""Compute driving functions for various systems.
2-
3-
.. include:: math-definitions.rst
4-
5-
"""
6-
1+
"""Compute driving functions for various systems."""
72
import numpy as np
83
from numpy.core.umath_tests import inner1d # element-wise inner product
94
from scipy.special import jn, hankel2

sfs/time/drivingfunction.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
"""Compute time based driving functions for various systems.
2-
3-
.. include:: math-definitions.rst
4-
5-
"""
1+
"""Compute time based driving functions for various systems."""
62
import numpy as np
73
from numpy.core.umath_tests import inner1d # element-wise inner product
84
from .. import defs

sfs/time/source.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
The Green's function describes the spatial sound propagation over time.
44
5-
.. include:: math-definitions.rst
6-
75
"""
86

97
import numpy as np

sfs/util.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
"""Various utility functions.
2-
3-
.. include:: math-definitions.rst
4-
5-
"""
6-
1+
"""Various utility functions."""
72
import collections
83
import numpy as np
94
from scipy.special import spherical_jn, spherical_yn

0 commit comments

Comments
 (0)