Skip to content

Calendar Generation - #42

Open
ClarissaMilligan wants to merge 22 commits into
mainfrom
cm-calendar
Open

Calendar Generation#42
ClarissaMilligan wants to merge 22 commits into
mainfrom
cm-calendar

Conversation

@ClarissaMilligan

Copy link
Copy Markdown
Collaborator

Overview

I made a tool to generate calendars for the semester based on how I was using canva for this in the past. It is in a separate file called calendars.typ.

How to Use

  • There is currently only one function that the user needs called header (woops I forgot to change this name...need to do that)
  • Required parameters are:
    • A "month-range" array in the format: (numeric-starting-month, numeric-ending-month)
    • A "day-range" array in the format: (numeric-day-to-start-on, numeric-day-to-end-on). The start day will be the day the calendar starts the first week on and the end day is the day it will end a week on
  • This is what the output could look like with just these parameters in place:
image

Features

  • You can add a title to the calendar:
image
  • You can control whether or not it is a leap year and whether or not you want to start weeks on a Monday
#calendars.header(
    (2, 3),
    (23, 21),
    title: "CS-1181 FA26",
    is-leap-year: true,
    is-mon-start: true,
)
image
  • You can add arrays of dates and a color to shade the dates in on the calendar. This can be used to gray out holidays or red out finals week or whatever your heart desires
#let gray-out = (
    (9, 7),
)

#let red-out = (
    (8, 24),
)

#let gray-encodings = (gray-out, gray)
#let red-encodings = (red-out, rgb("#f59998"))

#let shadings = (
    gray-encodings,
    red-encodings
)

#calendars.header(
    (8, 9),
    (23, 19),
    title: "CS-1181 FA26",
    shading: shadings
)
image
  • You can add a list of dates and a string for the assignment/event
  • You can also provide keywords and colors to highlight text
#let colors = (
    ("zyBooks", rgb("#10a178")),
    ("lab", rgb("#104fa1")),
    ("project", rgb("#a19e10")),
    ("QUIZ", rgb("#a15d10")),
    ("exam", rgb("#a11010")),
    ("FINAL", rgb("#a11010")),
    ("MIDTERM", rgb("#a11010")),
)

#let dates = (
    (8, 30, "zyBooks #1"),
    (9, 6, "zyBooks #2"),
    (9, 13, "zyBooks #3"),

    (8, 30, "lab #1"),
    (9, 6, "lab #2"),
    (9, 13, "lab #3"),

    (9, 13, "project #1"),

    (9, 18, "QUIZ #1"),
)

#calendars.header(
    (8, 9),
    (23, 19),
    title: "CS-1181 FA26",
    color-codes: colors,
    due-dates: dates
)
image
  • Full mock-up of a semester
image

Fix/Add

  • Center the "week #" text better (I CANNOT figure this out)
  • Rename main function
  • Add more assertions
  • Add comments for the functions
  • Add ability to put a week overview text over the week
  • Add function to help generate arrays of dates?

@ClarissaMilligan ClarissaMilligan self-assigned this Jul 24, 2026
@ClarissaMilligan ClarissaMilligan added the enhancement New feature or request label Jul 24, 2026
@ReeseHatfield

ReeseHatfield commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator
  • The import will need to be added to lib.typ
  • I really like the approach of "heres a basic calendar, now add what you want to it"
  • I'm a little confused about what there is an init and header. I believe show => rules as we used them, are meant for like initializing a set of edited rules for a document. Maybe a calendar function, that accepts a header call as its first argument might be more ituitive
  • I personally am TERRIBLE with month numbers. I would greatly appreciate a lexical to numerical enum in the module
  • Other than that, no notes. This is super cool and I really like it. I think it will go super well, if we add like syllabus stuff in the next major update.

@ClarissaMilligan

ClarissaMilligan commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

DONE

  • Renamed main function
  • Added all necessary assertions to main function
  • Fully commented
  • All places where a month is expected will now accept: a numeric month value, the full month name, or a 3-letter abbreviation for the month
  • import added to lib.typ

STILL PENDING

  • Center the "week #" text better
  • Add ability to put a week overview text over the week
  • Add function to help generate arrays of dates?
  • Agree the init being separate is bad, not sure I understand the fix you are suggesting

