Index: docs/sphinx-docs/build_sphinx.py
===================================================================
--- docs/sphinx-docs/build_sphinx.py	(revision 31943715d145c5ad0cc2df2ac75442591490886e)
+++ docs/sphinx-docs/build_sphinx.py	(revision f477159602807c5dfc0a1ec9bd2b3f438185ddc3)
@@ -324,4 +324,80 @@
         print("!!!!NO MODEL DOCS WILL BE BUILT!!!!")
 
+def retrieve_bumps_docs():
+    """
+    Copies select files from the bumps documentation into fitting perspective
+    """
+    if os.path.exists(BUMPS_DOCS):
+        print("=== Retrieve BUMPS Docs ===")
+        filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")]
+        filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png"))
+        filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png"))
+        for f in filenames:
+            print("Copying file", f)
+            shutil.copy(f, BUMPS_TARGET)
+    else:
+        print("""
+======= Error =======
+missing directory %s
+The documentation will not include the optimizer selection section.
+Checkout the bumps source tree and rebuild the docs.
+""" % BUMPS_DOCS)
+
+def apidoc():
+    """
+    Runs sphinx-apidoc to generate .rst files from the docstrings in .py files
+    in the SasView build directory.
+    """
+    print("=== Generate API Rest Files ===")
+
+    # Clean directory before generating a new version.
+    _remove_dir(SPHINX_SOURCE_API)
+
+    subprocess.call(["sphinx-apidoc",
+                     "-o", SPHINX_SOURCE_API, # Output dir.
+                     "-d", "8", # Max depth of TOC.
+                     SASVIEW_BUILD])
+
+def build_pdf():
+    """
+    Runs sphinx-build for pdf.  Reads in all .rst files and spits out the final html.
+    """
+    print("=== Build PDF Docs from ReST Files ===")
+    subprocess.call(["sphinx-build",
+                     "-b", "latex", # Builder name. TODO: accept as arg to setup.py.
+                     "-d", os.path.join(SPHINX_BUILD, "doctrees"),
+                     SPHINX_SOURCE,
+                     os.path.join(SPHINX_BUILD, "latex")])
+
+    LATEXDIR = os.path.join(SPHINX_BUILD, "latex")
+    def pdflatex():
+        subprocess.call(["pdflatex", "Sasview.tex"], cwd=LATEXDIR)
+    pdflatex()
+    pdflatex()
+    pdflatex()
+    subprocess.call(["makeindex", "-s", "python.ist", "Sasview.idx"], cwd=LATEXDIR)
+    pdflatex()
+    pdflatex()
+
+    print("=== Copy PDF to HTML Directory ===")
+    source = os.path.join(LATEXDIR, "Sasview.pdf")
+    target = os.path.join(SASVIEW_DOCS, "Sasview.pdf")
+    shutil.copyfile(source, target)
+
+def build():
+    """
+    Runs sphinx-build.  Reads in all .rst files and spits out the final html.
+    """
+    print("=== Build HTML Docs from ReST Files ===")
+    subprocess.call(["sphinx-build",
+                     "-b", "html", # Builder name. TODO: accept as arg to setup.py.
+                     "-d", os.path.join(SPHINX_BUILD, "doctrees"),
+                     SPHINX_SOURCE,
+                     os.path.join(SPHINX_BUILD, "html")])
+
+    print("=== Copy HTML Docs to Build Directory ===")
+    html = os.path.join(SPHINX_BUILD, "html")
+    copy_tree(html, SASVIEW_DOCS)
+
 def fetch_katex(version, destination="_static"):
     from zipfile import ZipFile
@@ -339,83 +415,15 @@
         zip.extractall(destination)
 
-def retrieve_bumps_docs():
-    """
-    Copies select files from the bumps documentation into fitting perspective
-    """
-    if os.path.exists(BUMPS_DOCS):
-        print("=== Retrieve BUMPS Docs ===")
-        filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")]
-        filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png"))
-        filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png"))
-        for f in filenames:
-            print("Copying file", f)
-            shutil.copy(f, BUMPS_TARGET)
-    else:
-        print("""
-======= Error =======
-missing directory %s
-The documentation will not include the optimizer selection section.
-Checkout the bumps source tree and rebuild the docs.
-""" % BUMPS_DOCS)
-
-def apidoc():
-    """
-    Runs sphinx-apidoc to generate .rst files from the docstrings in .py files
-    in the SasView build directory.
-    """
-    print("=== Generate API Rest Files ===")
-
-    # Clean directory before generating a new version.
-    _remove_dir(SPHINX_SOURCE_API)
-
-    subprocess.call(["sphinx-apidoc",
-                     "-o", SPHINX_SOURCE_API, # Output dir.
-                     "-d", "8", # Max depth of TOC.
-                     SASVIEW_BUILD])
-
-def build_pdf():
-    """
-    Runs sphinx-build for pdf.  Reads in all .rst files and spits out the final html.
-    """
-    print("=== Build PDF Docs from ReST Files ===")
-    subprocess.call(["sphinx-build",
-                     "-b", "latex", # Builder name. TODO: accept as arg to setup.py.
-                     "-d", os.path.join(SPHINX_BUILD, "doctrees"),
-                     SPHINX_SOURCE,
-                     os.path.join(SPHINX_BUILD, "latex")])
-
-    LATEXDIR = os.path.join(SPHINX_BUILD, "latex")
-    def pdflatex():
-        subprocess.call(["pdflatex", "Sasview.tex"], cwd=LATEXDIR)
-    pdflatex()
-    pdflatex()
-    pdflatex()
-    subprocess.call(["makeindex", "-s", "python.ist", "Sasview.idx"], cwd=LATEXDIR)
-    pdflatex()
-    pdflatex()
-
-    print("=== Copy PDF to HTML Directory ===")
-    source = os.path.join(LATEXDIR, "Sasview.pdf")
-    target = os.path.join(SASVIEW_DOCS, "Sasview.pdf")
-    shutil.copyfile(source, target)
-
-def build():
-    """
-    Runs sphinx-build.  Reads in all .rst files and spits out the final html.
-    """
-    print("=== Build HTML Docs from ReST Files ===")
-    subprocess.call(["sphinx-build",
-                     "-b", "html", # Builder name. TODO: accept as arg to setup.py.
-                     "-d", os.path.join(SPHINX_BUILD, "doctrees"),
-                     SPHINX_SOURCE,
-                     os.path.join(SPHINX_BUILD, "html")])
-
-    print("=== Copy HTML Docs to Build Directory ===")
-    html = os.path.join(SPHINX_BUILD, "html")
-    copy_tree(html, SASVIEW_DOCS)
-
 def convert_katex():
     print("=== Preprocess HTML, converting latex to html ===")
     subprocess.call(["node", "convertKaTex.js", SASVIEW_DOCS])
+
+def convert_mathjax():
+    print("=== Preprocess HTML, converting latex to html ===")
+    subprocess.call(["node", "convertMathJax.js", SASVIEW_DOCS])
+
+def fetch_mathjax():
+    subprocess.call(["npm", "install", "mathjax-node-page"])
+    # TODO: copy fonts from node_modules/mathjax/fonts/HTML-CSS/Tex into static
 
 def rebuild():
@@ -424,9 +432,11 @@
     retrieve_user_docs()
     retrieve_bumps_docs()
-    fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT)
+    #fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT)
+    #fetch_mathjax()
     apidoc()
     build()
     #build_pdf()
     #convert_katex()
+    #convert_mathjax()
 
     print("=== Done ===")
