aboutsummaryrefslogtreecommitdiffstats
path: root/weekschedule.cls
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2026-01-11 12:41:19 -0500
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2026-01-11 12:41:19 -0500
commitb7a371f60990e50fc6ed89125af120179d84e0e3 (patch)
tree5c7ccddcffe08ee670e447127a810aa82d4354c2 /weekschedule.cls
parent3b18d762b95ba3c1dc929f909392e0c69bbda302 (diff)
downloadweekschedule-b7a371f60990e50fc6ed89125af120179d84e0e3.tar.gz
Fixed centering issues
Diffstat (limited to 'weekschedule.cls')
-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}