Index: docs/sphinx-docs/build_sphinx.py
===================================================================
--- docs/sphinx-docs/build_sphinx.py	(revision 9d566b20c0359c9db8faff3e122ef73455b848db)
+++ docs/sphinx-docs/build_sphinx.py	(revision 90d9cd3ba842c994c5f0565a6e818345b7516336)
@@ -21,5 +21,5 @@
 from os import listdir
 
-platform = '.%s-%s'%(get_platform(), sys.version[:3])
+platform = '.%s-%s'%(get_platform(),sys.version[:3])
 
 CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -46,5 +46,5 @@
 SASMODELS_SOURCE_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model")
 SASMODELS_SOURCE_IMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model", "img")
-SASMODELS_SOURCE_AUTOIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "_build", "html", "_images")
+SASMODELS_SOURCE_AUTOIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "_build", "html","_images")
 ## Don't do assemble-in-place
 ## Assemble the docs in a temporary folder
@@ -66,7 +66,4 @@
 SPHINX_SOURCE_TEST = os.path.join(SPHINX_SOURCE, "test")
 SPHINX_SOURCE_USER = os.path.join(SPHINX_SOURCE, "user")
-KATEX_PARENT = os.path.join(SPHINX_SOURCE, "_static")
-KATEX_PATH = os.path.join(KATEX_PARENT, "katex")
-KATEX_VERSION = "v0.7.1"  # https://github.com/khan/katex/releases
 
 BUMPS_DOCS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..",
@@ -76,14 +73,14 @@
 def inplace_change(filename, old_string, new_string):
 # Thanks to http://stackoverflow.com/questions/4128144/replace-string-within-file-contents
-    s = open(filename).read()
-    if old_string in s:
-        print('Changing "{old_string}" to "{new_string}"'.format(**locals()))
-        s = s.replace(old_string, new_string)
-        f = open(filename, 'w')
-        f.write(s)
-        f.flush()
-        f.close()
-    else:
-        print('No occurences of "{old_string}" found.'.format(**locals()))
+        s=open(filename).read()
+        if old_string in s:
+                print('Changing "{old_string}" to "{new_string}"'.format(**locals()))
+                s=s.replace(old_string, new_string)
+                f=open(filename, 'w')
+                f.write(s)
+                f.flush()
+                f.close()
+        else:
+                print('No occurences of "{old_string}" found.'.format(**locals()))
 
 def _remove_dir(dir_path):
@@ -101,5 +98,4 @@
     _remove_dir(SPHINX_BUILD)
     _remove_dir(SPHINX_SOURCE)
-    _remove_dir(KATEX_PATH)
     #_remove_dir(SPHINX_SOURCE_GUIFRAME)
     #_remove_dir(SPHINX_SOURCE_MODELS)
@@ -113,6 +109,6 @@
     print("=== Copying Source toctrees ===")
     if os.path.exists(SASVIEW_TOC_SOURCE):
-        print("Found docs folder at", SASVIEW_TOC_SOURCE)
-        shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE)
+       print("Found docs folder at", SASVIEW_TOC_SOURCE)
+       shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE)
 
 def retrieve_user_docs():
@@ -151,11 +147,10 @@
     print("=== Including Test Data Docs ===")
     if os.path.exists(SASVIEW_TEST):
-        print("Found docs folder at", SASVIEW_TEST)
-        shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST)
+       print("Found docs folder at", SASVIEW_TEST)
+       shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST)
 
     print("=== And the Sasmodels Docs ===")
     # Make sure we have the relevant images for the new sasmodels documentation
-    # First(!) we'll make a local reference copy for SasView
-    # (/new-models will be cleaned each build)
+    # First(!) we'll make a local reference copy for SasView (/new-models will be cleaned each build)
     if os.path.exists(SASMODELS_SOURCE_IMG):
         print("Found img folder SASMODELS_SOURCE_IMG at", SASMODELS_SOURCE_IMG)
@@ -168,9 +163,9 @@
         print("Copying sasmodels model image files...")
         for files in os.listdir(SASMODELS_SOURCE_IMG):
-            fromhere = os.path.join(SASMODELS_SOURCE_IMG, files)
-            tohere = os.path.join(SASMODELS_DEST_IMG, files)
-            shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_IMG, "was found")
+            fromhere=os.path.join(SASMODELS_SOURCE_IMG,files)
+            tohere=os.path.join(SASMODELS_DEST_IMG,files)
+            shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_IMG,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_AUTOIMG):
@@ -182,9 +177,9 @@
         print("Copying sasmodels model auto-generated image files...")
         for files in os.listdir(SASMODELS_SOURCE_AUTOIMG):
-            fromhere = os.path.join(SASMODELS_SOURCE_AUTOIMG, files)
-            tohere = os.path.join(SASMODELS_DEST_IMG, files)
-            shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_AUTOIMG, "was found")
+            fromhere=os.path.join(SASMODELS_SOURCE_AUTOIMG,files)
+            tohere=os.path.join(SASMODELS_DEST_IMG,files)
+            shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found")
 
     # And the rst prolog with the unit substitutions
@@ -196,9 +191,9 @@
             for files in os.listdir(SASMODELS_SOURCE_PROLOG):
                 if files.startswith("rst"):
-                    fromhere = os.path.join(SASMODELS_SOURCE_PROLOG, files)
-                    tohere = os.path.join(SASMODELS_DEST_PROLOG, files)
-                    shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_PROLOG, "was found")
+                    fromhere=os.path.join(SASMODELS_SOURCE_PROLOG,files)
+                    tohere=os.path.join(SASMODELS_DEST_PROLOG,files)
+                    shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_PROLOG, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_GPU):
@@ -209,9 +204,9 @@
             for files in os.listdir(SASMODELS_SOURCE_GPU):
                 if files.endswith(".rst"):
-                    fromhere = os.path.join(SASMODELS_SOURCE_GPU, files)
-                    tohere = os.path.join(SPHINX_SOURCE_USER, files)
-                    shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_GPU, "was found")
+                    fromhere=os.path.join(SASMODELS_SOURCE_GPU,files)
+                    tohere=os.path.join(SPHINX_SOURCE_USER,files)
+                    shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_GPU,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_SESANS):
@@ -222,9 +217,9 @@
             for files in os.listdir(SASMODELS_SOURCE_SESANS):
                 if files.endswith(".rst"):
-                    fromhere = os.path.join(SASMODELS_SOURCE_SESANS, files)
-                    tohere = os.path.join(SPHINX_SOURCE_USER, files)
-                    shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_SESANS, "was found")
+                    fromhere=os.path.join(SASMODELS_SOURCE_SESANS,files)
+                    tohere=os.path.join(SPHINX_SOURCE_USER,files)
+                    shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_SESANS,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_MAGNETISM):
@@ -235,9 +230,9 @@
             for files in os.listdir(SASMODELS_SOURCE_MAGNETISM):
                 if files.endswith(".rst"):
-                    fromhere = os.path.join(SASMODELS_SOURCE_MAGNETISM, files)
-                    tohere = os.path.join(SASMODELS_DEST_REF_MODELS, files)
-                    shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_MAGNETISM, "was found")
+                    fromhere=os.path.join(SASMODELS_SOURCE_MAGNETISM,files)
+                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
+                    shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_MAGNETISM,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_MAGIMG):
@@ -249,9 +244,9 @@
         print("Copying sasmodels mag image files...")
         for files in os.listdir(SASMODELS_SOURCE_MAGIMG):
-            fromhere = os.path.join(SASMODELS_SOURCE_MAGIMG, files)
-            tohere = os.path.join(SASMODELS_DEST_MAGIMG, files)
-            shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_MAGIMG, "was found")
+            fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files)
+            tohere=os.path.join(SASMODELS_DEST_MAGIMG,files)
+            shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_MAGIMG ,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_SESANSIMG):
@@ -263,9 +258,9 @@
         print("Copying sasmodels sesans image files...")
         for files in os.listdir(SASMODELS_SOURCE_SESANSIMG):
