From aae71940fc18b283536cdc254ed35d220b8a1570 Mon Sep 17 00:00:00 2001 From: Oscar Levin Date: Fri, 6 Dec 2024 11:34:46 -0700 Subject: [PATCH 1/5] make course template --- templates/course/README.md | 40 ++++ templates/course/project.ptx | 69 ++++++ templates/course/publication/publication.ptx | 219 ++++++++++++++++++ templates/course/source/activities.ptx | 15 ++ .../source/activities/activity-template.ptx | 25 ++ .../course/source/activities/magic-beans.ptx | 54 +++++ templates/course/source/backmatter.ptx | 23 ++ templates/course/source/docinfo.ptx | 43 ++++ templates/course/source/frontmatter.ptx | 28 +++ templates/course/source/main-no-syllabus.ptx | 24 ++ templates/course/source/main.ptx | 24 ++ templates/course/source/syllabus.ptx | 19 ++ 12 files changed, 583 insertions(+) create mode 100644 templates/course/README.md create mode 100644 templates/course/project.ptx create mode 100644 templates/course/publication/publication.ptx create mode 100644 templates/course/source/activities.ptx create mode 100644 templates/course/source/activities/activity-template.ptx create mode 100644 templates/course/source/activities/magic-beans.ptx create mode 100644 templates/course/source/backmatter.ptx create mode 100644 templates/course/source/docinfo.ptx create mode 100644 templates/course/source/frontmatter.ptx create mode 100644 templates/course/source/main-no-syllabus.ptx create mode 100644 templates/course/source/main.ptx create mode 100644 templates/course/source/syllabus.ptx diff --git a/templates/course/README.md b/templates/course/README.md new file mode 100644 index 00000000..c49ec24e --- /dev/null +++ b/templates/course/README.md @@ -0,0 +1,40 @@ +# Demo Course + +This is an example of how you could set up a "course" in PreTeXt. + +## Instructions + +Build the entire course with: + +```bash +pretext build web +``` + +and then view it with + +```bash +pretext view +``` + +If you want to build just a single activity, say the "Four Proofs" activity, run: + +```bash +pretext build ./source/activities/four-proofs.ptx +``` + +This will create a pdf inside the `source/activities` directory. + +Another thing to try: + +```bash +pretext build web -i ./source/main-no-syllabus.ptx +``` + +Note that there is a `web` target in `project.ptx` but it builds from `main.ptx` not `main-no-syllabus.ptx`. So using the `-i` flag, you can override the input file but still use the settings for an existing target. + +### How this is done + +Look at the source files, in particular `source/acitivies.ptx` and `source/activities/four_proofs.ptx` to see how the activities are included in the main document and can also build on their own. + +The use of `xpointer="/1/1/1"` is a little mysterious; we could have also used `xpoint="Activity-four-proofs"` to refer to the activity by its `xml:id`, although this would require us changing that for each included activity. + diff --git a/templates/course/project.ptx b/templates/course/project.ptx new file mode 100644 index 00000000..ea7a74eb --- /dev/null +++ b/templates/course/project.ptx @@ -0,0 +1,69 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/course/publication/publication.ptx b/templates/course/publication/publication.ptx new file mode 100644 index 00000000..7879b8d4 --- /dev/null +++ b/templates/course/publication/publication.ptx @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/course/source/activities.ptx b/templates/course/source/activities.ptx new file mode 100644 index 00000000..17095fe0 --- /dev/null +++ b/templates/course/source/activities.ptx @@ -0,0 +1,15 @@ + + + + In-Class Activities + + +

+ These activities are designed to be used in class to help students understand the material. They are not graded, but students are encouraged to work on them in groups and ask the instructor for help when needed. +

+
+ + + + +
\ No newline at end of file diff --git a/templates/course/source/activities/activity-template.ptx b/templates/course/source/activities/activity-template.ptx new file mode 100644 index 00000000..346757cf --- /dev/null +++ b/templates/course/source/activities/activity-template.ptx @@ -0,0 +1,25 @@ + + + +
+ + + + Activity Title + + +

