summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/advdate
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/advdate
Initial commit
Diffstat (limited to 'macros/latex/contrib/advdate')
-rw-r--r--macros/latex/contrib/advdate/advdate.pdfbin0 -> 150426 bytes
-rw-r--r--macros/latex/contrib/advdate/advdate.sty151
-rw-r--r--macros/latex/contrib/advdate/advdate.tex91
-rw-r--r--macros/latex/contrib/advdate/manifest.txt23
4 files changed, 265 insertions, 0 deletions
diff --git a/macros/latex/contrib/advdate/advdate.pdf b/macros/latex/contrib/advdate/advdate.pdf
new file mode 100644
index 0000000000..14eac06d85
--- /dev/null
+++ b/macros/latex/contrib/advdate/advdate.pdf
Binary files differ
diff --git a/macros/latex/contrib/advdate/advdate.sty b/macros/latex/contrib/advdate/advdate.sty
new file mode 100644
index 0000000000..e7e362181b
--- /dev/null
+++ b/macros/latex/contrib/advdate/advdate.sty
@@ -0,0 +1,151 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Advance Date Package for LaTeX2e %%
+%% (C) Z. Wagner -- Ice Bear Soft, 20 Oct 1996, <wagner@mbox.cesnet.cz> %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Copyright 1996 Zdenek Wagner %%
+%% %%
+%% This work may be distributed and/or modified under the %%
+%% conditions of the LaTeX Project Public License, either version 1.3 %%
+%% 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.3 or later is part of all distributions of LaTeX %%
+%% version 2005/12/01 or later. %%
+%% %%
+%% This work has the LPPL maintenance status `maintained'. %%
+%% %%
+%% The Current Maintainer of this work is Zdenek Wagner. %%
+%% %%
+%% This work consists of all files listed in manifest.txt. %%
+%% %%
+%% This licence information was added 2010/11/22 by %%
+%% Clea F. Rees with the permission of Zdenek Wagner. %%
+%% %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% This package contains macros which can add specified number of days %%
+%% to the current date (as specified in \today) and print it. Some other %%
+%% macros are also provided. It is intended for use e.g. in invoices %%
+%% payable within 14 days from today etc. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Macros with one default argument [in square brackets] %%
+%% \AdvanceDate Default: [1] %%
+%% Advances date the specified number of days and sets the result %%
+%% to \today %%
+%% \DayAfter Default: [1] %%
+%% Advances date by call to \AdvanceDate, prints \today and restores %%
+%% the oroginal value of \today %%
+%% \SaveDate Default: [\s@v@dT@d@y] %%
+%% Saves \today into the specified macro %%
+%% \SetDate Default: [\s@v@dT@d@y] %%
+%% Sets the date stored in \today. The argument must be in form: %%
+%% [dd/mm/yyyy] and may be present in a macro because the argument %%
+%% is always expanded before use. The value saved by \SaveDate can %%
+%% be used here. %%
+%% %%
+%% Macros with one mandatory argument %%
+%% \ThisDay sets \day %%
+%% \ThisMonth sets \month %%
+%% \ThisYear sets \year %%
+%% \AdvMonth advances \month and fixes it %%
+%% \AdvYear advances \year %%
+%% %%
+%% Macros without arguments %%
+%% \FixMonth fixes \today so that 0 < \month < 13 %%
+%% \FixDate fixes \today so that it is valid %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{advdate}[1996/10/20 Advance Date Package]
+
+% KH code
+
+\newcount\r@k \newcount\un@r
+\newcount\m@l \m@l31
+\newcount\m@s \m@s30
+\newcount\M@s
+
+\newcommand\is@LeapYear[1][\year]{\r@k#1\un@r\r@k
+ \divide\r@k4\multiply\r@k4\advance\r@k-\un@r
+ \ifnum\r@k=0%
+ \divide\un@r100\r@k\un@r\multiply\un@r100\advance\un@r-#1%
+ \ifnum\un@r=0%
+ \un@r\r@k \divide\un@r4\multiply\un@r4\advance\un@r-\r@k
+ \un@r\ifnum\un@r=0 29\else 28\fi
+ \else
+ \un@r 29%
+ \fi
+ \else
+ \un@r 28%
+ \fi
+ \r@k 337\advance\r@k\un@r}
+
+\newcommand\m@sic{\ifcase \month \or \m@l \or \un@r \or \m@l \or \m@s \or \m@l \or \m@s
+ \or \m@l \or \m@l \or \m@s \or \m@l \or \m@s \or \m@l \fi}
+
+\newcommand\FixMonth{%
+ \L@@p \ifnum\month<1 \advance\year\m@ne \advance\month12 \is@LeapYear \repeat
+ \L@@p \ifnum\month>12 \advance\year\@ne \advance\month-12 \is@LeapYear \repeat}
+
+\newcommand\FixDate{%
+ \FixMonth \is@LeapYear
+ \l@@p \ifnum\day<1 \Pr@vD@y \repeat
+ \l@@p \M@s\m@sic \ifnum\day>\M@s \N@xtD@y \repeat
+}
+
+% We need a nested \loop and the user might call the macros from his/her \loop
+
+\def\L@@p#1\repeat{\def\It@r@te{#1\relax \expandafter\It@r@te\fi}\It@r@te
+ \let\It@r@te\relax}
+
+\def\l@@p#1\repeat{\def\it@r@te{#1\relax \expandafter\it@r@te\fi}\it@r@te
+ \let\it@r@te\relax}
+
+\def\Pr@vD@y{%
+ \ifnum\day<-366
+ \ifnum\month>2
+ \advance\day\r@k \advance\year\m@ne \is@LeapYear
+ \else
+ \advance\year\m@ne \is@LeapYear \advance\day\r@k
+ \fi
+ \else
+ \advance\month\m@ne \FixMonth
+ \advance\day\m@sic
+ \fi}
+
+\def\N@xtD@y{%
+ \ifnum\day>366
+ \ifnum\month>2
+ \advance\year\@ne \is@LeapYear \advance\day-\r@k
+ \else
+ \advance\day-\r@k \advance\year\@ne \is@LeapYear
+ \fi
+ \else
+ \advance\day-\M@s \advance\month\@ne \FixMonth
+ \fi}
+
+\newcommand\AdvanceDate[1][\@ne]{\advance\day#1 \FixDate}
+
+\newcommand\DayAfter[1][\@ne]{{\AdvanceDate[#1]\today}}
+
+\newcommand\SaveDate[1][\s@v@dT@d@y]{%
+ \expandafter \expandafter \expandafter \expandafter
+ \expandafter \expandafter \expandafter \edef
+ \expandafter \expandafter \expandafter \expandafter
+ \expandafter \expandafter \expandafter #1\expandafter
+ \expandafter \expandafter \expandafter
+ \expandafter \expandafter \expandafter
+ {\expandafter \expandafter \expandafter \number
+ \expandafter \expandafter \expandafter \day
+ \expandafter \expandafter \expandafter /\expandafter \number
+ \expandafter \month \expandafter /\number \year}}
+
+\newcommand\SetDate[1][\s@v@dT@d@y]{\edef\d@t@{#1}%
+ \expandafter\t@d@y\d@t@\t@d@y\FixDate}
+
+\def\t@d@y#1/#2/#3\t@d@y{\day#1 \month#2 \year#3 \relax}
+
+\newcommand\ThisDay[1]{\day#1 \relax}
+\newcommand\ThisMonth[1]{\month#1 \relax}
+\newcommand\ThisYear[1]{\year#1 \relax}
+\newcommand\AdvMonth[1]{\advance\month#1 \FixMonth}
+\newcommand\AdvYear[1]{\advance\year#1 \relax}
diff --git a/macros/latex/contrib/advdate/advdate.tex b/macros/latex/contrib/advdate/advdate.tex
new file mode 100644
index 0000000000..bc4e4479d9
--- /dev/null
+++ b/macros/latex/contrib/advdate/advdate.tex
@@ -0,0 +1,91 @@
+%% Copyright 1996 Zdenek Wagner
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% 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.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Zdenek Wagner.
+%
+% This work consists of all files listed in manifest.txt.
+%
+%% This licence information was added 2010/11/22 by
+%% Clea F. Rees with the permission of Zdenek Wagner.
+%
+\documentclass[DIV=11, fontsize=12pt, pagesize=auto]{scrartcl}
+
+\usepackage{lmodern}
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+
+\addtokomafont{title}{\rmfamily}
+\addtokomafont{labelinglabel}{\ttfamily}
+\setlength{\labelsep}{3mm}
+
+\makeatletter
+\l@addto@macro\@listI{%
+ \setlength{\parsep}{1.5pt plus 0.5pt minus 0.5pt}%
+ \setlength{\itemsep}{1.5pt plus 0.5pt minus 0.5pt}%
+}
+\makeatother
+
+\title{The \textsf{advdate} package}
+\subtitle{Advance Date Package for \LaTeXe}
+\author{\textcopyright\ Z. Wagner -- Ice Bear Soft, \texttt{<wagner@mbox.cesnet.cz>}}
+\date{20 Oct 1996}
+
+
+\begin{document}
+
+\maketitle
+
+\noindent
+This package contains macros which can add specified number of days
+to the current date (as specified in \verb+\today+) and print it. Some other
+macros are also provided. It is intended for use e.\,g. in invoices
+payable within 14 days from today etc.
+
+
+\minisec{Macros with one default argument [in square brackets]}
+
+\begin{labeling}{\string\AdvanceDate}
+\item[\string\AdvanceDate] Default: [1]\\
+ Advances date the specified number of days and sets the result
+ to \verb+\today+
+\item[\string\DayAfter] Default: [1]\\
+ Advances date by call to \verb+\AdvanceDate+, prints \verb+\today+ and restores
+ the oroginal value of \verb+\today+
+\item[\string\SaveDate] Default: [\verb+\s@v@dT@d@y+]\\
+ Saves \verb+\today+ into the specified macro
+\item[\string\SetDate] Default: [\verb+\s@v@dT@d@y+]\\
+ Sets the date stored in \verb+\today+. The argument must be in form:
+ \texttt{[dd/mm/yyyy]} and may be present in a macro because the argument
+ is always expanded before use. The value saved by \verb+\SaveDate+ can
+ be used here.
+\end{labeling}
+
+
+\minisec{Macros with one mandatory argument}
+
+\begin{labeling}{\string\ThisMonth}
+\item[\string\ThisDay] sets \verb+\day+
+\item[\string\ThisMonth] sets \verb+\month+
+\item[\string\ThisYear] sets \verb+\year+
+\item[\string\AdvMonth] advances \verb+\month+ and fixes it
+\item[\string\AdvYear] advances \verb+\year+
+\end{labeling}
+
+
+\minisec{Macros without arguments}
+
+\begin{labeling}{\string\FixMonth}
+\item[\string\FixMonth] fixes \verb+\today+ so that $0 < \verb+\month+ < 13$
+\item[\string\FixDate] fixes \verb+\today+ so that it is valid
+\end{labeling}
+
+\end{document}
diff --git a/macros/latex/contrib/advdate/manifest.txt b/macros/latex/contrib/advdate/manifest.txt
new file mode 100644
index 0000000000..504dabc54c
--- /dev/null
+++ b/macros/latex/contrib/advdate/manifest.txt
@@ -0,0 +1,23 @@
+Copyright 1996 Zdenek Wagner
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+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.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work has the LPPL maintenance status `maintained'.
+
+The Current Maintainer of this work is Zdenek Wagner.
+
+This work consists of all files listed in manifest.txt.
+
+This licence information was added 2010/11/22 by
+Clea F. Rees with the permission of Zdenek Wagner.
+
+advdate.pdf
+advdate.sty
+advdate.tex
+manifest.txt