-            fromhere = os.path.join(SASMODELS_SOURCE_SESANSIMG, files)
-            tohere = os.path.join(SASMODELS_DEST_SESANSIMG, files)
-            shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_SESANSIMG, "was found")
+            fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files)
+            tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files)
+            shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_REF_MODELS):
@@ -276,7 +271,7 @@
             for files in os.listdir(SASMODELS_SOURCE_REF_MODELS):
                 if files.endswith(".rst"):
-                    fromhere = os.path.join(SASMODELS_SOURCE_REF_MODELS, files)
-                    tohere = os.path.join(SASMODELS_DEST_REF_MODELS, files)
-                    shutil.copy(fromhere, tohere)
+                    fromhere=os.path.join(SASMODELS_SOURCE_REF_MODELS,files)
+                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
+                    shutil.copy(fromhere,tohere)
             # But need to change the path to the model docs in the tocs
             for files in os.listdir(SASMODELS_DEST_REF_MODELS):
@@ -284,16 +279,16 @@
                 if files.startswith("shape"):
                     print("Changing toc paths in", files)
-                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS, files), "../../model/", "models/")
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
                 if files.startswith("sphere"):
                     print("Changing toc paths in", files)
-                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS, files), "../../model/", "models/")
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
                 if files.startswith("custom"):
                     print("Changing toc paths in", files)
-                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS, files), "../../model/", "models/")
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
                 if files.startswith("structure"):
                     print("Changing toc paths in", files)
-                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS, files), "../../model/", "models/")
-    else:
-        print("no source directory", SASMODELS_SOURCE_REF_MODELS, " was found")
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+    else:
+        print("no source directory",SASMODELS_SOURCE_REF_MODELS," was found")
 
     if os.path.exists(SASMODELS_SOURCE_MODELS):
@@ -304,7 +299,7 @@
             for files in os.listdir(SASMODELS_SOURCE_MODELS):
                 if files.endswith(".rst"):
-                    fromhere = os.path.join(SASMODELS_SOURCE_MODELS, files)
-                    tohere = os.path.join(SASMODELS_DEST_MODELS, files)
-                    shutil.copy(fromhere, tohere)
+                    fromhere=os.path.join(SASMODELS_SOURCE_MODELS,files)
+                    tohere=os.path.join(SASMODELS_DEST_MODELS,files)
+                    shutil.copy(fromhere,tohere)
         else:
             print("Missing docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
@@ -316,17 +311,16 @@
             for files in os.listdir(SASMODELS_SOURCE_MODELS):
                 if files.endswith(".rst"):
-                    fromhere = os.path.join(SASMODELS_SOURCE_MODELS, files)
-                    tohere = os.path.join(SASMODELS_DEST_MODELS, files)
-                    shutil.copy(fromhere, tohere)
+                    fromhere=os.path.join(SASMODELS_SOURCE_MODELS,files)
+                    tohere=os.path.join(SASMODELS_DEST_MODELS,files)
+                    shutil.copy(fromhere,tohere)
             # No choice but to do this because model files are all coded for images in /models/img
             print("Copying image files for build...")
             for files in os.listdir(SASMODELS_DEST_IMG):
-                fromhere = os.path.join(SASMODELS_DEST_IMG, files)
-                tohere = os.path.join(SASMODELS_DEST_BUILDIMG, files)
-                shutil.copy(fromhere, tohere)
-    else:
-        print("no source directory", SASMODELS_SOURCE_MODELS, "was found.")
+                fromhere=os.path.join(SASMODELS_DEST_IMG,files)
+                tohere=os.path.join(SASMODELS_DEST_BUILDIMG,files)
+                shutil.copy(fromhere,tohere)
+    else:
+        print("no source directory",SASMODELS_SOURCE_MODELS,"was found.")
         print("!!!!NO MODEL DOCS WILL BE BUILT!!!!")
-
 
 def fetch_katex(version, destination="_static"):
@@ -345,5 +339,4 @@
         zip.extractall(destination)
 
-
 def retrieve_bumps_docs():
     """
