diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-27 21:39:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-27 21:39:08 +0000 |
commit | ad0fd9fb6ce74369bba2e59251d112c8996e7e1b (patch) | |
tree | 923020cd2ce9f5cb5d9893a514cf7de7556baacf /Master/texmf-dist/doc/latex/datenumber/datenumber-english.tex | |
parent | 218f5d5f2840d9323dc6a35579922a70645dd471 (diff) |
datenumber (27jan22)
git-svn-id: svn://tug.org/texlive/trunk@61761 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/datenumber/datenumber-english.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/datenumber/datenumber-english.tex | 213 |
1 files changed, 213 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/datenumber/datenumber-english.tex b/Master/texmf-dist/doc/latex/datenumber/datenumber-english.tex new file mode 100644 index 00000000000..5a2396005a5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/datenumber/datenumber-english.tex @@ -0,0 +1,213 @@ +%% +%% 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 +%% +%% 2022/01/27: Corrects small error in datenumberfrench.ldf und in datenumberspanish.ldf (F. P\'etiard) +%% + +\documentclass[draft]{article} +\usepackage{datenumber} +\oddsidemargin 0.25in +\textwidth 5.8750 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\footnote{The initial date was 2001/08/06 (version 0.02). That version corrects a small error in datenumberfrench.ldf and in datenumberspanish.ldf.}} + +\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[{\mdseries\textbackslash}\texttt{setdatenumber}\{\texttt{year}\}\{\texttt{month}\}\{\texttt{day}\}:] Sets the counter \texttt{datenumber} to a value, which corresponds to the date. +\item[{\mdseries\textbackslash}\texttt{setdatebynumber}\{\texttt{number}\}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to values, which corresponds to the number. +\item[{\mdseries\textbackslash}\texttt{nextdate}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to the next date. +\item[{\mdseries\textbackslash}\texttt{prevdate}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to the previous date. +\item[{\mdseries\textbackslash}\texttt{setdate}\{\texttt{year}\}\{\texttt{month}\}\{\texttt{day}\}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to \texttt{year}, \texttt{month}, and \texttt{day}. +\item[{\mdseries\textbackslash}\texttt{setdatetoday}:] Sets the counters \texttt{dateyear}, \texttt{datemonth}, and \texttt{dateday} to the current date. +\item[{\mdseries\textbackslash}\texttt{datemonthname}:] typesets the month (see section \ref{monthname}). +\item[{\mdseries\textbackslash}\texttt{datedayname}:] typesets the weekday (see section \ref{dayname}). +\item[{\mdseries\textbackslash}\texttt{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[{\mdseries\textbackslash}\texttt{setmydatenumber}\{\texttt{numbercount}\}\{\texttt{year}\}\{\texttt{month}\}\{\texttt{day}\}:] Sets the counter \texttt{numbercount} to a value, which corresponds to the date. +\item[{\mdseries\textbackslash}\texttt{setmydatebynumber}\{\texttt{number}\}\{\texttt{yearcount}\}\{\texttt{monthcount}\}\{\texttt{daycount}\}:] Sets the counters\\ \texttt{yearcount}, \texttt{monthcount}, and \texttt{daycount} to values, which corresponds to the number. +\item[{\mdseries\textbackslash}\texttt{mynextdate}\{\texttt{yearcount}\}\{\texttt{monthcount}\}\{\texttt{daycount}\}:] Sets the counters \texttt{yearcount}, \texttt{monthcount}, and \texttt{daycount} to the next date. +\item[{\mdseries\textbackslash}\texttt{mynextdate}\{\texttt{yearcount}\}\{\texttt{monthcount}\}\{\texttt{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'. |