diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/datenumber/doc.tex |
Initial commit
Diffstat (limited to 'macros/latex/contrib/datenumber/doc.tex')
-rw-r--r-- | macros/latex/contrib/datenumber/doc.tex | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/macros/latex/contrib/datenumber/doc.tex b/macros/latex/contrib/datenumber/doc.tex new file mode 100644 index 0000000000..60d5351d66 --- /dev/null +++ b/macros/latex/contrib/datenumber/doc.tex @@ -0,0 +1,211 @@ +%% +%% This is file `docgerman.tex'. +%% +%% This file is part of the `datenumber' package, +%% +%% Copyright (C) 2001 J"org-Michael Schr"oder. +%% +%% IMPORTANT NOTICE: +%% +%% This program may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.2 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% This program consists of all files listed in README.txt. +%% +%% For error reports, or offers to help make this a more powerful +%% tool, please contact me on schrj020@mail.uni-mainz.de +%% + +\documentclass[draft]{article} +\usepackage{datenumber} + +\oddsidemargin 0.25in +\textwidth 5.875 in +\addtolength{\textheight}{8\baselineskip} +\addtolength{\topmargin}{-5\baselineskip} + +\title{The {\tt datenumber.sty} package \fileversion} + +\author{J\"org-Michael Schr\"oder\\{\small\texttt{schrj020@mail.uni-mainz.de}}} + +\date{\filedate} + +\newcounter{dateone}\newcounter{datetwo}% +\newcommand{\daydifftoday}[3]{% + \setmydatenumber{dateone}{\the\year}{\the\month}{\the\day}% + \setmydatenumber{datetwo}{#1}{#2}{#3}% + \addtocounter{datetwo}{-\thedateone}% + \thedatetwo +} + +\newcommand{\sd}{% +\ifcase\thedatedayname \or + Mon\or Tue\or Wed\or Thu\or + Fri\or Sat\or Sun\fi +}% + +\newcommand{\pnext}{% +\thedateyear/% +\ifnum\value{datemonth}<10 0\fi +\thedatemonth/% +\ifnum\value{dateday}<10 0\fi +\thedateday% +\nextdate +} + +\begin{document} +\maketitle +\begin{abstract} + +This package provides commands to convert a date into a number. Turned around a date can be calculated also by a number. Additionally there are commands for incrementing and decrementing a date. Leap years and the Gregorian calendar reform are considered. +\end{abstract} + +\tableofcontents +\section{Start year} +The start of the counting is determined with \verb+\setstartyear{year}+ (standard 1800). The first day of the start year gets the number 1. The value of \texttt{startyear} must be greater 0. It may not be larger than the year of a date to be calculated. If the difference of date and \texttt{startyear} is large, the calculation can last for a long time. The correct setting of the weekdays is guaranteed only if the value of \texttt{startyear} is 1800, 1900 or 2000. +\section{Counters} +There are five counters defined +\begin{description} +\item[\texttt{datenumber}:] number of the day +\item[\texttt{dateyear}:] year +\item[\texttt{datemonth}:] month +\item[\texttt{dateday}:] day +\item[\texttt{datedayname}:] weekday: 1--7 (Monday--Sunday) +\end{description} +\section{Macros} +\subsection{Macros which operate with defined counters\label{macro}} +All counters specified above are updated by these macros. \verb+\datedayname+ and \verb+\datemonthname+ are also updated. +\begin{description} +\item[\texttt{\textbackslash setdatenumber\{year\}\{month\}\{day\}}:] Sets the counter \texttt{datenumber} to a value, which corresponds to the date. +\item[\texttt{\textbackslash setdatebynumber\{number\}}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to values, which corresponds to the number. +\item[\texttt{\textbackslash nextdate}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to the next date. +\item[\texttt{\textbackslash prevdate}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to the previous date. +\item[\texttt{\textbackslash setdate\{year\}\{month\}\{day\}}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to \texttt{year}, \texttt{month}, and \texttt{day}. +\item[\texttt{\textbackslash setdatetoday}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to the current date. +\item[\texttt{\textbackslash datemonthname}:] typesets the month (see section \ref{monthname}). +\item[\texttt{\textbackslash datedayname}:] typesets the weekday (see section \ref{dayname}). +\item[\texttt{\textbackslash datedate}:] typesets the date, corresponding to the counters \texttt{dateyear}, \texttt{datemonth}, \texttt{dateday}. +\end{description} +\subsection{Macros which operate with your own counters} +Only the counters you specified are updated by these macros. \verb+\datedayname+ and \verb+\datemonthname+ are not updated. +\begin{description}\sloppypar +\item[\texttt{\textbackslash setmydatenumber\{numbercount\}\{year\}\{month\}\{day\}}:] Sets the counter \texttt{numbercount} to a value, which corresponds to the date. +\item[\texttt{\textbackslash setmydatebynumber\{number\}\{yearcount\}\{monthcount\}\{daycount\}}:] Sets the counters \texttt{yearcount}, \texttt{monthcount}, and \texttt{daycount} to values, which corresponds to the number. +\item[\texttt{\textbackslash mynextdate\{yearcount\}\{monthcount\}\{daycount\}}:] Sets the counters \texttt{yearcount}, \texttt{monthcount}, and \texttt{daycount} to the next date. +\item[\texttt{\textbackslash mynextdate\{yearcount\}\{monthcount\}\{daycount\}}:]Sets the counters \texttt{yearcount}, \texttt{monthcount}, and \texttt{daycount} to the previous date. +\end{description} + +\subsection{Month\label{monthname}} +The command \verb+\datemonthname+ typesets the month. It is updated by macros described in section \ref{macro}. You can do this by your own saying \verb+\setmonthname{number}+. + +\subsection{Weekday\label{dayname}} +To typeset the weekday say \verb+\datedayname+. This command is updated by macros described in section \ref{macro}. +You can do this by your own saying \verb+\setmonthname{number}+ (1 for Monday and 7 for Sunday). You can also write \verb+\setdaynamebynumber{number}+, were \verb+number+ is the number of a date. If \texttt{startyear} is set to 1800, 1900 or 2000 the calculation of the weekday will work. + +\section{Language}\sloppypar +The language options \texttt{english}, \texttt{USenglish} (standard), \texttt{french}, \texttt{spanish}, \texttt{german}, and \texttt{ngerman} are supported. Say \verb+\dateselectlanguage{language}+ to select a language. For other languages: Create a file \texttt{datenumbermylanguage.ldf}. Copy the text from \texttt{datenumberdummy.ldf}. Replace every ``dummy'' with ``mylanguage'' and change the months and weekdays. Say \verb+\usepackage{datenumber}+ \verb+\input{datenumbermylanguage.ldf}+ in your document. + +\section{Examples} +\begin{quote} +\begin{verbatim} +\setdate{2002}{1}{1}% +\thedatenumber +\end{verbatim} +\setdate{2002}{1}{1}% +Result: \thedatenumber +\end{quote} + +\begin{quote} +\begin{verbatim} +\setdatetoday +\addtocounter{datenumber}{10}% +\setdatebynumber{\thedatenumber}% +In 10 days is \datedate +\end{verbatim} +\setdatetoday +\addtocounter{datenumber}{10}% +\setdatebynumber{\thedatenumber}% +Result: In 10 days is \datedate +\end{quote} + +\begin{quote} +\begin{verbatim} +\newcounter{dateone}\newcounter{datetwo}% + +\newcommand{\daydifftoday}[3]{% + \setmydatenumber{dateone}{\the\year}{\the\month}{\the\day}% + \setmydatenumber{datetwo}{#1}{#2}{#3}% + \addtocounter{datetwo}{-\thedateone}% + \thedatetwo +} + +There is still \daydifftoday{\the\year}{12}{25} days to Christmas. +\end{verbatim} +Result: There is still \daydifftoday{\the\year}{12}{25} days to Christmas. +\end{quote} + +\clearpage +\begin{quote} +\begin{verbatim} +\newcommand{\sd}{% +\ifcase\thedatedayname \or + Mon\or Tue\or Wed\or Thu\or + Fri\or Sat\or Sun\fi +}% + +\newcommand{\pnext}{% +\thedateyear/% +\ifnum\value{datemonth}<10 0\fi +\thedatemonth/% +\ifnum\value{dateday}<10 0\fi +\thedateday% +\nextdate +} + +\setdate{2001}{9}{29}% +\[\begin{tabular}{lll} +\sd & \pnext & Abc\\ +\sd & \pnext & Def\\ +\sd & \pnext & Ghi\\ +\sd & \pnext & Jkl\\ +\end{tabular}\] +\end{verbatim} +Result: \setdate{2001}{9}{29}% +\[\begin{tabular}{lll} +\sd & \pnext & Abc\\ +\sd & \pnext & Def\\ +\sd & \pnext & Ghi\\ +\sd & \pnext & Jkl\\ +\end{tabular}\] +\end{quote} + +\section{Other} +\begin{itemize} +\item leap year test +\begin{quote} +\begin{verbatim} +The \the\year\ is +\ifleapyear{\the\year} a \else no \fi leap year. +\end{verbatim} +Result: The \the\year\ is \ifleapyear{\the\year} a \else no \fi leap year. +\end{quote} +\item date test +\begin{quote} +\begin{verbatim} +The 29.2.1900 is +\ifvaliddate{1900}{2}{29} a \else no \fi valid date. +\end{verbatim} +Result: The 29.2.1900 is \ifvaliddate{1900}{2}{29} a \else no \fi valid date.% +\footnote{There are programs, which have another opinion about that. Search for ''Gregorian calendar'' in order to get more information about leap years and October 5, 1582} +\end{quote} +\end{itemize} + +\end{document} +\endinput +%% +%% End of file `doc.tex'. |