编译错误:(命令 \c@days 已定义,忽略 end{} 环境)

编译错误:(命令 \c@days 已定义,忽略 end{} 环境)

我正在尝试使用 calendar.sty 包(添加如下)创建日历。为此,我在 R 中使用 knitr .rnw 循环遍历带有日历参数的矩阵并创建了一个 .tex 文件。在我看来,.tex 文件应该可以工作,但无法编译并出现以下错误。我很确定该包存在一些冲突,但我似乎无法找出到底发生了什么,所以我可以修复它。

我的错误信息是那两个(但重复):

\@calendarwidth=\dimen274
\@currday=\count300
\@numdays=\count301
! LaTeX Error: Command \c@days already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...                                              
                                                      
l.148 \end{calendar}
                        
Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

我不知道 \c@days 如何工作或与什么相冲突,但由于某种原因,它还会忽略应该结束环境的 \end{calendar},因此它可以在下一页创建一个新的日历环境。

我的 .tex 文件(第一个错误发生在 \begin{document} 处,另一个错误发生在 \end{calendar} 处):

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Monthly Calendar
% LaTeX Template
% Version 1.2 (February 3, 2023)
%
% This template was downloaded from:
  % http://www.LaTeXTemplates.com
%
% Original author:
  % Evan Sultanik with modifications by 
% Vel ([email protected])
%
% License:
  % CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%----------------------------------------------------------------------------------------
  % PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
  
\documentclass[10p]{article}\usepackage[]{graphicx}\usepackage[]{xcolor}
% maxwidth is the original width if it is less than linewidth
% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
\let\hlipl\hlkwb

\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
 \def\at@end@of@kframe{}%
 \ifinner\ifhmode%
  \def\at@end@of@kframe{\end{minipage}}%
  \begin{minipage}{\columnwidth}%
 \fi\fi%
 \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
 \colorbox{shadecolor}{##1}\hskip-\fboxsep
     % There is no \\@totalrightmargin, so:
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}%
 {\par\unskip\endMakeFramed%
 \at@end@of@kframe}
\makeatother

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX

\usepackage{alltt} % Can also use 9pt or 11pt for a smaller or larger overall font size

%\usepackage{typearea} % makes switching between landscape and portrait possible
% use: 
  %\newpage
%\KOMAoptions{paper={portrait or landscape},pagesize}
%\recalctypearea
% to set up a change in rotation

\usepackage{calendar} % Use the calendar.sty style bundled with the template
\usepackage{parallel}
%\usepackage{enumitem}
\usepackage[landscape, a4paper, margin=0.5in]{geometry} % Page dimensions and margins
\usepackage{tikz}
\usepackage{pgffor} % creating forloops with foreach
\usepackage{forloop} %creating forloops with forloop
\usepackage{tabularx}
%\setlist{nosep}
%\usepackage{palatino} % Use the Palatino font

%----------------------------------------------------------------------------------------
  
%library(tikzDevice)


\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}
tlmgr search --global --file calendar.sty
tlmgr search --global --file forloop.sty
tlmgr search --global --file palatino.sty
\pagestyle{empty}
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
January
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Level 8}{easy non-crimp boulders of new set \eventskip chinups \eventskip stretching}
\day{Level 8}{new set \dayheader{Notes:}{}}
\day{~}{~}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
February
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
March
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
April
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Level 8}{easy non-crimp boulders of new set \eventskip chinups \eventskip stretching}
\day{Level 8}{new set \dayheader{Notes:}{}}
\day{~}{~}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
May
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{~}{~}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
June
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
July
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Level 8}{easy non-crimp boulders of new set \eventskip chinups \eventskip stretching}
\day{Level 8}{new set \dayheader{Notes:}{}}
\day{~}{~}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
August
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
September
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Level 8}{new set \dayheader{Notes:}{}}
\day{~}{~}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
October
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Level 8}{new set \dayheader{Notes:}{}}
\day{~}{~}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
November
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\BlankDay
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\noindent
\StartingDayNumber=2
\begin{center}
\textsc{\LARGE{ 
December
}}\newline
\textsc{\large {2024}}
\end{center}
\begin{calendar}{\linewidth}
\BlankDay
\setcounter{calendardate}{1}
\newcounter{days}{0}
\day{Level 8}{new set \dayheader{Notes:}{}}
\day{~}{~}
\day{Hangboard}{\dayheader{Notes:}{}}
\day{Strength}{weighted Pullups \eventskip Deadlifts \eventskip Benchpulls \eventskip Flys \eventskip Muscleups}
\day{~}{\vspace{2.5cm}}
\day{Kilterboard}{Notes:}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\day{~}{\vspace{2.5cm}}
\finishCalendar
\end{calendar}
\newpage
\end{document}

