Skip to content

Commit 9c54177

Browse files
authored
Move latex preamble into conf.py [ci skip] (#298)
This should mean we can use the same preamble within method docstrings.
1 parent 2d3de8e commit 9c54177

File tree

4 files changed

+60
-112
lines changed

4 files changed

+60
-112
lines changed

doc/conf.py

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,65 @@ def add_source_parser(_old_add_source_parser, self, *args, **kwargs):
8181
nbsphinx_kernel_name='python'
8282
nbsphinx_timeout = 60
8383

84-
# -- extensions configuration ---------------------------------------------------
84+
# -- latex configuration ---------------------------------------------------
85+
86+
galgebra_latex_macros = R"""
87+
\newcommand{\bm}[1]{\boldsymbol{#1}}
88+
\newcommand{\ubh}{\bm{\hat{u}}}
89+
\newcommand{\ebh}{\bm{\hat{e}}}
90+
\newcommand{\ebf}{\bm{e}}
91+
\newcommand{\mat}[1]{\left [ {#1} \right ]}
92+
\newcommand{\bra}[1]{{#1}_{\mathcal{G}}}
93+
\newcommand{\ket}[1]{{#1}_{\mathcal{D}}}
94+
\newcommand{\ds}{\displaystyle}
95+
\newcommand{\bfrac}[2]{\displaystyle\frac{#1}{#2}}
96+
\newcommand{\lp}{\left (}
97+
\newcommand{\rp}{\right )}
98+
\newcommand{\half}{\frac{1}{2}}
99+
\newcommand{\llt}{\left <}
100+
\newcommand{\rgt}{\right >}
101+
\newcommand{\abs}[1]{\left |{#1}\right |}
102+
\newcommand{\pdiff}[2]{\bfrac{\partial {#1}}{\partial {#2}}}
103+
\newcommand{\pdifftwo}[3]{\bfrac{\partial^{2} {#1}}{\partial {#2}\partial {#3}}}
104+
\newcommand{\lbrc}{\left \{}
105+
\newcommand{\rbrc}{\right \}}
106+
\newcommand{\set}[1]{\lbrc {#1} \rbrc}
107+
\newcommand{\W}{\wedge}
108+
\newcommand{\R}{\dagger}
109+
\newcommand{\lbrk}{\left [}
110+
\newcommand{\rbrk}{\right ]}
111+
\newcommand{\com}[1]{\lbrk {#1} \rbrk}
112+
\newcommand{\proj}[2]{\llt {#1} \rgt_{#2}}
113+
%\newcommand{\bm}{\boldsymbol}
114+
\newcommand{\braces}[1]{\left \{ {#1} \right \}}
115+
\newcommand{\grade}[1]{\left < {#1} \right >}
116+
\newcommand{\f}[2]{{#1}\lp {#2} \rp }
117+
\newcommand{\paren}[1]{\lp {#1} \rp }
118+
\newcommand{\eval}[2]{\left . {#1} \right |_{#2}}
119+
\newcommand{\prm}[1]{{#1}'}
120+
\newcommand{\ddt}[1]{\bfrac{d{#1}}{dt}}
121+
\newcommand{\deriv}[3]{\bfrac{d^{#3}#1}{d{#2}^{#3}}}
122+
\newcommand{\be}{\begin{equation}}
123+
\newcommand{\ee}{\end{equation}}
124+
\newcommand{\eb}{\bm{e}}
125+
\newcommand{\ehb}{\bm{\hat{e}}}
126+
\newcommand{\Tn}[2]{\f{\mathcal{T}_{#2}}{#1}}
127+
\newcommand{\tr}{\mbox{tr}}
128+
\newcommand{\T}[1]{\texttt{#1}}
129+
\newcommand{\grd}{\bm{\nabla}}
130+
\newcommand{\indices}[1]{#1}
131+
\newcommand{\xRightarrow}[1]{\overset{#1}{\Rightarrow}}
132+
"""
133+
134+
# enable autonumbering
135+
mathjax_config = dict(TeX=dict(
136+
equationNumbers=dict(autoNumber="AMS"),
137+
extensions=["[Contrib]/preamble/preamble.js"],
138+
preamble=[galgebra_latex_macros]
139+
))
140+
141+
142+
# -- other extension configuration --------------------------------------------
85143

86144
napoleon_include_init_with_doc= False
87145

@@ -211,7 +269,7 @@ def add_source_parser(_old_add_source_parser, self, *args, **kwargs):
211269

212270
# Additional stuff for the LaTeX preamble.
213271
#
214-
# 'preamble': '',
272+
'preamble': galgebra_latex_macros,
215273

216274
# Latex figure (float) alignment
217275
#

doc/galgebra_guide.rst

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,6 @@
11
What is Geometric Algebra?
22
==========================
33

4-
.. raw:: html
5-
6-
<script type="text/x-mathjax-config">
7-
MathJax.Hub.Config({TeX: { equationNumbers: { autoNumber: "AMS" } }});
8-
</script>
9-
10-
.. math::
11-
12-
\newcommand{\bm}[1]{\boldsymbol{#1}}
13-
\newcommand{\ubh}{\bm{\hat{u}}}
14-
\newcommand{\ebh}{\bm{\hat{e}}}
15-
\newcommand{\ebf}{\bm{e}}
16-
\newcommand{\mat}[1]{\left [ {#1} \right ]}
17-
\newcommand{\bra}[1]{{#1}_{\mathcal{G}}}
18-
\newcommand{\ket}[1]{{#1}_{\mathcal{D}}}
19-
\newcommand{\ds}{\displaystyle}
20-
\newcommand{\bfrac}[2]{\displaystyle\frac{#1}{#2}}
21-
\newcommand{\lp}{\left (}
22-
\newcommand{\rp}{\right )}
23-
\newcommand{\half}{\frac{1}{2}}
24-
\newcommand{\llt}{\left <}
25-
\newcommand{\rgt}{\right >}
26-
\newcommand{\abs}[1]{\left |{#1}\right |}
27-
\newcommand{\pdiff}[2]{\bfrac{\partial {#1}}{\partial {#2}}}
28-
\newcommand{\pdifftwo}[3]{\bfrac{\partial^{2} {#1}}{\partial {#2}\partial {#3}}}
29-
\newcommand{\lbrc}{\left \{}
30-
\newcommand{\rbrc}{\right \}}
31-
\newcommand{\set}[1]{\lbrc {#1} \rbrc}
32-
\newcommand{\W}{\wedge}
33-
\newcommand{\R}{\dagger}
34-
\newcommand{\lbrk}{\left [}
35-
\newcommand{\rbrk}{\right ]}
36-
\newcommand{\com}[1]{\lbrk {#1} \rbrk}
37-
\newcommand{\proj}[2]{\llt {#1} \rgt_{#2}}
38-
%\newcommand{\bm}{\boldsymbol}
39-
\newcommand{\braces}[1]{\left \{ {#1} \right \}}
40-
\newcommand{\grade}[1]{\left < {#1} \right >}
41-
\newcommand{\f}[2]{{#1}\lp {#2} \rp }
42-
\newcommand{\paren}[1]{\lp {#1} \rp }
43-
\newcommand{\eval}[2]{\left . {#1} \right |_{#2}}
44-
\newcommand{\prm}[1]{{#1}'}
45-
\newcommand{\ddt}[1]{\bfrac{d{#1}}{dt}}
46-
\newcommand{\deriv}[3]{\bfrac{d^{#3}#1}{d{#2}^{#3}}}
47-
\newcommand{\be}{\begin{equation}}
48-
\newcommand{\ee}{\end{equation}}
49-
\newcommand{\eb}{\bm{e}}
50-
\newcommand{\ehb}{\bm{\hat{e}}}
51-
\newcommand{\Tn}[2]{\f{\mathcal{T}_{#2}}{#1}}
52-
\newcommand{\tr}{\mbox{tr}}
53-
\newcommand{\T}[1]{\texttt{#1}}
54-
\newcommand{\grd}{\bm{\nabla}}
55-
\newcommand{\indices}[1]{#1}
56-
\newcommand{\xRightarrow}[1]{\overset{#1}{\Rightarrow}}
574

585
Basics of Geometric Algebra
596
---------------------------

doc/math-config.txt

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

doc/module-components.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
Module Components
22
=================
33

4-
.. include:: math-config.txt
5-
64
The geometric algebra module consists of the following files and classes
75

86
+----------------+--------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+

0 commit comments

Comments
 (0)