summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2025-04-24 15:22:41 -0600
committerChristian Kolset <christian.kolset@gmail.com>2025-04-24 15:22:41 -0600
commit7e0b4501030aa268da323c1eaa69c8a2b29ee6a3 (patch)
tree91561278b0b74bfc5cd986f043d63b0c2fd1e534
parentbb450e5566d16b642236f8c337e74a7f94124599 (diff)
Added scripts to generate tex files from markdown
-rwxr-xr-xbook/generate_module_tex.sh27
-rwxr-xr-xbook/generate_tex_files.sh32
-rw-r--r--tutorials/module_1/array.md (renamed from tutorials/module_1/1_array.md)0
-rw-r--r--tutorials/module_1/basics_of_python.md (renamed from tutorials/module_1/1_basics_of_python.md)0
-rw-r--r--tutorials/module_1/classes_and_objects.md (renamed from tutorials/module_1/1_classes_and_objects.md)0
-rw-r--r--tutorials/module_1/computational_expense.md (renamed from tutorials/module_1/1_computational_expense.md)0
-rw-r--r--tutorials/module_1/computing_fundamentals.md (renamed from tutorials/module_1/1_computing_fundamentals.md)0
-rw-r--r--tutorials/module_1/control_structures.md (renamed from tutorials/module_1/1_control_structures.md)0
-rw-r--r--tutorials/module_1/functions.md (renamed from tutorials/module_1/1_functions.md)0
-rw-r--r--tutorials/module_1/fundamentals_of_programming.md (renamed from tutorials/module_1/1_fundamentals_of_programming.md)0
-rw-r--r--tutorials/module_1/installing_anaconda.md (renamed from tutorials/module_1/1_installing_anaconda.md)0
-rw-r--r--tutorials/module_1/intro_to_anaconda.md (renamed from tutorials/module_1/1_intro_to_anaconda.md)0
-rw-r--r--tutorials/module_1/intro_to_programming.md (renamed from tutorials/module_1/1_intro_to_programming.md)0
-rw-r--r--tutorials/module_1/jupyter_lab_notebook.md (renamed from tutorials/module_1/1_jupyter_lab_notebook.md)0
-rw-r--r--tutorials/module_1/open_source_software.md (renamed from tutorials/module_1/1_open_source_software.md)0
-rw-r--r--tutorials/module_1/spyder_getting_started.md (renamed from tutorials/module_1/1_spyder_getting_started.md)0
-rw-r--r--tutorials/module_2/ai_assisted_programming.md (renamed from tutorials/module_2/2_ai_assisted_programming.md)0
-rw-r--r--tutorials/module_2/debugging_code.md (renamed from tutorials/module_2/2_debugging_code.md)0
-rw-r--r--tutorials/module_2/intro_to_numerical_methods.md (renamed from tutorials/module_2/2_01_intro_to_numerical_methods.md)0
-rw-r--r--tutorials/module_2/problem_solving_strategies.md (renamed from tutorials/module_2/2_problem_solving_strategies.md)0
-rw-r--r--tutorials/module_2/version_control.md (renamed from tutorials/module_2/2_version_control.md)0
21 files changed, 59 insertions, 0 deletions
diff --git a/book/generate_module_tex.sh b/book/generate_module_tex.sh
new file mode 100755
index 0000000..4d3c449
--- /dev/null
+++ b/book/generate_module_tex.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+book_dir="."
+
+# Loop through all module directories (module1, module2, etc.)
+for module_path in "$book_dir"/module*/; do
+ [ -d "$module_path" ] || continue
+
+ module_name=$(basename "$module_path") # e.g. module2
+ module_number="${module_name//[!0-9]/}" # extract number: 2
+ output_file="$module_path/$module_name.tex"
+
+ echo "Generating $output_file"
+
+ # Start writing the .tex file
+ {
+ echo "\\chapter{Module $module_number}"
+ for texfile in "$module_path"/*.tex; do
+ tex_base=$(basename "$texfile" .tex)
+
+ # Skip the module.tex itself
+ [[ "$tex_base" == "$module_name" ]] && continue
+
+ echo "\\input{$module_name/$tex_base}"
+ done
+ } > "$output_file"
+done
diff --git a/book/generate_tex_files.sh b/book/generate_tex_files.sh
new file mode 100755
index 0000000..87238f4
--- /dev/null
+++ b/book/generate_tex_files.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+markdown_dir="../tutorials"
+book_dir="."
+
+# Enable recursive globbing with **
+shopt -s globstar
+
+# Loop through markdown files in source directory
+for filepath in "$markdown_dir"/module_*/**/*.md; do
+ [ -e "$filepath" ] || continue
+
+ # Get module name and clean it (remove underscore)
+ module_base=$(basename "$(dirname "$filepath")") # module_#
+ module_clean="${module_base//_/}" # module#
+
+ # Get filename without extension
+ filename="${filepath##*/}" # file.md
+ filename_no_ext="${filename%.md}" # file
+
+ # Make sure output directory exists
+ output_dir="$book_dir/$module_clean"
+ mkdir -p "$output_dir"
+
+ # Define output .tex file path
+ output_file="$output_dir/$filename_no_ext.tex"
+
+ # Convert markdown to LaTeX
+ pandoc -f markdown -t latex "$filepath" -o "$output_file"
+
+ echo "Converted $filepath -> $output_file"
+done
diff --git a/tutorials/module_1/1_array.md b/tutorials/module_1/array.md
index c8f2452..c8f2452 100644
--- a/tutorials/module_1/1_array.md
+++ b/tutorials/module_1/array.md
diff --git a/tutorials/module_1/1_basics_of_python.md b/tutorials/module_1/basics_of_python.md
index 48952c6..48952c6 100644
--- a/tutorials/module_1/1_basics_of_python.md
+++ b/tutorials/module_1/basics_of_python.md
diff --git a/tutorials/module_1/1_classes_and_objects.md b/tutorials/module_1/classes_and_objects.md
index ec85633..ec85633 100644
--- a/tutorials/module_1/1_classes_and_objects.md
+++ b/tutorials/module_1/classes_and_objects.md
diff --git a/tutorials/module_1/1_computational_expense.md b/tutorials/module_1/computational_expense.md
index c9631e1..c9631e1 100644
--- a/tutorials/module_1/1_computational_expense.md
+++ b/tutorials/module_1/computational_expense.md
diff --git a/tutorials/module_1/1_computing_fundamentals.md b/tutorials/module_1/computing_fundamentals.md
index 1fef338..1fef338 100644
--- a/tutorials/module_1/1_computing_fundamentals.md
+++ b/tutorials/module_1/computing_fundamentals.md
diff --git a/tutorials/module_1/1_control_structures.md b/tutorials/module_1/control_structures.md
index 15e97eb..15e97eb 100644
--- a/tutorials/module_1/1_control_structures.md
+++ b/tutorials/module_1/control_structures.md
diff --git a/tutorials/module_1/1_functions.md b/tutorials/module_1/functions.md
index 8235fe3..8235fe3 100644
--- a/tutorials/module_1/1_functions.md
+++ b/tutorials/module_1/functions.md
diff --git a/tutorials/module_1/1_fundamentals_of_programming.md b/tutorials/module_1/fundamentals_of_programming.md
index 617d2c3..617d2c3 100644
--- a/tutorials/module_1/1_fundamentals_of_programming.md
+++ b/tutorials/module_1/fundamentals_of_programming.md
diff --git a/tutorials/module_1/1_installing_anaconda.md b/tutorials/module_1/installing_anaconda.md
index baa4d71..baa4d71 100644
--- a/tutorials/module_1/1_installing_anaconda.md
+++ b/tutorials/module_1/installing_anaconda.md
diff --git a/tutorials/module_1/1_intro_to_anaconda.md b/tutorials/module_1/intro_to_anaconda.md
index 84c6516..84c6516 100644
--- a/tutorials/module_1/1_intro_to_anaconda.md
+++ b/tutorials/module_1/intro_to_anaconda.md
diff --git a/tutorials/module_1/1_intro_to_programming.md b/tutorials/module_1/intro_to_programming.md
index 2f12a3a..2f12a3a 100644
--- a/tutorials/module_1/1_intro_to_programming.md
+++ b/tutorials/module_1/intro_to_programming.md
diff --git a/tutorials/module_1/1_jupyter_lab_notebook.md b/tutorials/module_1/jupyter_lab_notebook.md
index 5fa493a..5fa493a 100644
--- a/tutorials/module_1/1_jupyter_lab_notebook.md
+++ b/tutorials/module_1/jupyter_lab_notebook.md
diff --git a/tutorials/module_1/1_open_source_software.md b/tutorials/module_1/open_source_software.md
index d82b30a..d82b30a 100644
--- a/tutorials/module_1/1_open_source_software.md
+++ b/tutorials/module_1/open_source_software.md
diff --git a/tutorials/module_1/1_spyder_getting_started.md b/tutorials/module_1/spyder_getting_started.md
index ba055d7..ba055d7 100644
--- a/tutorials/module_1/1_spyder_getting_started.md
+++ b/tutorials/module_1/spyder_getting_started.md
diff --git a/tutorials/module_2/2_ai_assisted_programming.md b/tutorials/module_2/ai_assisted_programming.md
index bccedbd..bccedbd 100644
--- a/tutorials/module_2/2_ai_assisted_programming.md
+++ b/tutorials/module_2/ai_assisted_programming.md
diff --git a/tutorials/module_2/2_debugging_code.md b/tutorials/module_2/debugging_code.md
index ef8dfce..ef8dfce 100644
--- a/tutorials/module_2/2_debugging_code.md
+++ b/tutorials/module_2/debugging_code.md
diff --git a/tutorials/module_2/2_01_intro_to_numerical_methods.md b/tutorials/module_2/intro_to_numerical_methods.md
index 6791aff..6791aff 100644
--- a/tutorials/module_2/2_01_intro_to_numerical_methods.md
+++ b/tutorials/module_2/intro_to_numerical_methods.md
diff --git a/tutorials/module_2/2_problem_solving_strategies.md b/tutorials/module_2/problem_solving_strategies.md
index 1a50aec..1a50aec 100644
--- a/tutorials/module_2/2_problem_solving_strategies.md
+++ b/tutorials/module_2/problem_solving_strategies.md
diff --git a/tutorials/module_2/2_version_control.md b/tutorials/module_2/version_control.md
index 78b90db..78b90db 100644
--- a/tutorials/module_2/2_version_control.md
+++ b/tutorials/module_2/version_control.md