The public sources for my resume. These sources are auto compiled and published upon changes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

356 lines
8.0 KiB

  1. %%
  2. %% This is file `datenumber.sty',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% datenumber.dtx (with options: `datenumber')
  8. %%
  9. %% This file is part of the `datenumber' package,
  10. %%
  11. %% Copyright (C) 2001 J"org-Michael Schr"oder.
  12. %%
  13. %% IMPORTANT NOTICE:
  14. %%
  15. %% This program may be distributed and/or modified under the
  16. %% conditions of the LaTeX Project Public License, either version 1.2
  17. %% of this license or (at your option) any later version.
  18. %% The latest version of this license is in
  19. %% http://www.latex-project.org/lppl.txt
  20. %% and version 1.2 or later is part of all distributions of LaTeX
  21. %% version 1999/12/01 or later.
  22. %%
  23. %% This program consists of all files listed in README.txt.
  24. %%
  25. %% For error reports, or offers to help make this a more powerful
  26. %% tool, please contact me on schrj020@mail.uni-mainz.de
  27. %%
  28. \def\fileversion{v0.02}
  29. \def\filedate{2001/08/06}
  30. \NeedsTeXFormat{LaTeX2e}
  31. \ProvidesPackage{datenumber}[\filedate \fileversion]
  32. \DeclareOption{english}{\input datenumberenglish.ldf}
  33. \DeclareOption{USenglish}{\input datenumberUSenglish.ldf}
  34. \DeclareOption{french}{\input datenumberfrench.ldf}
  35. \DeclareOption{italian}{\input datenumberitalian.ldf}
  36. \DeclareOption{spanish}{\input datenumberspanish.ldf}
  37. \DeclareOption{german}{\input datenumbergerman.ldf}
  38. \DeclareOption{ngerman}{\input datenumbergerman.ldf}
  39. \input datenumberUSenglish.ldf
  40. \ProcessOptions
  41. \newcounter{@dayscnt}
  42. \newcounter{@startyear}
  43. \def\setstartyear#1{%
  44. \ifnum#1<1
  45. \errmessage{Package datenumber: startyear < 1}%
  46. \fi
  47. \setcounter{@startyear}{#1}%
  48. \setdatetoday
  49. }
  50. \def\thestartyear{\the@startyear}
  51. \def\setmydatenumber#1#2#3#4{%
  52. \ifvaliddate{#2}{#3}{#4}%
  53. \else
  54. \errmessage{\@errmessage}%
  55. \fi
  56. \ifnum\the@startyear<1
  57. \errmessage{Package datenumber: startyear < 1}%
  58. \fi
  59. \ifnum#2<\the@startyear
  60. \errmessage{Package datenumber: datenumber < startyear (#2 < \the@startyear)}%
  61. \fi
  62. \setcounter{@dayscnt}{0}%
  63. \ifnum#2>\the@startyear
  64. \relax\@yearloop{#2}%
  65. \fi
  66. \addtocounter{@dayscnt}{%
  67. \ifcase #3%
  68. \or 0\or 31\or 59
  69. \or 90\or 120\or 151
  70. \or 181\or 212\or 243
  71. \or 273\or 304\or 334
  72. \fi
  73. }%
  74. \ifleapyear{#2}%
  75. \ifnum#3>2
  76. \addtocounter{@dayscnt}{1}%
  77. \fi
  78. \fi
  79. \ifnum#2=1582
  80. \ifnum#3>10
  81. \addtocounter{@dayscnt}{-10}%
  82. \fi
  83. \ifnum#3=10
  84. \ifnum#4>14
  85. \addtocounter{@dayscnt}{-10}%
  86. \fi
  87. \fi
  88. \fi
  89. \addtocounter{@dayscnt}{#4}%
  90. \setcounter{#1}{\the@dayscnt}%
  91. }
  92. \def\setmydatebynumber#1#2#3#4{%
  93. \ifnum\the@startyear<1
  94. \errmessage{Package datenumber: startyear < 1}%
  95. \fi
  96. \ifnum#1<1
  97. \errmessage{Package datenumber: datenumber < 1}%
  98. \fi
  99. \setcounter{#2}{\the@startyear}%
  100. \setcounter{@dayscnt}{1}%
  101. \loop
  102. \ifleapyear{\thedateyear}%
  103. \@tempcnta=366
  104. \else
  105. \@tempcnta=365
  106. \fi
  107. \ifnum\thedateyear=1582
  108. \@tempcnta=355
  109. \fi
  110. \addtocounter{@dayscnt}{\the\@tempcnta}%
  111. \ifnum\the@dayscnt<#1\addtocounter{dateyear}{1}%
  112. \repeat
  113. \addtocounter{@dayscnt}{-\the\@tempcnta}%
  114. %
  115. \setcounter{#3}{1}%
  116. \setcounter{#4}{1}%
  117. \setmydatenumber{@dayscnt}{\value{#2}}{\value{#3}}{\value{#4}}%
  118. \ifnum#1>\the@dayscnt\relax
  119. \loop
  120. \mynextdate{#2}{#3}{#4}%
  121. \addtocounter{@dayscnt}{1}%
  122. \ifnum\the@dayscnt<#1\relax
  123. \repeat
  124. \setmydatenumber{@dayscnt}{\value{#2}}{\value{#3}}{\value{#4}}%
  125. \fi
  126. }
  127. \def\mynextdate#1#2#3{%
  128. \ifvaliddate{\value{#1}}{\value{#2}}{\value{#3}}%
  129. \else
  130. \errmessage{\@errmessage}%
  131. \fi
  132. \addtocounter{#3}{1}%
  133. \ifleapyear{\value{#1}}%
  134. \@tempcnta=29
  135. \else
  136. \@tempcnta=28
  137. \fi
  138. \ifnum\value{#3}>%
  139. \ifcase\value{#2}\or31\or\@tempcnta\or31\or30\or31\or30%
  140. \or31\or31\or30\or31\or30\else31%
  141. \fi\relax
  142. \setcounter{#3}{1}%
  143. \addtocounter{#2}{1}%
  144. \ifnum\value{#2}>12
  145. \setcounter{#2}{1}%
  146. \addtocounter{#1}{1}%
  147. \fi
  148. \fi
  149. \ifnum\value{#1}=1582
  150. \ifnum\value{#2}=10
  151. \ifnum\value{#3}=5
  152. \setcounter{#3}{15}%
  153. \fi
  154. \fi
  155. \fi
  156. }
  157. \def\myprevdate#1#2#3{%
  158. \ifvaliddate{\value{#1}}{\value{#2}}{\value{#3}}%
  159. \else
  160. \errmessage{\@errmessage}%
  161. \fi
  162. \addtocounter{#3}{-1}%
  163. \ifleapyear{\value{#1}}%
  164. \@tempcnta=29
  165. \else
  166. \@tempcnta=28
  167. \fi
  168. \ifnum\value{#3}=0
  169. \addtocounter{#2}{-1}%
  170. \ifnum\value{#2}=0
  171. \addtocounter{#1}{-1}%
  172. \setcounter{#2}{12}%
  173. \fi
  174. \setcounter{#3}{%
  175. \ifcase\value{#2}\or 31\or\the\@tempcnta\or 31\or 30\or 31\or 30
  176. \or 31\or 31\or 30\or 31\or 30\else 31
  177. \fi
  178. }%
  179. \fi
  180. \ifnum\value{#1}=1582
  181. \ifnum\value{#2}=10
  182. \ifnum\value{#3}=14
  183. \setcounter{#3}{4}%
  184. \fi
  185. \fi
  186. \fi
  187. }
  188. \newcounter{datenumber}
  189. \newcounter{dateyear}
  190. \newcounter{datemonth}
  191. \newcounter{dateday}
  192. \newcounter{datedayname}
  193. \def\setdatenumber#1#2#3{%
  194. \setmydatenumber{datenumber}{#1}{#2}{#3}%
  195. \setcounter{dateyear}{#1}%
  196. \setcounter{datemonth}{#2}%
  197. \setcounter{dateday}{#3}%
  198. \setdaynamebynumber{\thedatenumber}%
  199. \setmonthname{\thedatemonth}%
  200. }
  201. \def\setdatebynumber#1{%
  202. \setmydatebynumber{#1}{dateyear}{datemonth}{dateday}%
  203. \setcounter{datenumber}{#1}%
  204. \setdaynamebynumber{\thedatenumber}%
  205. \setmonthname{\thedatemonth}%
  206. }
  207. \def\nextdate{%
  208. \mynextdate{dateyear}{datemonth}{dateday}%
  209. \setdate{\thedateyear}{\thedatemonth}{\thedateday}%
  210. }
  211. \def\prevdate{%
  212. \myprevdate{dateyear}{datemonth}{dateday}%
  213. \setdate{\thedateyear}{\thedatemonth}{\thedateday}%
  214. }
  215. \def\setdate#1#2#3{%#1 year, #2 month, #3 day
  216. \setdatenumber{#1}{#2}{#3}%
  217. }
  218. \def\setdatetoday{%
  219. \setdatenumber{\the\year}{\the\month}{\the\day}%
  220. }
  221. \def\setmonthname#1{%
  222. \def\datemonthname{\@monthname{#1}}%
  223. }
  224. \def\setdayname#1{%
  225. \def\datedayname{\@dayname{#1}}%
  226. }
  227. \def\setdaynamebynumber#1{%
  228. \@tempcnta=#1\relax
  229. \ifnum\the@startyear=1800\advance \@tempcnta by 1\fi
  230. \ifnum\the@startyear=1900\advance \@tempcnta by 6\fi
  231. \ifnum\the@startyear=2000\advance \@tempcnta by 4\fi
  232. \@modulo{\the\@tempcnta}{7}%
  233. \setcounter{datedayname}{\the\@den}%
  234. \addtocounter{datedayname}{1}%
  235. \setdayname{\thedatedayname}%
  236. }
  237. \def\datedate{\@datedate}%
  238. \def\dateselectlanguage#1{%
  239. \csname @datelanguage#1\endcsname
  240. \setdayname{\thedatedayname}%
  241. \setmonthname{\thedatemonth}%
  242. }
  243. \def\ifleapyear#1{%#1 year
  244. \ifnum#1>1500
  245. \@modulo{#1}{100}%
  246. \ifnum\@den=0
  247. \@modulo{#1}{400}%
  248. \else
  249. \@modulo{#1}{4}%
  250. \fi
  251. \else
  252. \@modulo{#1}{4}%
  253. \fi
  254. \ifnum\@den=0
  255. }
  256. \def\ifvaliddate#1#2#3{%
  257. \ifleapyear{#1}%
  258. \@tempcnta=29
  259. \else
  260. \@tempcnta=28
  261. \fi
  262. \gdef\@errmessage{}%
  263. \ifnum#1<1
  264. \gdef\@errmessage{Package datenumber: %
  265. invalid date: year < 1, #1/#2/#3}%
  266. \fi%
  267. \ifnum#2<1
  268. \gdef\@errmessage{Package datenumber: %
  269. invalid date: month < 1, #1/#2/#3}%
  270. \fi%
  271. \ifnum#2>12
  272. \gdef\@errmessage{Package datenumber: %
  273. invalid date: month > 12, #1/#2/#3}%
  274. \fi%
  275. \ifnum#3<1
  276. \gdef\@errmessage{Package datenumber: %
  277. invalid date: day < 1, #1/#2/#3}%
  278. \fi%
  279. \@tempcntb=
  280. \ifcase#2 31\or 31\or\the\@tempcnta\or 31\or 30\or 31\or 30
  281. \or 31\or 31\or 30\or 31\or 30\else 31
  282. \fi\relax
  283. \ifnum#3>\@tempcntb
  284. \gdef\@errmessage{Package datenumber: %
  285. invalid date: day > \the\@tempcntb, #1/#2/#3}%
  286. \fi%
  287. \ifnum#1=1582
  288. \ifnum#2=10
  289. \ifnum#3>4
  290. \ifnum#3<15
  291. \gdef\@errmessage{Package datenumber: %
  292. invalid date: #1/#2/#3}%
  293. \fi
  294. \fi
  295. \fi
  296. \fi
  297. \ifx\@errmessage\empty
  298. }
  299. \def\@yearloop#1{%
  300. \@tempcnta=\the@startyear%
  301. \loop
  302. \ifleapyear{\@tempcnta}%
  303. \addtocounter{@dayscnt}{366}%
  304. \else
  305. \addtocounter{@dayscnt}{365}%
  306. \fi
  307. \ifnum\@tempcnta=1582
  308. \addtocounter{@dayscnt}{-10}%
  309. \fi
  310. \advance \@tempcnta by 1
  311. \ifnum\@tempcnta=#1\else
  312. \repeat
  313. }
  314. \newcount\@nom\newcount\@den
  315. \def\@modulo#1#2{%
  316. \@nom=#1\relax
  317. \@den=#2\relax
  318. \divide\@nom by \@den%
  319. \multiply\@nom by \@den%
  320. \@den=#1%
  321. \advance\@den by -\@nom%
  322. }
  323. \setstartyear{1800}
  324. \endinput
  325. %%
  326. %% End of file `datenumber.sty'.