From 59eebac905e2636ae1ac51aabe47156cb2f94ea6 Mon Sep 17 00:00:00 2001 From: Chris Bradfield Date: Sat, 2 Dec 2017 09:15:01 -0800 Subject: [PATCH] Add math/formula support in Sphinx --- conf.py | 2 +- learning/features/math/vector_math.rst | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/conf.py b/conf.py index 8c19966c..bfd9f5cb 100644 --- a/conf.py +++ b/conf.py @@ -11,7 +11,7 @@ needs_sphinx = '1.3' # Sphinx extension module names and templates location sys.path.append(os.path.abspath('extensions')) -extensions = ['gdscript', 'sphinx_tabs.tabs'] +extensions = ['gdscript', 'sphinx_tabs.tabs', 'sphinx.ext.imgmath'] templates_path = ['_templates'] # You can specify multiple suffix as a list of string: ['.rst', '.md'] diff --git a/learning/features/math/vector_math.rst b/learning/features/math/vector_math.rst index c77be4e5..466b7506 100644 --- a/learning/features/math/vector_math.rst +++ b/learning/features/math/vector_math.rst @@ -212,14 +212,17 @@ but is often misunderstood. Dot product is an operation on two vectors that returns a **scalar**. Unlike a vector, which contains both magnitude and direction, a scalar value has only magnitude. -The formula for dot product takes two common -forms: +The formula for dot product takes two common forms: -.. image:: img/vector_dot1.png +.. math:: + + A \cdot B = \left \| A \right \|\left \| B \right \|\cos \Theta and -.. image:: img/vector_dot2.png +.. math:: + + A \cdot B = A_{x}B_{x} + A_{y}B_{y} However, in most cases it is easiest to use the built-in method. Note that the order of the two vectors does not matter: