Interaction between Termcal package and \date{}

I'm preparing course documents for the fall, using the tufte-handout class, and I want to incorporate a calendar using termcal. So I do this:

\documentclass{tufte-handout}
\usepackage{fontspec}
\usepackage{termcal}

\defaultfontfeatures{Mapping=tex-text}

\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}

\renewcommand{\calprintclass}{}

\title{Course overview}
\author{English 220}
\date{Fall 2017}

\begin{document}

\maketitle

\begin{fullwidth}

\setlength{\calwidth}{6in}
\begin{calendar}{9/4/17}{10}

\calday[Monday]{\classday} % Monday
\calday[Tuesday]{\classday} % Wednesday
\calday[Wednesday]{\classday}
\calday[Thursday]{\classday} % Thursday (unnumbered)
\calday[Friday]{\classday} % Friday
\skipday\skipday % weekend (no class)
% Holidays
\options{9/21/17}{\noclassday}
\caltext{9/21/17}{No Class\\Rosh Hashanah}

% Key dates

\caltext{9/5/17}{Introductions}

\caltext{9/18/17}{Bring to class \emph{TOTC} \& \emph{The Passion}}

% Exams
\caltext{9/15/17}{Review test on 9th grade grammar \& vocab}
\caltext{9/29/17}{Quiz on vocab list 7}
\caltext{10/20/17}{Quiz on vocab lists 7--8}

\end{calendar}
\end{fullwidth}
\end{document}


The output is bizarre. I would post an image, but for some reason I can't make that happen at the moment (follow that drama here if you're curious), so I'll have to describe it.

• The first date in the calendar is correct (Sep. 4); the subsequent dates are Oct. -25, Nov. -55, Dec. -84, Jan. -114, and so forth. (Yes, the dates are negative numbers.)
• The cell for Sep. 4 also contains the expression "Fall 2017>30". The second cell (Oct. -25) contains "Fall 2017>31", and so forth.

So it looks like termcal has a problem with the line

\date{Fall 2017}


Miscellaneous observations:

• If I change that line to \date{}, I get a bunch of error messages, and no date line in my title block, but the calendar displays correctly.
• If I delete the date line entirely, the title block contains today's date (which I do not want), but the calendar displays correctly.
• If I change the document class to article, the problem goes away entirely.

Is there a way to use the date command the way I typically do and still have termcal work properly? Or is this package just incompatible with this document class?

• Apparently, \date{Fall 2017} is nothing what termcal understands. But at the moment I can't compile your document at all – user31729 Jul 12 '17 at 21:18
• Right, but why does it need the \date command at all? The starting date of the calendar is one of the arguments to \begin{calendar}; isn't that enough? – crmdgn Jul 12 '17 at 21:21

Blame termcal or tufte-common.def -- both define and use\thedate ;-)

tufte-common.def sets \thedate by using the argument of \date which is a bad idea, because \the... macros should be usually used only for counter output.

termcal defines a new counter named date, which implies the automatic definition of \thedate, however, this is done with \gdef\thedate{...}, overwritting the old definition by tufte-common.def.

Actually, tufte-common.def is doing here something ill-designed.

A solution, rather than changing the apparently proper behaviour of termcal is to grab the original \date command designed by LaTeX before the \documentclass comes into action, say with \let\latexdate\date and saying \latexdate{Fall 2017} instead of \date{Fall 2017}, which screws the system up.

\let\latexdate\date

\documentclass{tufte-handout}
\usepackage{fontspec}
\usepackage{termcal}

\defaultfontfeatures{Mapping=tex-text}

\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}

\renewcommand{\calprintclass}{}

\title{Course overview}
\author{English 220}
\latexdate{Fall 2017}

\begin{document}

\maketitle

\begin{fullwidth}

\setlength{\calwidth}{6in}
\begin{calendar}{9/4/17}{10}

\calday[Monday]{\classday} % Monday
\calday[Tuesday]{\classday} % Wednesday
\calday[Wednesday]{\classday}
\calday[Thursday]{\classday} % Thursday (unnumbered)
\calday[Friday]{\classday} % Friday
\skipday\skipday % weekend (no class)
% Holidays
\options{9/21/17}{\noclassday}
\caltext{9/21/17}{No Class\\Rosh Hashanah}

% Key dates

\caltext{9/5/17}{Introductions}

\caltext{9/18/17}{Bring to class \emph{TOTC} \& \emph{The Passion}}

% Exams
\caltext{9/15/17}{Review test on 9th grade grammar \& vocab}
\caltext{9/29/17}{Quiz on vocab list 7}
\caltext{10/20/17}{Quiz on vocab lists 7--8}

\end{calendar}
\end{fullwidth}
\end{document}


Better version with redefinition of \date depending whether termcal is loaded or not

\documentclass{tufte-handout}
\usepackage{fontspec}
\usepackage{termcal}

\makeatletter
\providecommand\tuftedate{}
\renewcommand{\date}[1]{%
\gdef\@date{#1}%
\begingroup%
% TODO store contents of \thanks command
\renewcommand{\thanks}[1]{}% swallow \thanks contents
\protected@xdef\tuftedate{#1}%
\endgroup%
}{%
% Do nothing else, there's no need to redefine \date
}
}
\makeatother
\defaultfontfeatures{Mapping=tex-text}

\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}

\renewcommand{\calprintclass}{}

\title{Course overview}
\author{English 220}
\date{Fall 2017}

\begin{document}
\maketitle

\begin{fullwidth}

\setlength{\calwidth}{6in}
\begin{calendar}{9/4/17}{10}

\calday[Monday]{\classday} % Monday
\calday[Tuesday]{\classday} % Wednesday
\calday[Wednesday]{\classday}
\calday[Thursday]{\classday} % Thursday (unnumbered)
\calday[Friday]{\classday} % Friday
\skipday\skipday % weekend (no class)
% Holidays
\options{9/21/17}{\noclassday}
\caltext{9/21/17}{No Class\\Rosh Hashanah}

% Key dates

\caltext{9/5/17}{Introductions}

\caltext{9/18/17}{Bring to class \emph{TOTC} \& \emph{The Passion}}

% Exams
\caltext{9/15/17}{Review test on 9th grade grammar \& vocab}
\caltext{9/29/17}{Quiz on vocab list 7}
\caltext{10/20/17}{Quiz on vocab lists 7--8}

• That works. Why does \let\latexdate\date go before the class declaration? – crmdgn Jul 12 '17 at 21:27
• @crmdgn: Because tufte-handout redefines \date, you have to save it before. I am thinking of a better solution however – user31729 Jul 12 '17 at 21:30
• Fascinating. How does the \thanks command come into it? – crmdgn Jul 12 '17 at 22:14
• @crmdgn: The \thanks commands is from the tufte version of \date. I've kept it. – user31729 Jul 13 '17 at 16:40