+ This is the introduction to the activity. +

+
+ + + +

+ This is the first exercise. +

+
+
+
+
+
diff --git a/templates/course/source/activities/magic-beans.ptx b/templates/course/source/activities/magic-beans.ptx new file mode 100644 index 00000000..3df42547 --- /dev/null +++ b/templates/course/source/activities/magic-beans.ptx @@ -0,0 +1,54 @@ + + + +
+ + Magic Beans + +

+ You have traded your cow for 5 magic chocolate covered espresso beans. + Each night at midnight, each bean splits into three beans. + To take advantage of this, you eat 8 beans each morning for breakfast. + You wonder how many beans you will have after breakfast 30 days after you traded your cow. +

+ +

+ Let (b_n)_{n\ge 0} be the sequence of number of beans you have n days after trading your cow, (after breakfast, before midnight; take b_0 = 5). +

+
+ + + + + +

+ Write out the first few terms of the sequence. + Then give a recursive definition for the sequence and explain how you know it is correct. +

+
+
+ + + +

+ What do you notice about all elements of the sequence? Will they all be ...? Prove your conjecture by mathematical induction. +

+
+
+
+ + + + + +

+ Find a closed formula for b_n and prove it is correct using induction. +

+
+
+
+
+ + +
+
\ No newline at end of file diff --git a/templates/course/source/backmatter.ptx b/templates/course/source/backmatter.ptx new file mode 100644 index 00000000..d9fc1973 --- /dev/null +++ b/templates/course/source/backmatter.ptx @@ -0,0 +1,23 @@ + + + + + + + + + Backmatter + + + + + + + + + + +

This book was authored in .

+
+
+ diff --git a/templates/course/source/docinfo.ptx b/templates/course/source/docinfo.ptx new file mode 100644 index 00000000..d4fe0f08 --- /dev/null +++ b/templates/course/source/docinfo.ptx @@ -0,0 +1,43 @@ + + + + + + + + MATH12345-Spring2037 + + + + + + + + + + + + + \newcommand{\N}{\mathbb N} + \newcommand{\Z}{\mathbb Z} + \newcommand{\Q}{\mathbb Q} + \newcommand{\R}{\mathbb R} + + + + + + \usepackage{tikz, pgfplots} + \usetikzlibrary{positioning,matrix,arrows} + \usetikzlibrary{shapes,decorations,shadows,fadings,patterns} + \usetikzlibrary{decorations.markings} + + + + + + + + + + diff --git a/templates/course/source/frontmatter.ptx b/templates/course/source/frontmatter.ptx new file mode 100644 index 00000000..1247b51e --- /dev/null +++ b/templates/course/source/frontmatter.ptx @@ -0,0 +1,28 @@ + + + + + + + + + + Instructor Lastname + Mathematical Sciences + University of Templates + + + + + + + + + + + + + + + + diff --git a/templates/course/source/main-no-syllabus.ptx b/templates/course/source/main-no-syllabus.ptx new file mode 100644 index 00000000..c83368bf --- /dev/null +++ b/templates/course/source/main-no-syllabus.ptx @@ -0,0 +1,24 @@ + + + + + + + + Demo Course + + + + + + + + + + + + + + + + diff --git a/templates/course/source/main.ptx b/templates/course/source/main.ptx new file mode 100644 index 00000000..c9a4f96c --- /dev/null +++ b/templates/course/source/main.ptx @@ -0,0 +1,24 @@ + + + + + + + + Demo Course + + + + + + + + + + + + + + + + diff --git a/templates/course/source/syllabus.ptx b/templates/course/source/syllabus.ptx new file mode 100644 index 00000000..a65b1738 --- /dev/null +++ b/templates/course/source/syllabus.ptx @@ -0,0 +1,19 @@ + + + + Course Syllabus + +