@ClarissaMilligan

Copy link
Copy Markdown
Collaborator Author

Added ability to add week overviews. A single week overview can be provided like so:

#calendars.draw-calendar(
    ("aug", "dec"),
    (23, 12),
    week-overviews: (1, "blah", rgb("#305e61")),
)

with or without a color provided.

Or, an array of week numbers and text can be passed in:

#let overviews = (
    (1, "INTRO AND OOP REVIEW"),
    (2, "CONTINUED REVIEW, ABSTRACT CLASSES, INTERFACES"),
    (3, "DYNAMIC DISPATCH, INNER CLASSES, LAMBDAS"),
    (4, "GENERICS"),
    (5, "GENERICS, COLLECTIONS, LIST, ADT INTRO"),
    (6, "ADTS, LISTS, STACKS, QUEUES, MAPS, SETS"),
    (7, "GUI"),
    (9, "GUI"),
    (10, "RECURSION"),
    (11, "RECURSION"),
    (12, "SEARCHING, SORTING, THREADING"),
    (13, "THREADING"),
    (15, "CATCH-UP, INSTRUCTOR CHOSEN, REVIEW"),
)

#calendars.draw-calendar(
    ("aug", "dec"),
    (23, 12),
    title: "CS-1181 FA26",
    color-codes: color-coding,
    shading: shading-encodings,
    due-dates: due-dates,
    week-overviews: (overviews, rgb("#305e61")),
)
image

@ClarissaMilligan

Copy link
Copy Markdown
Collaborator Author

Fixed weird week # offset

image

@ClarissaMilligan

Copy link
Copy Markdown
Collaborator Author

Added a function to assist with generating assignments that recur. The function takes:

  • a start date
  • a total number of assignments
  • an assignment title
  • (optional) dates to skip
  • (optional) leap year flag

allows code to go from:

#let due-dates = (
    (8, 30, "zyBooks #1"),
    (9, 6, "zyBooks #2"),
    (9, 13, "zyBooks #3"),
    (9, 20, "zyBooks #4"),
    (9, 27, "zyBooks #5"),
    ("oct", 4, "zyBooks #6"),
    (10, 11, "zyBooks #7"),
    (10, 18, "zyBooks #8"),
    (10, 25, "zyBooks #9"),
    (11, 1, "zyBooks #10"),
    (11, 8, "zyBooks #11"),

    (8, 30, "lab #1"),
    (9, 6, "lab #2"),
    (9, 13, "lab #3"),
    (9, 20, "lab #4"),
    (9, 27, "lab #5"),
    (10, 4, "lab #6"),
    (10, 11, "lab #7"),
    (10, 18, "lab #8"),
    (10, 25, "lab #9"),
    (11, 1, "lab #10"),
    (11, 8, "lab #11"),
    (11, 15, "lab #12"),

    (9, 20, "project #1"),
    (10, 11, "project #2"),
    ("November", 1, "project #3"),
    (11, 22, "project #4"),

    (9, 18, "QUIZ #1"),
    (10, 16, "MIDTERM"),
    (11, 13, "QUIZ #2"),
    (12, 11, "FINAL"),
)

to:

#let non-recurring = (
    (9, 20, "project #1"),
    (10, 11, "project #2"),
    ("November", 1, "project #3"),
    (11, 22, "project #4"),

    (9, 18, "QUIZ #1"),
    (10, 16, "MIDTERM"),
    (11, 13, "QUIZ #2"),
    (12, 11, "FINAL"),
)

#let zy = calendars.construct-recurring-dates(
    ("aug", 30),
    11,
    "zyBooks",
    dates-to-skip: (10, 18)
)

#let lab = calendars.construct-recurring-dates(
    ("aug", 30),
    12,
    "lab",
    dates-to-skip: (10, 18)
)
#let due-dates = non-recurring + zy + lab

@ClarissaMilligan
ClarissaMilligan marked this pull request as ready for review July 28, 2026 19:26
@ClarissaMilligan

Copy link
Copy Markdown
Collaborator Author

Marking this ready to review. I have added everything I want. The only thing left is your point on the init function. Not sure I understand what you are suggesting, but I am no longer messing with the code, so you are welcome to fix @ReeseHatfield .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants