diff --git a/Documentation/Cookbook/CMakeLists.txt b/Documentation/Cookbook/CMakeLists.txt
index 7228a6a1e4c5e60f2393baec4a1d91204870cf67..4e554cb59c1c4bfaf6f0eebbe2854caa0c44b699 100644
--- a/Documentation/Cookbook/CMakeLists.txt
+++ b/Documentation/Cookbook/CMakeLists.txt
@@ -18,16 +18,13 @@ else()
   return()
 endif()
 
-set(OTB_PYTHONPATH)
-if( EXISTS "${OTB_DIR}/CMakeCache.txt" )
-  set(OTB_INSTALL_PREFIX ${OTB_DIR})
-  set(OTB_PYTHONPATH "${OTB_INSTALL_PREFIX}/Modules/Wrappers/SWIG/src")
-elseif( EXISTS "${OTB_DIR}/UseOTB.cmake" )
-  get_filename_component(OTB_INSTALL_PREFIX ${OTB_DIR} PATH)
-  get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH)
-  get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH)
-  set(OTB_PYTHONPATH "${OTB_INSTALL_PREFIX}/lib/otb/python")
-endif()
+get_filename_component(OTB_INSTALL_PREFIX ${OTB_MODULES_DIR} PATH)
+get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH)
+get_filename_component(OTB_INSTALL_PREFIX ${OTB_INSTALL_PREFIX} PATH)
+
+message(STATUS "OTB_PYTHONPATH='${OTB_PYTHONPATH}'")
+message(STATUS "OTB_APPLICATION_PATH='${OTB_APPLICATION_PATH}'")
+message(STATUS "OTB_INSTALL_PREFIX='${OTB_INSTALL_PREFIX}'")
 
 #find Python
 find_package(PythonInterp REQUIRED)
@@ -137,12 +134,19 @@ add_custom_target(CookBookHTMLFromRST
   DEPENDS generate_otbapps_rst
   COMMENT "Building RST documentation in html")
 
-find_program(TAR_COMMAND
-  NAMES tar
-  PATHS /usr/bin
-)
+find_program(TAR_COMMAND NAMES tar)
 mark_as_advanced(TAR_COMMAND)
 
+find_program(PDFLATEX_COMMAND  NAMES pdflatex )
+mark_as_advanced(PDFLATEX_COMMAND)
+
+find_program(LATEX_COMMAND NAMES latex)
+mark_as_advanced(LATEX_COMMAND)
+
+if(NOT LATEX_COMMAND)
+  message(FATAL_ERROR "latex command not found. please add it to your path")
+endif()
+
 if(TAR_COMMAND)
   add_custom_target(CookBookArchive
     ALL
@@ -154,12 +158,6 @@ if(TAR_COMMAND)
     COMMENT "Creating archive for html CookBook")
 endif()
 
-find_program(PDFLATEX_COMMAND
-  NAMES pdflatex
-  PATHS /usr/bin
-)
-mark_as_advanced(PDFLATEX_COMMAND)
-
 if(PDFLATEX_COMMAND)
   add_custom_target(CookBookPDFFromRST
     ALL
@@ -167,4 +165,5 @@ if(PDFLATEX_COMMAND)
     WORKING_DIRECTORY ${RST_GENERATED_SOURCE_DIR}
     DEPENDS generate_otbapps_rst
     COMMENT "Building RST documentation in pdf")
+  
 endif()
diff --git a/Documentation/Cookbook/rst/Makefile.in b/Documentation/Cookbook/rst/Makefile.in
index 83ba8f3b2f8580bb6ff65d092a091e54f612cd3a..a2440433de3bd3894af3cfe43637021afff8153b 100644
--- a/Documentation/Cookbook/rst/Makefile.in
+++ b/Documentation/Cookbook/rst/Makefile.in
@@ -7,10 +7,6 @@ SPHINXBUILD   = sphinx-build
 PAPER         =
 BUILDDIR      = @RST_BUILD_DIR@
 
-# User-friendly check for sphinx-build
-ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
-$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
-endif
 
 # Internal variables.
 PAPEROPT_a4     = -D latex_paper_size=a4
diff --git a/Documentation/Cookbook/rst/conf.py.in b/Documentation/Cookbook/rst/conf.py.in
index 4c927cc3566189e398b34f42498815c6ffb2e520..210e9c9654df31b6f93ca259ec29a4e8c669e085 100644
--- a/Documentation/Cookbook/rst/conf.py.in
+++ b/Documentation/Cookbook/rst/conf.py.in
@@ -14,7 +14,12 @@
 
 import sys
 import os
-import sphinx_rtd_theme
+HAVE_RTD_THEME=False
+try:
+    import sphinx_rtd_theme
+    HAVE_RTD_THEME=True
+except:
+    pass
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -31,10 +36,12 @@ import sphinx_rtd_theme
 # ones.
 extensions = [
     'sphinx.ext.todo',
-    'sphinx.ext.mathjax',
+    'sphinx.ext.imgmath',
     'sphinx.ext.viewcode',
 ]
 
+imgmath_latex='@LATEX_COMMAND@'
+
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
@@ -104,15 +111,17 @@ pygments_style = 'sphinx'
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'sphinx_rtd_theme'
-
+if HAVE_RTD_THEME:
+    html_theme = 'sphinx_rtd_theme'
+    # Add any paths that contain custom themes here, relative to this directory.
+    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+    
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
 #html_theme_options = {}
 
-# Add any paths that contain custom themes here, relative to this directory.
-html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
@@ -165,13 +174,13 @@ html_static_path = ['_static']
 #html_split_index = False
 
 # If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+html_show_sourcelink = True
 
 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+html_show_sphinx = True
 
 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+html_show_copyright = True
 
 # If true, an OpenSearch description file will be output, and all pages will
 # contain a <link> tag referring to it.  The value of this option must be the