Welcome to the course.

+ + + + Course Information +

This course is about magic beans. And about how bad copilot is at writing syllabi.

+
+ + + Grading +

This course has no grades because it is just a demo.

+
+ +
\ No newline at end of file From 09e7c7da386a661d2c12566b4fde8e80f377030f Mon Sep 17 00:00:00 2001 From: Oscar Levin Date: Fri, 6 Dec 2024 11:38:37 -0700 Subject: [PATCH 2/5] update readme --- templates/course/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/course/README.md b/templates/course/README.md index c49ec24e..2fdc851a 100644 --- a/templates/course/README.md +++ b/templates/course/README.md @@ -16,10 +16,10 @@ and then view it with pretext view ``` -If you want to build just a single activity, say the "Four Proofs" activity, run: +If you want to build just a single activity, say the "Magic Beans" activity, run: ```bash -pretext build ./source/activities/four-proofs.ptx +pretext build ./source/activities/magic-beans.ptx ``` This will create a pdf inside the `source/activities` directory. @@ -34,7 +34,7 @@ Note that there is a `web` target in `project.ptx` but it builds from `main.ptx` ### How this is done -Look at the source files, in particular `source/acitivies.ptx` and `source/activities/four_proofs.ptx` to see how the activities are included in the main document and can also build on their own. +Look at the source files, in particular `source/acitivies.ptx` and `source/activities/magic-beans.ptx` to see how the activities are included in the main document and can also build on their own. -The use of `xpointer="/1/1/1"` is a little mysterious; we could have also used `xpoint="Activity-four-proofs"` to refer to the activity by its `xml:id`, although this would require us changing that for each included activity. +The use of `xpointer="/1/1/1"` is a little mysterious; we could have also used `xpoint="Activity-magic-beans"` to refer to the activity by its `xml:id`, although this would require us changing that for each included activity. From 43d1e252e7f3d4213a262cc3d5d48edcc9568c99 Mon Sep 17 00:00:00 2001 From: Oscar Levin Date: Fri, 6 Dec 2024 11:45:01 -0700 Subject: [PATCH 3/5] add notes --- templates/course/source/course-notes.ptx | 15 +++++++++++++++ templates/course/source/main.ptx | 2 ++ templates/course/source/notes/week01.ptx | 14 ++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 templates/course/source/course-notes.ptx create mode 100644 templates/course/source/notes/week01.ptx diff --git a/templates/course/source/course-notes.ptx b/templates/course/source/course-notes.ptx new file mode 100644 index 00000000..57d7897d --- /dev/null +++ b/templates/course/source/course-notes.ptx @@ -0,0 +1,15 @@ + + + + Course Notes + + +

+ The following notes are intended to remind you what we covered each week. They are not a substitute for attending class and not a substitute for reading the textbook. +

+
+ + + + +
\ No newline at end of file diff --git a/templates/course/source/main.ptx b/templates/course/source/main.ptx index c9a4f96c..08fa33ad 100644 --- a/templates/course/source/main.ptx +++ b/templates/course/source/main.ptx @@ -13,6 +13,8 @@ + + diff --git a/templates/course/source/notes/week01.ptx b/templates/course/source/notes/week01.ptx new file mode 100644 index 00000000..5a969ff6 --- /dev/null +++ b/templates/course/source/notes/week01.ptx @@ -0,0 +1,14 @@ + + + +
+
+ Week 1 +

+ This week we covered the following topics: +

+ + +
+
+
\ No newline at end of file From 5089f50111b51c3fd5bd23005a4ab745bc1512da Mon Sep 17 00:00:00 2001 From: Oscar Levin Date: Fri, 6 Dec 2024 11:55:20 -0700 Subject: [PATCH 4/5] fix xmlid --- pretext/constants.py | 2 +- templates/course/source/course-notes.ptx | 2 +- templates/course/source/frontmatter.ptx | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pretext/constants.py b/pretext/constants.py index febf111f..53a058b2 100644 --- a/pretext/constants.py +++ b/pretext/constants.py @@ -1,7 +1,7 @@ import typing as t from pathlib import Path -NEW_TEMPLATES = ["book", "article", "demo", "hello", "slideshow"] +NEW_TEMPLATES = ["book", "article", "course", "demo", "hello", "slideshow"] FORMATS = [ "html", diff --git a/templates/course/source/course-notes.ptx b/templates/course/source/course-notes.ptx index 57d7897d..2e0e706c 100644 --- a/templates/course/source/course-notes.ptx +++ b/templates/course/source/course-notes.ptx @@ -1,6 +1,6 @@ - + Course Notes diff --git a/templates/course/source/frontmatter.ptx b/templates/course/source/frontmatter.ptx index 1247b51e..7fb9ac0c 100644 --- a/templates/course/source/frontmatter.ptx +++ b/templates/course/source/frontmatter.ptx @@ -5,16 +5,15 @@ - Instructor Lastname Mathematical Sciences University of Templates - + Last Updated: - + From 0d011a0e86178425a46483188c87ba8f3d4bbe3b Mon Sep 17 00:00:00 2001 From: Oscar Levin Date: Fri, 6 Dec 2024 13:11:33 -0700 Subject: [PATCH 5/5] improve xpointers --- templates/course/source/activities.ptx | 4 ++-- .../course/source/activities/activity-template.ptx | 2 +- templates/course/source/activities/magic-beans.ptx | 2 +- templates/course/source/course-notes.ptx | 3 ++- templates/course/source/notes/week01.ptx | 5 ++--- templates/course/source/notes/week02.ptx | 13 +++++++++++++ 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 templates/course/source/notes/week02.ptx diff --git a/templates/course/source/activities.ptx b/templates/course/source/activities.ptx index 17095fe0..5d84c002 100644 --- a/templates/course/source/activities.ptx +++ b/templates/course/source/activities.ptx @@ -8,8 +8,8 @@ These activities are designed to be used in class to help students understand the material. They are not graded, but students are encouraged to work on them in groups and ask the instructor for help when needed.

- - + +
\ No newline at end of file diff --git a/templates/course/source/activities/activity-template.ptx b/templates/course/source/activities/activity-template.ptx index 346757cf..b9c3960d 100644 --- a/templates/course/source/activities/activity-template.ptx +++ b/templates/course/source/activities/activity-template.ptx @@ -1,7 +1,7 @@ -
+
diff --git a/templates/course/source/activities/magic-beans.ptx b/templates/course/source/activities/magic-beans.ptx index 3df42547..14427cdb 100644 --- a/templates/course/source/activities/magic-beans.ptx +++ b/templates/course/source/activities/magic-beans.ptx @@ -1,7 +1,7 @@ -
+
Magic Beans diff --git a/templates/course/source/course-notes.ptx b/templates/course/source/course-notes.ptx index 2e0e706c..0a61851b 100644 --- a/templates/course/source/course-notes.ptx +++ b/templates/course/source/course-notes.ptx @@ -9,7 +9,8 @@

- + + \ No newline at end of file diff --git a/templates/course/source/notes/week01.ptx b/templates/course/source/notes/week01.ptx index 5a969ff6..be4df2a0 100644 --- a/templates/course/source/notes/week01.ptx +++ b/templates/course/source/notes/week01.ptx @@ -1,14 +1,13 @@ -
-
+
+
Week 1

This week we covered the following topics:

-
\ No newline at end of file diff --git a/templates/course/source/notes/week02.ptx b/templates/course/source/notes/week02.ptx new file mode 100644 index 00000000..3e3e2dcc --- /dev/null +++ b/templates/course/source/notes/week02.ptx @@ -0,0 +1,13 @@ + + + +
+
+ Week 2 +

+ This week we covered the following topics in the second week. +

+ +
+
+
\ No newline at end of file