aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--weekschedule.cls21
1 files changed, 19 insertions, 2 deletions
diff --git a/weekschedule.cls b/weekschedule.cls
index d411537..db9be2e 100644
--- a/weekschedule.cls
+++ b/weekschedule.cls
@@ -158,7 +158,8 @@
\ifx\@scheduleauthor\empty\else\\[0.2cm]\Large\@scheduleauthor\fi%
\end{center}
\vspace{0.05cm}
-
+
+ \centering
\begin{tikzpicture}[x=1cm, y=1cm]
% Calculate dynamic day width based on number of days
% Reserve 1.5cm for time labels, divide remaining width by day count
@@ -170,6 +171,21 @@
\pgfmathsetmacro{\padding}{\@padding}
\pgfmathtruncatemacro{\starthour}{\@starthour}
\pgfmathtruncatemacro{\endhour}{\@endhour}
+
+ % Calculate grid width (used later for drawing)
+ \pgfmathsetmacro{\gridwidth}{\@daycount*\daywidth}
+
+ % Calculate shift to center the grid properly
+ % \centering centers the bounding box, which includes time labels extending left.
+ % The bounding box center is approximately at (-1.5 + gridwidth)/2.
+ % The grid center is at gridwidth/2.
+ % To align grid center with bounding box center (which is at page center),
+ % shift right by: gridwidth/2 - (-1.5 + gridwidth)/2 = 1.5/2 = 0.75cm
+ \pgfmathsetmacro{\timelabelreserved}{1.5}
+ \pgfmathsetmacro{\xshift}{\timelabelreserved/2}
+
+ % Shift everything to align grid center with page center
+ \begin{scope}[xshift=\xshift cm]
% Draw column headers (days) - iterate through configured day list
\setcounter{@daypos}{0}
@@ -226,8 +242,9 @@
\foreach \evnum in {1,...,\the@numevents} {
\@drawevent{\evnum}
}
-
+ \end{scope}
\end{tikzpicture}
+ \par
\vspace{0.2cm}