% \section{Date Syntax} % % \subsection{General Rules} % % The rules themselves are explained here first. If you % want to cut to the chase, have a look at the examples % and experiment a bit with the demo file. It's all % pretty straightforward. % % The parser is indifferent to extra spaces and blank % lines in dates. It will read a string word by word, % and classify each word as a time, a day of the month, % the name of a month, a year or a special function. % With two exceptions, strings beginning in a number must not mix numbers and % other characters --- this will produce a low-level % error from \TeX, and at the moment I can't think of % an economical way of protecting against this. % % Any string % beginning in a number is interpreted as either a % time, a day of the month or a year. A string % containing a colon (the ":" character) is assumed % to be a time of day. "AM" and "PM" are not recognized; % you should use 24-hour format when specifying % times. A numeric string containing a hyphen is assumed % to be a range of times. In this instance, a colon % is not necessary if the time is given in whole-hours. % Pure numeric strings are construed as a day of the month % if less than 32, or as a year if greater than 31. % % Character strings are interpreted on the basis of their % first three characters; the rest are ignored. Case is % also irrelevant. Months and days of the week (used for % defining recursive dates, described below) as well as certain % special functions are specified as character strings. % Any word that does not match an existing function % will be ignored. % % Dates are always terminated by a short description % of the date, which must be in curly braces. % The description should contain plain text only; % do not put macros (like "\LaTeX") here. % % Dates will be processed until "\dateread" encounters % "\end{<"\meta{environment name}">}", or the string % "\relax{}". At the "\end" of an environment, % the processing of the current date will be completed, % and the "\end" will be executed. "\relax{}" will % cause processing to end silently without doing % anything on the last item (which is the "\relax{}" itself). % % \subsection{Specific Dates} % % Applying the above rules, the following is a valid % list of dates. The use of "\dateread" is explained % below. % % \begin{quote} % \begin{verbatim} % \begin{quote} % \dateread{\message{\theshorttext}} % Jan 1 1996{New Year's Day} % 1 January 1996 at 10:00 % {New Year Bash}"\\ % 1996 % jan 1 8-20:30 % {New Year Cleaning. Rats.}" % \end{quote} % \end{verbatim} % \end{quote} % % Note that the parser is indifferent to word order, % and that commas should not be used to separate % words.\footnote{In fact, commas do no harm if % they follow a string of three or more letters, but % it is best to keep things simple and clean.} % % \subsection{Recursive Dates} % % \subsubsection{Ranges} % % Any recursive dates (such as "Every" "Monday") must % be preceded by one or more range specifications, % which fix the time period or periods within which to % recurse. % A range is simply two specific dates separated by the % word "to". You may specify multiple ranges; % effect will be given to each of them individually. % % The following is a valid range specification: % % \begin{quote} % \begin{verbatim} % February 1 1996 {Start First Period} % to April 1 1996 {End First Period} % November 3 1996 {Start Second Period} % to December 24 1996 {End Second Period} % \end{verbatim} % \end{quote} % % \subsubsection{Shorthand Dates} % % Two types of recursive date can be entered in a % human-readable syntax. Entries of both types % begin with the word "every". To put an event % on every occurence of a day of the week within % a specified set of subranges, simply indicate the day % of the week, followed by a short description % in curly braces. % % \begin{quote} % \begin{verbatim} % Every Monday {Monday!} % \end{verbatim} % \end{quote} % % To put an event at 14-day intervals, beginning % with the first occurrence of a specified day % of the week within each subrange, add the % word "other". % % \begin{quote} % \begin{verbatim} % Every other Monday 7:00 {Monday Morning Exercise} % \end{verbatim} % \end{quote} % % To place an event on the "N"th occurrence of % a specified day of the week within each month, within % subrange, add "first", "second" or "third". % % \begin{quote} % \begin{verbatim} % Every third Monday 8:00-9:00 % {Monday Morning Meeting} % \end{verbatim} % \end{quote} % % \subsubsection{Suppressing the Action} % % There are two ways of suppressing the user-defined action. % To quickly comment out an entry, put the word "rem" in % front of it. The date will be read, but the action % in the argument to "\dateread" will not be performed. % This can be used, for example, to suppress the appearance % of a range in the output text. % % The second method uses a toggle, and is meant for use by % style authors. Setting: % % \begin{quote} % "\dates@suppress@globaltrue" % \end{quote} % % \noindent will cause the user action to be suppressed % throughout the invocation of "\dateread". In order for % the action to be performed on the next invocation, % the toggle must be set to "false" in the external % code that calls the parser. % % \subsubsection{Functions} % % It is possible to specify dates within the subranges % using an arbitrary formula. Entries of this type % begin with the word "function". This is followed % by two control strings, a block of \LaTeX{} code in % curly braces, and the usual short description, also in % curly braces. % % The first control string is the name of a % user-defined macro that will find the position % of the first desired date after the start of the % range. The second is the name of a macro to % use in incrementing afterward. The block of % \LaTeX{} code contains the definitions of these % and any subsidiary macros. % % The following will place an entry on every date within % the specified subranges. % % \begin{quote} % \begin{verbatim} % Function \myinit \myincrement % {\def\myinit{% % \dates@date=\dates@subrange@start} % \def\myincrement{% % \advance\dates@date by 1\relax} % } % {A Day} % \end{verbatim} % \end{quote} % % See the code commentary section of the Dates package for information % on macros that can be used for manipulating dates.