diff --git a/rawEx/CMakeLists.txt b/rawEx/CMakeLists.txt
index e1cfe91902f267dbd5b896badc2c9c26d56ba221..b30a37b767ebf7bb5f44f69a166d6b2bf40c7c26 100644
--- a/rawEx/CMakeLists.txt
+++ b/rawEx/CMakeLists.txt
@@ -34,6 +34,20 @@ foreach(ex ${examples})
     )
     list(APPEND outputs ${ex_out})
     # message(STATUS "ADD ${ex_out}")
+
+    # configure the version of examples to produce documentation figures
+    string(REPLACE ${EXAMPLES_SRC_DIR} ${EXAMPLES_FIGURES_DIR} out_path ${in_path})
+    file(MAKE_DIRECTORY ${out_path})
+    set(ex_out ${out_path}/${ex_name})
+    add_custom_command(
+        OUTPUT ${ex_out}
+        COMMAND erb -T - ${CMAKE_CURRENT_SOURCE_DIR}/figuremode.erb ${ex} > ${ex_out}
+        COMMAND chmod a+x ${ex_out}
+        DEPENDS ${ex}
+    )
+    list(APPEND outputs ${ex_out})
+    # message(STATUS "ADD ${ex_out}")
+
 endforeach()
 
 add_custom_target(configured_examples ALL DEPENDS ${outputs})
diff --git a/rawEx/publicmode.erb b/rawEx/publicmode.erb
index 1e4cde5f5db33a72e107286669f0af0ade10a8b5..fd2f21155d2595de8fec0da18dd927b1d190613a 100644
--- a/rawEx/publicmode.erb
+++ b/rawEx/publicmode.erb
@@ -1 +1 @@
-<% test_mode = false; -%>
+<% test_mode = false; figure_mode = false; -%>
diff --git a/rawEx/testmode.erb b/rawEx/testmode.erb
index ef70875592883a66c37443e2983c120dd233f542..55062df65d406acedf8e255ae857ef1ab2a16917 100644
--- a/rawEx/testmode.erb
+++ b/rawEx/testmode.erb
@@ -1 +1 @@
-<% test_mode = true; -%>
+<% test_mode = true; figure_mode = false; -%>