日历.sty:

\NeedsTeXFormat{LaTeX2e}

\def\CalendarVersion{3.3}
\def\CalendarVersionDate{2023/02/03}

\ProvidesClass{calendar}[\CalendarVersionDate
           LaTeX2e class file `calendar' v\CalendarVersion]

\typeout{'calendar' style \CalendarVersion \CalendarVersionDate.}
\typeout{Created by Evan Sultanik}
\typeout{****** Bugs/comments/suggestions/technicalities to Evan Sultanik -- [email protected] ******}

\RequirePackage{tabularx}

\def\@CALtrue{1}
\newcount\@currentdaynum
\newcounter{calendardate}
\newcount\StartingDayNumber

\def\dayheader#1#2{
  \vspace{2pt} % Whitespace above the heading
  \begin{minipage}[t]{0.87\hsize}
    \raggedright
    \small % Small font size
    \textit{#1}
  \end{minipage}
  \begin{minipage}[t]{0.1\hsize}
    \raggedleft
    \textit{#2}
  \end{minipage}%
}
\def\activities#1{
  \parbox{\hsize}{\vspace*{5pt}\raggedright\scriptsize #1}\smallskip
}

\let\@colbreak=&

\def\printdayname#1{\hfil\textsc{#1}\hfil}

\newcommand{\dayname}[1]{
  \ifnum#1=1 Sunday\else
  \ifnum#1=2 Monday\else
  \ifnum#1=3 Tuesday\else
  \ifnum#1=4 Wednesday\else
  \ifnum#1=5 Thursday\else
  \ifnum#1=6 Friday\else
  \ifnum#1=7 Saturday\else
    \PackageError{calendar}{Unrecognized day number: #1!}
  \fi\fi\fi\fi\fi\fi\fi
}

\StartingDayNumber=1
\newenvironment{calendar}[1]{
  \newdimen\@calendarwidth
  \@calendarwidth=#1
  \begingroup
    \def\@calendarmode{\@CALtrue}
  \def\day##1##2{
  \if\@calendarmode\@CALtrue\else\PackageWarning{calendar}{The '\day' macro is expected to be used in the 'calendar' environment!}\fi
  \ifnum\@currentdaynum>7\global\@currentdaynum=1\fi
  \global\advance\@currentdaynum by 1
  \vspace{-0.5\baselineskip} % Reduce the whitespace above the first day heading
  \dayheader{##1}{\thecalendardate}\def\daysep{\vskip1pt\hrule\vskip1pt}
  \activities{##2}
  \addtocounter{calendardate}{1}
  \ifnum\@currentdaynum>7\@arraycr\hline\else&\fi
  }
\def\finishCalendar{
  \ifnum\@currentdaynum=7 \\\hline\else
  \ifnum\@currentdaynum=6 &\\\hline\else
  \ifnum\@currentdaynum=5 &&\\\hline\else
  \ifnum\@currentdaynum=4 &&&\\\hline\else
  \ifnum\@currentdaynum=3 &&&&\\\hline\else
  \ifnum\@currentdaynum=2 &&&&&\\\hline\else
  \ifnum\@currentdaynum=1 &&&&&&\\\hline
  \fi\fi\fi\fi\fi\fi\fi
}
\def\eventskip{\\\vspace{4pt}}
  \def\BlankDay{
  \if\@calendarmode\@CALtrue\else\PackageWarning{calendar}{The '\calendarday' macro is expected to be used in the 'calendar' environment!}\fi
  \ifnum\@currentdaynum>7\global\@currentdaynum=1\fi
  \global\advance\@currentdaynum by 1
  \addtocounter{calendardate}{1}
  \ifnum\@currentdaynum>7\@arraycr\hline\else&\fi
  }

    \setcounter{calendardate}{1}
    \newcount\@currday
    \@currday=\StartingDayNumber
    \newcount\@numdays
    \@numdays=7
    \let\@cbreak=&
    \tabularx{\@calendarwidth}{|X|X|X|X|X|X|X|} \hline
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 &
    \ifnum\@currday>\@numdays\@currday=1\fi\printdayname{\dayname{\@currday}} \global\advance\@currday by 1 \\ \hline \hline
      \@currentdaynum=1
      \let\@firstline=\@CALtrue
}{
    \endtabularx
  \endgroup
}

\pagestyle{empty} % Disable default headers and footers

\setlength{\parindent}{0pt} % Stop paragraph indentation

答案1

您有多个

\newcounter{days}{0}

\newcounter只有一个参数,所以这些都应该

\setcounter{days}{0}

然后你需要在文档前言中分配计数器(仅一次!)因此添加

\newcounter{days}

相关内容