Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \NeedsTeXFormat{LaTeX2e}
- \def\CalendarVersion{3.2}
- \def\CalendarVersionDate{2018/09/19}
- \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
- \normalsize % Reset back to normal font size in case this is used within the \activities as a second day heading
- \textit{#1}
- \end{minipage}
- \begin{minipage}[t]{0.1\hsize}
- \raggedleft
- \textit{#2}
- \end{minipage}%
- \vspace{1pt}% Whitespace below the heading
- }
- \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=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
- }
- \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
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement