aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--weekly_schedule.tex203
-rw-r--r--weekschedule.cls87
2 files changed, 120 insertions, 170 deletions
diff --git a/weekly_schedule.tex b/weekly_schedule.tex
index 64c151a..ec5376a 100644
--- a/weekly_schedule.tex
+++ b/weekly_schedule.tex
@@ -1,149 +1,58 @@
-\documentclass[landscape,11pt]{article}
-\usepackage[margin=0.5in]{geometry}
-\usepackage{tikz}
-\usepackage{xcolor}
-\pagestyle{empty}
-
-% Define colors for different event types
-\definecolor{coursecolor}{RGB}{173,216,230}
-\definecolor{meetingcolor}{RGB}{255,218,185}
-\definecolor{officecolor}{RGB}{144,238,144}
-\definecolor{personalcolor}{RGB}{221,160,221}
-
+% Weekly schedule using the weekschedule class
+\documentclass{weekschedule}
+
+% ============================================
+% Schedule Configuration
+% ============================================
+
+% Title and author
+\scheduletitle{Weekly Schedule - Spring 2026}
+\scheduleauthor{Dr. Douglas B. Rumbaugh}
+
+% Time range
+\timefrom{8:00}
+\timeto{18:00}
+
+% Display format
+\twelvehourtime
+% \twentyfourhourtime
+% \weekfullmonday
+
+% ============================================
+% Define Event Classes (name and RGB color)
+% ============================================
+\eventclass{Courses}{173,216,230} % Light blue
+\eventclass{Meetings}{255,218,185} % Peach
+\eventclass{OfficeHours}{144,238,144} % Light green
+\eventclass{Personal}{221,160,221} % Light purple
+
+% ============================================
+% Define Events
+% Usage: \event{Class}{Name}{Day(s)}{Start}{End}
+% ============================================
+
+% Monday events
+\event{Meetings}{CIE Project Meeting}{Monday}{9:00}{9:30}
+\event{Meetings}{Faculty Meeting}{Monday}{10:00}{10:30}
+\event{Personal}{(Out of Office)}{Monday}{14:30}{17:00}
+
+% Tuesday/Thursday events
+\event{Courses}{MATH 220 01}{Tuesday,Thursday}{9:00}{10:30}
+\event{Courses}{CISC 460 01}{Tuesday,Thursday}{11:15}{12:45}
+\event{OfficeHours}{Office Hours}{Tuesday,Thursday}{13:00}{14:30}
+
+% Wednesday events
+\event{Meetings}{Faculty Meeting}{Wednesday}{10:00}{11:00}
+\event{Meetings}{Research Meeting}{Wednesday}{14:30}{15:30}
+
+% Monday/Wednesday/Friday events
+\event{Courses}{CISC 225 01}{Monday,Wednesday,Friday}{11:00}{12:00}
+\event{Courses}{GEND 112 01}{Monday,Wednesday,Friday}{13:30}{14:30}
+
+\event{Personal}{Out of Office}{Saturday,Monday,Thursday,Sunday}{17:00}{19:00}
+% ============================================
+% Generate the schedule
+% ============================================
\begin{document}
-
-\begin{center}
-\LARGE\textbf{Weekly Schedule - Spring 2026}\\[0.2cm]
-\Large Dr. Rumbaugh
-\end{center}
-
-\vspace{0.05cm}
-
-\begin{tikzpicture}[x=1cm, y=1cm]
- % Define parameters
- \def\daywidth{4.5}
- \def\hourheight{1.5}
- \def\starthour{8}
- \def\endhour{18}
-
- % Draw grid
- % Column headers (days)
- \foreach \day/\dayname in {0/Monday, 1/Tuesday, 2/Wednesday, 3/Thursday, 4/Friday} {
- \node[anchor=south, font=\large\bfseries] at (\day*\daywidth+2.25, -\starthour*\hourheight+0.2) {\dayname};
- }
-
- % Row headers (times)
- \foreach \hour in {\starthour,...,\endhour} {
- \pgfmathtruncatemacro{\displayhour}{mod(\hour-1,12)+1}
- \pgfmathsetmacro{\ampm}{\hour<12?"AM":"PM"}
- \node[anchor=east, font=\small] at (-0.1, -\hour*\hourheight) {\displayhour:00 \ampm};
- }
-
- % Draw vertical lines (day separators)
- \foreach \day in {0,...,5} {
- \draw[gray] (\day*\daywidth, -\starthour*\hourheight) -- (\day*\daywidth, -\endhour*\hourheight);
- }
-
- % Draw horizontal lines (hour separators)
- \foreach \hour in {\starthour,...,\endhour} {
- \draw[gray] (0, -\hour*\hourheight) -- (5*\daywidth, -\hour*\hourheight);
- }
-
- % Helper function to calculate y position from time
- % Time format: hour.fraction (e.g., 9.5 for 9:30)
-
- % Monday events
- % CIE Project Meeting Monday 9:00 - 9:30
- \fill[meetingcolor, rounded corners] (0, -9*\hourheight) rectangle (0+\daywidth, -9.5*\hourheight);
- \node[font=\small, align=center] at (0+2.25, -9.25*\hourheight) {SCPlus Project Meeting};
-
- % Faculty Meeting Monday 10:00 - 10:30
- \fill[meetingcolor, rounded corners] (0, -10*\hourheight) rectangle (0+\daywidth, -10.5*\hourheight);
- \node[font=\small, align=center] at (0+2.25, -10.25*\hourheight) {Faculty Meeting};
-
- % CISC 225 01 Monday 11:00 - 12:00
- \fill[coursecolor, rounded corners] (0, -11*\hourheight) rectangle (0+\daywidth, -12*\hourheight);
- \node[font=\small, align=center] at (0+2.25, -11.5*\hourheight) {CISC 225 01};
-
- % GEND 112 01 Monday 13:30 - 14:30 (1:30 PM - 2:30 PM)
- \fill[coursecolor, rounded corners] (0, -13.5*\hourheight) rectangle (0+\daywidth, -14.5*\hourheight);
- \node[font=\small, align=center] at (0+2.25, -14*\hourheight) {GEND 112 01};
-
- % Personal (OO) Monday 14:30 - 17:00 (2:30 PM - 5:00 PM)
- \fill[personalcolor, rounded corners] (0, -14.5*\hourheight) rectangle (0+\daywidth, -17*\hourheight);
- \node[font=\small, align=center] at (0+2.25, -15.75*\hourheight) {(Out of Office)};
-
- % Tuesday events
- % MATH 220 01 Tuesday 9:00 - 10:30
- \fill[coursecolor, rounded corners] (1*\daywidth, -9*\hourheight) rectangle (1*\daywidth+\daywidth, -10.5*\hourheight);
- \node[font=\small, align=center] at (1*\daywidth+2.25, -9.75*\hourheight) {MATH 220 01};
-
- % CISC 460 01 Tuesday 11:15 - 12:45
- \fill[coursecolor, rounded corners] (1*\daywidth, -11.25*\hourheight) rectangle (1*\daywidth+\daywidth, -12.75*\hourheight);
- \node[font=\small, align=center] at (1*\daywidth+2.25, -12*\hourheight) {CISC 460 01};
-
- % Office Hours Tuesday 13:00 - 14:30 (1:00 PM - 2:30 PM)
- \fill[officecolor, rounded corners] (1*\daywidth, -13*\hourheight) rectangle (1*\daywidth+\daywidth, -14.5*\hourheight);
- \node[font=\small, align=center] at (1*\daywidth+2.25, -13.75*\hourheight) {Office Hours};
-
- % Wednesday events
- % Faculty Meeting Wednesday 10:00 - 11:00
- \fill[meetingcolor, rounded corners] (2*\daywidth, -10*\hourheight) rectangle (2*\daywidth+\daywidth, -11*\hourheight);
- \node[font=\small, align=center] at (2*\daywidth+2.25, -10.5*\hourheight) {Faculty Meeting};
-
- % CISC 225 01 Wednesday 11:00 - 12:00
- \fill[coursecolor, rounded corners] (2*\daywidth, -11*\hourheight) rectangle (2*\daywidth+\daywidth, -12*\hourheight);
- \node[font=\small, align=center] at (2*\daywidth+2.25, -11.5*\hourheight) {CISC 225 01};
-
- % GEND 112 01 Wednesday 13:30 - 14:30
- \fill[coursecolor, rounded corners] (2*\daywidth, -13.5*\hourheight) rectangle (2*\daywidth+\daywidth, -14.5*\hourheight);
- \node[font=\small, align=center] at (2*\daywidth+2.25, -14*\hourheight) {GEND 112 01};
-
- % Research Meeting Wednesday 14:30 - 15:30
- \fill[meetingcolor, rounded corners] (2*\daywidth, -14.5*\hourheight) rectangle (2*\daywidth+\daywidth, -15.5*\hourheight);
- \node[font=\small, align=center] at (2*\daywidth+2.25, -15*\hourheight) {Research Meeting};
-
- % Thursday events
- % MATH 220 01 Thursday 9:00 - 10:30
- \fill[coursecolor, rounded corners] (3*\daywidth, -9*\hourheight) rectangle (3*\daywidth+\daywidth, -10.5*\hourheight);
- \node[font=\small, align=center] at (3*\daywidth+2.25, -9.75*\hourheight) {MATH 220 01};
-
- % CISC 460 01 Thursday 11:15 - 12:45
- \fill[coursecolor, rounded corners] (3*\daywidth, -11.25*\hourheight) rectangle (3*\daywidth+\daywidth, -12.75*\hourheight);
- \node[font=\small, align=center] at (3*\daywidth+2.25, -12*\hourheight) {CISC 460 01};
-
- % Office Hours Thursday 13:00 - 14:30
- \fill[officecolor, rounded corners] (3*\daywidth, -13*\hourheight) rectangle (3*\daywidth+\daywidth, -14.5*\hourheight);
- \node[font=\small, align=center] at (3*\daywidth+2.25, -13.75*\hourheight) {Office Hours};
-
- % Friday events
- % CISC 225 01 Friday 11:00 - 12:00
- \fill[coursecolor, rounded corners] (4*\daywidth, -11*\hourheight) rectangle (4*\daywidth+\daywidth, -12*\hourheight);
- \node[font=\small, align=center] at (4*\daywidth+2.25, -11.5*\hourheight) {CISC 225 01};
-
- % GEND 112 01 Friday 13:30 - 14:30
- \fill[coursecolor, rounded corners] (4*\daywidth, -13.5*\hourheight) rectangle (4*\daywidth+\daywidth, -14.5*\hourheight);
- \node[font=\small, align=center] at (4*\daywidth+2.25, -14*\hourheight) {GEND 112 01};
-
-\end{tikzpicture}
-
-\vspace{0.2cm}
-
-% Legend
-\begin{center}
-\begin{tikzpicture}
- \fill[coursecolor] (0,0) rectangle (0.4,0.3);
- \node[anchor=west] at (0.5,0.15) {Courses};
-
- \fill[meetingcolor] (3,0) rectangle (3.4,0.3);
- \node[anchor=west] at (3.5,0.15) {Meetings};
-
- \fill[officecolor] (6,0) rectangle (6.4,0.3);
- \node[anchor=west] at (6.5,0.15) {Office Hours};
-
- \fill[personalcolor] (9.5,0) rectangle (9.9,0.3);
- \node[anchor=west] at (10,0.15) {Personal};
-\end{tikzpicture}
-\end{center}
-
+\printschedule
\end{document}
diff --git a/weekschedule.cls b/weekschedule.cls
index 7fccb80..39b0256 100644
--- a/weekschedule.cls
+++ b/weekschedule.cls
@@ -41,6 +41,12 @@
\newcommand{\@hourheight}{1.5}
\newcommand{\@padding}{0.08}
+% Week configuration
+\newcommand{\@weektype}{workweek} % workweek, fullweeksunday, fullweekmonday
+\newcommand{\@weekdaylist}{Monday,Tuesday,Wednesday,Thursday,Friday}
+\newcommand{\@weekdaydisplay}{Monday,Tuesday,Wednesday,Thursday,Friday}
+\newcommand{\@daycount}{5}
+
% ============================================
% User-facing configuration commands
% ============================================
@@ -64,6 +70,28 @@
\newcommand{\twentyfourhourtime}{\@usetwentyfourhourtrue}
\newcommand{\twelvehourtime}{\@usetwentyfourhourfalse}
+% Week configuration toggles
+\newcommand{\weekworkweek}{%
+ \renewcommand{\@weektype}{workweek}%
+ \renewcommand{\@weekdaylist}{Monday,Tuesday,Wednesday,Thursday,Friday}%
+ \renewcommand{\@weekdaydisplay}{Monday,Tuesday,Wednesday,Thursday,Friday}%
+ \renewcommand{\@daycount}{5}%
+}
+
+\newcommand{\weekfullsunday}{%
+ \renewcommand{\@weektype}{fullweeksunday}%
+ \renewcommand{\@weekdaylist}{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday}%
+ \renewcommand{\@weekdaydisplay}{Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday}%
+ \renewcommand{\@daycount}{7}%
+}
+
+\newcommand{\weekfullmonday}{%
+ \renewcommand{\@weektype}{fullweekmonday}%
+ \renewcommand{\@weekdaylist}{Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday}%
+ \renewcommand{\@weekdaydisplay}{Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday}%
+ \renewcommand{\@daycount}{7}%
+}
+
% Layout customization
\newcommand{\setdaywidth}[1]{\renewcommand{\@daywidth}{#1}}
\newcommand{\sethourheight}[1]{\renewcommand{\@hourheight}{#1}}
@@ -84,6 +112,7 @@
% ============================================
\newcounter{@numclasses}
\setcounter{@numclasses}{0}
+\newcounter{@daypos}
% Define an event class with RGB color
% Usage: \eventclass{ClassName}{R,G,B}
@@ -123,16 +152,22 @@
\vspace{0.05cm}
\begin{tikzpicture}[x=1cm, y=1cm]
- % Store parameters
- \pgfmathsetmacro{\daywidth}{\@daywidth}
+ % Calculate dynamic day width based on number of days
+ % Reserve 1.5cm for time labels, divide remaining width by day count
+ \pgfmathsetmacro{\availablewidth}{(\textwidth/1cm) - 1.5}
+ \pgfmathsetmacro{\daywidth}{\availablewidth / \@daycount}
+
+ % Store other parameters
\pgfmathsetmacro{\hourheight}{\@hourheight}
\pgfmathsetmacro{\padding}{\@padding}
\pgfmathtruncatemacro{\starthour}{\@starthour}
\pgfmathtruncatemacro{\endhour}{\@endhour}
- % Draw column headers (days)
- \foreach \day/\dayname in {0/Monday, 1/Tuesday, 2/Wednesday, 3/Thursday, 4/Friday} {
- \node[anchor=south, font=\large\bfseries] at (\day*\daywidth+\daywidth/2, -\starthour*\hourheight+0.2) {\dayname};
+ % Draw column headers (days) - iterate through configured day list
+ \setcounter{@daypos}{0}
+ \@for\@currentday:=\@weekdaylist\do{%
+ \node[anchor=south, font=\large\bfseries] at (\the@daypos*\daywidth+\daywidth/2, -\starthour*\hourheight+0.2) {\@currentday};
+ \stepcounter{@daypos}%
}
% Draw row headers (times)
@@ -150,20 +185,21 @@
\fi
}
- % Draw vertical lines (day separators)
- \foreach \day in {0,...,5} {
+ % Draw vertical lines (day separators) - dynamically based on week type
+ \foreach \day in {0,...,\@daycount} {
\draw[gray] (\day*\daywidth, -\starthour*\hourheight) -- (\day*\daywidth, -\endhour*\hourheight);
}
% Draw horizontal lines (hour separators)
+ \pgfmathsetmacro{\gridwidth}{\@daycount*\daywidth}
\foreach \hour in {\starthour,...,\endhour} {
- \draw[gray] (0, -\hour*\hourheight) -- (5*\daywidth, -\hour*\hourheight);
+ \draw[gray] (0, -\hour*\hourheight) -- (\gridwidth, -\hour*\hourheight);
}
% Draw half-hour lines (dashed)
\pgfmathtruncatemacro{\lasthour}{\endhour-1}
\foreach \hour in {\starthour,...,\lasthour} {
- \draw[gray, dashed, line width=0.25pt] (0, -\hour*\hourheight-0.5*\hourheight) -- (5*\daywidth, -\hour*\hourheight-0.5*\hourheight);
+ \draw[gray, dashed, line width=0.25pt] (0, -\hour*\hourheight-0.5*\hourheight) -- (\gridwidth, -\hour*\hourheight-0.5*\hourheight);
}
% Draw all events
@@ -206,17 +242,21 @@
\@drawforeachday{\@evclass}{\@evname}{\@evdays}{\@startdec}{\@enddec}%
}
+\newcounter{@evdaypos}
+
\newcommand{\@drawforeachday}[5]{%
- % #1=class, #2=name, #3=days, #4=start, #5=end
- \@checkandrawday{#1}{#2}{#3}{#4}{#5}{Monday}{0}%
- \@checkandrawday{#1}{#2}{#3}{#4}{#5}{Tuesday}{1}%
- \@checkandrawday{#1}{#2}{#3}{#4}{#5}{Wednesday}{2}%
- \@checkandrawday{#1}{#2}{#3}{#4}{#5}{Thursday}{3}%
- \@checkandrawday{#1}{#2}{#3}{#4}{#5}{Friday}{4}%
+ % #1=class, #2=name, #3=event days, #4=start, #5=end
+ % Iterate through the week's day list and draw event if it's on that day
+ \setcounter{@evdaypos}{0}
+ \@for\@weekday:=\@weekdaylist\do{%
+ \@checkandrawday{#1}{#2}{#3}{#4}{#5}{\@weekday}{\the@evdaypos}%
+ \stepcounter{@evdaypos}%
+ }%
}
\newcommand{\@checkandrawday}[7]{%
- % #1=class, #2=name, #3=days string, #4=start, #5=end, #6=dayname, #7=daynum
+ % #1=class, #2=name, #3=event days string, #4=start, #5=end, #6=dayname, #7=daypos
+ % Check if this day is in the event's day list
\@checkdayinlist{#3}{#6}%
\if@daymatched
\@draweventbox{#1}{#2}{#7}{#4}{#5}%
@@ -228,10 +268,10 @@
\newcommand{\@checkdayinlist}[2]{%
% #1 = comma-separated day list, #2 = day to check
\@daymatchedfalse
- \def\@daytocheck{#2}%
+ \edef\@daytocheck{#2}%
\@for\@testday:=#1\do{%
\edef\@trimmedday{\@testday}%
- \ifx\@trimmedday\@daytocheck
+ \ifnum\pdfstrcmp{\@trimmedday}{\@daytocheck}=0
\@daymatchedtrue
\fi
}%
@@ -239,13 +279,14 @@
\newcommand{\@draweventbox}[5]{%
% #1 = class, #2 = name, #3 = day number, #4 = start decimal, #5 = end decimal
- \pgfmathsetmacro{\daywidth}{\@daywidth}
- \pgfmathsetmacro{\hourheight}{\@hourheight}
- \pgfmathsetmacro{\padding}{\@padding}
+ % Note: daywidth, hourheight, padding are already set in parent scope
+ % Clamp start and end times to calendar bounds
+ \pgfmathsetmacro{\startdec}{max(#4, \@starthour)}
+ \pgfmathsetmacro{\enddec}{min(#5, \@endhour)}
\pgfmathsetmacro{\xstart}{#3*\daywidth+\padding}
\pgfmathsetmacro{\xend}{#3*\daywidth+\daywidth-\padding}
- \pgfmathsetmacro{\ystart}{-#4*\hourheight-\padding}
- \pgfmathsetmacro{\yend}{-#5*\hourheight+\padding}
+ \pgfmathsetmacro{\ystart}{-\startdec*\hourheight-\padding}
+ \pgfmathsetmacro{\yend}{-\enddec*\hourheight+\padding}
\pgfmathsetmacro{\ymid}{(\ystart+\yend)/2}
\pgfmathsetmacro{\xcenter}{#3*\daywidth+\daywidth/2}
% Draw the box