| 1 |
% \iffalse |
| 2 |
% ====================================================================== |
| 3 |
% scrtime.dtx |
| 4 |
% Copyright (c) Markus Kohm, 1995-2025 |
| 5 |
% |
| 6 |
% This file is part of the LaTeX2e KOMA-Script bundle. |
| 7 |
% |
| 8 |
% This work may be distributed and/or modified under the conditions of |
| 9 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 10 |
% The latest version of this license is in |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 13 |
% version 2005/12/01 or later and of this work. |
| 14 |
% |
| 15 |
% This work has the LPPL maintenance status "author-maintained". |
| 16 |
% |
| 17 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 18 |
% |
| 19 |
% This work consists of all files listed in MANIFEST.md. |
| 20 |
% ====================================================================== |
| 21 |
%%% From File: $Id: scrtime.dtx 4145 2025-05-13 16:54:14Z kohm $ |
| 22 |
%<package&identify>\NeedsTeXFormat{LaTeX2e}[2022/06/01] |
| 23 |
%<*driver> |
| 24 |
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi |
| 25 |
\begingroup |
| 26 |
\def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}} |
| 27 |
\filedate$Date: 2025-05-13 18:54:14 +0200 (Di, 13. Mai 2025) $ |
| 28 |
\def\filerevision$#1: #2 ${\gdef\filerevision{r#2}} |
| 29 |
\filerevision$Revision: 4145 $ |
| 30 |
\endgroup |
| 31 |
\ProvidesFile{scrtime.dtx}[\filedate\space\filerevision\space |
| 32 |
%</driver> |
| 33 |
%<*driver|package> |
| 34 |
%<identify&scrtime>\ProvidesPackage{scrtime}[% |
| 35 |
%<identify&scrdate>\ProvidesPackage{scrdate}[% |
| 36 |
%<*driver|identify> |
| 37 |
%!KOMAScriptVersion |
| 38 |
package |
| 39 |
%</driver|identify> |
| 40 |
%<identify&scrtime> (time of LaTeX run)% |
| 41 |
%<identify&scrdate> (day of the week)% |
| 42 |
%<*driver|identify> |
| 43 |
] |
| 44 |
%</driver|identify> |
| 45 |
%</driver|package> |
| 46 |
%<*dtx> |
| 47 |
\ifx\documentclass\undefined |
| 48 |
\input scrdocstrip.tex |
| 49 |
\@@input scrkernel-version.dtx |
| 50 |
\@@input scrstrip.inc |
| 51 |
\KOMAdefVariable{COPYRIGHFROM}{1995} |
| 52 |
\generate{\usepreamble\defaultpreamble |
| 53 |
\file{scrtime.sty}{% |
| 54 |
\from{scrkernel-version.dtx}{package,scrtime}% |
| 55 |
\from{scrtime.dtx}{package,scrtime,identify}% |
| 56 |
\from{scrkernel-basics.dtx}{load}% |
| 57 |
\from{scrtime.dtx}{package,scrtime,option}% |
| 58 |
\from{scrtime.dtx}{package,scrtime,body}% |
| 59 |
\from{scrlogo.dtx}{logo}% |
| 60 |
} % |
| 61 |
\file{scrdate.sty}{% |
| 62 |
\from{scrkernel-version.dtx}{package,scrdate}% |
| 63 |
\from{scrtime.dtx}{package,scrdate,identify}% |
| 64 |
\from{scrkernel-basics.dtx}{load}% |
| 65 |
\from{scrtime.dtx}{package,scrdate,option}% |
| 66 |
\from{scrtime.dtx}{package,scrdate,body}% |
| 67 |
\from{scrlogo.dtx}{logo}% |
| 68 |
} % |
| 69 |
} |
| 70 |
\@@input scrstrop.inc |
| 71 |
\else |
| 72 |
\let\endbatchfile\relax |
| 73 |
\fi |
| 74 |
\endbatchfile |
| 75 |
%</dtx> |
| 76 |
%<*driver> |
| 77 |
\documentclass[USenglish]{koma-script-source-doc} |
| 78 |
\usepackage{babel} |
| 79 |
\setcounter{StandardModuleDepth}{2} |
| 80 |
\begin{document} |
| 81 |
\DocInput{scrtime.dtx} |
| 82 |
\end{document} |
| 83 |
%</driver> |
| 84 |
% \fi |
| 85 |
% |
| 86 |
% \changes{v3.36}{2022/02/07}{switch over from \cls*{scrdoc} to |
| 87 |
% \cls*{koma-script-source-doc}} |
| 88 |
% \changes{v3.36}{2022/02/07}{require package \pkg*{scrlogo} instead of |
| 89 |
% defining \cs{KOMAScript}} |
| 90 |
% \changes{v3.40}{2023/04/17}{guide names changed} |
| 91 |
% |
| 92 |
% \GetFileInfo{scrtime.dtx} |
| 93 |
% \title{The Current Time and Name of the Day with |
| 94 |
% \href{https://komascript.de}{\KOMAScript} Packages \pkg*{scrtime} and |
| 95 |
% \pkg*{scrdate}} |
| 96 |
% \author{\href{mailto:[email protected]}{Markus Kohm}} |
| 97 |
% \date{Revision \fileversion{} of \filedate} |
| 98 |
% \maketitle |
| 99 |
% \begin{abstract} |
| 100 |
% This bundle includes a package \pkg*{scrtime} defining some macros to |
| 101 |
% handle compilation-time. It's a very simple implementation similar to |
| 102 |
% \pkg{time}. I've tried to not use additional registers. |
| 103 |
% |
| 104 |
% The second package \pkg*{scrdate} defines some macros to handle the name |
| 105 |
% of the day! |
| 106 |
% \end{abstract} |
| 107 |
% \tableofcontents |
| 108 |
% |
| 109 |
% \section{User Manual} |
| 110 |
% |
| 111 |
% You can find the user manuals of \pkg*{scrtime} and \pkg*{scrdate} in the |
| 112 |
% \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the |
| 113 |
% English \file{scrguide-en.pdf}. |
| 114 |
% |
| 115 |
% \MaybeStop{\PrintIndex} |
| 116 |
% |
| 117 |
% \section{Implementation} |
| 118 |
% |
| 119 |
% \subsection{Options} |
| 120 |
% |
| 121 |
% Since version~1.2 both packages use \pkg*{scrkbase} for options and |
| 122 |
% additional features. This is loaded by the \file{ins}-file, so we don't need |
| 123 |
% to load it here. |
| 124 |
% |
| 125 |
% \begin{macrocode} |
| 126 |
%<*option> |
| 127 |
% \end{macrocode} |
| 128 |
% |
| 129 |
% |
| 130 |
% \subsubsection{Options of \pkg*{scrtime}} |
| 131 |
% |
| 132 |
% \begin{macrocode} |
| 133 |
%<*scrtime> |
| 134 |
% \end{macrocode} |
| 135 |
% |
| 136 |
% \begin{option}{12h} |
| 137 |
% \changes{v1.1b}{1995/02/15}{option \opt{12h} added} |
| 138 |
% \changes{v1.2}{2010/03/10}{option uses \pkg*{scrkbase}} |
| 139 |
% \begin{option}{24h} |
| 140 |
% \changes{v1.1b}{1995/02/15}{option \opt{24h} added} |
| 141 |
% \changes{v1.2}{2010/03/10}{option is deprecated} |
| 142 |
% \changes{v3.39}{2022/11/16}{declare deprecated option only with \KOMAScript~3} |
| 143 |
% \begin{macro}{\if@Hxii,\@Hxiitrue,\@Hxiifalse} |
| 144 |
% \changes{v1.1b}{1995/02/15}{new switch} |
| 145 |
% There are two the two Options |24h| and |12h|. We need a switch to |
| 146 |
% distinguish. |
| 147 |
% \begin{macrocode} |
| 148 |
\newif\if@Hxii |
| 149 |
% \end{macrocode} |
| 150 |
% \end{macro} |
| 151 |
% So the options are simple. |
| 152 |
% \begin{macrocode} |
| 153 |
\KOMA@ifkey{12h}{@Hxii} |
| 154 |
\@ifundefined{KOMA@DeclareDeprecatedOption}{}{% |
| 155 |
\KOMA@DeclareDeprecatedOption[scrtime]{24h}{12h=false}% |
| 156 |
} |
| 157 |
% \end{macrocode} |
| 158 |
% \end{option} |
| 159 |
% \end{option} |
| 160 |
% |
| 161 |
% Currently only \pkg*{scrtime} uses options, so only \pkg*{scrtime} needs |
| 162 |
% to process them. |
| 163 |
% \begin{macrocode} |
| 164 |
\KOMAProcessOptions\relax |
| 165 |
% \end{macrocode} |
| 166 |
% |
| 167 |
% \begin{macrocode} |
| 168 |
%</scrtime> |
| 169 |
% \end{macrocode} |
| 170 |
% |
| 171 |
% \begin{macrocode} |
| 172 |
%</option> |
| 173 |
% \end{macrocode} |
| 174 |
% |
| 175 |
% |
| 176 |
% \subsection{Commands and Macros} |
| 177 |
% |
| 178 |
% \begin{macrocode} |
| 179 |
%<*body> |
| 180 |
% \end{macrocode} |
| 181 |
% |
| 182 |
% \subsubsection{Commands and Macros of \pkg*{scrtime}} |
| 183 |
% |
| 184 |
% \begin{macrocode} |
| 185 |
%<*scrtime> |
| 186 |
% \end{macrocode} |
| 187 |
% |
| 188 |
% \begin{command}{\thistime} |
| 189 |
% \changes{v1.1b}{1995/02/15}{\cs{thistime*} added} |
| 190 |
% \changes{v1.1b}{1995/02/15}{\cs{thistime} fixed} |
| 191 |
% \changes{v3.20}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}} |
| 192 |
% First we have to decide, is it a star-version ore not. |
| 193 |
% \begin{macrocode} |
| 194 |
\def\thistime{% |
| 195 |
\kernel@ifstar |
| 196 |
{\let\@tempif\iffalse\@thistime} |
| 197 |
{\let\@tempif\iftrue\@thistime}} |
| 198 |
% \end{macrocode} |
| 199 |
% \begin{macro}{\@thistime} |
| 200 |
% \changes{v1.1b}{1995/02/15}{added} |
| 201 |
% Know we have to calculate the hours and minutes. \cs{@tempcnta} are the |
| 202 |
% hours and \cs{@tempcntb} are the minutes. We use a group to encapsulate the |
| 203 |
% usage of the two local counters of from the \LaTeX{} kernel. |
| 204 |
% \begin{macrocode} |
| 205 |
\newcommand*{\@thistime}[1][:]{% |
| 206 |
\begingroup |
| 207 |
\@tempcnta\time\divide\@tempcnta60\multiply\@tempcnta60 |
| 208 |
\@tempcntb\time\advance\@tempcntb-\@tempcnta |
| 209 |
\divide\@tempcnta60 |
| 210 |
% \end{macrocode} |
| 211 |
% If we use 12h-mode, we have to cut the houres. |
| 212 |
% \changes{v1.1d}{1996/01/14}{space added at \cs{@thistime} between -12 |
| 213 |
% and \cs{fi} (Martin Schroeder)} |
| 214 |
% \begin{macrocode} |
| 215 |
\if@Hxii\ifnum\@tempcnta>12 \advance\@tempcnta-12 \fi\fi |
| 216 |
% \end{macrocode} |
| 217 |
% Know we have to compose the value. If the minutes are less than 10 |
| 218 |
% maybe there has to be an additional 0. |
| 219 |
% \begin{macrocode} |
| 220 |
\the\@tempcnta{#1}\@tempif\ifnum\@tempcntb<10 0\fi\fi\the\@tempcntb% |
| 221 |
\endgroup} |
| 222 |
% \end{macrocode} |
| 223 |
% \end{macro} |
| 224 |
% \end{command} |
| 225 |
% |
| 226 |
% \begin{command}{\settime} |
| 227 |
% \changes{v1.1b}{1995/02/15}{redefines \cs{@thistime}} |
| 228 |
% \changes{v1.1c}{1995/05/24}{missing macrocode-environment inserted} |
| 229 |
% We simply have to set \cs{@thistime}. |
| 230 |
% \begin{macrocode} |
| 231 |
\newcommand*{\settime}[1]{\renewcommand*{\@thistime}[1][]{#1}} |
| 232 |
% \end{macrocode} |
| 233 |
% \end{command} |
| 234 |
% |
| 235 |
% |
| 236 |
% \begin{macrocode} |
| 237 |
%</scrtime> |
| 238 |
% \end{macrocode} |
| 239 |
% |
| 240 |
% |
| 241 |
% \subsubsection{Commands and Macros of \pkg*{scrdate}} |
| 242 |
% |
| 243 |
% \begin{macrocode} |
| 244 |
%<*scrdate> |
| 245 |
% \end{macrocode} |
| 246 |
% |
| 247 |
% \changes{v1.1a}{1995/02/12}{changed all but the user-interface} |
| 248 |
% \changes{v3.05a}{2010/03/10}{changed everything} |
| 249 |
% With version~3.05a \pkg*{scrdate} was rewritten. First step was to make |
| 250 |
% more macros full expandable to provide \cs{MakeUppercase} and |
| 251 |
% \cs{MakeLowercase}. Second was to extend the user interface by some new |
| 252 |
% functionality. |
| 253 |
% |
| 254 |
% \begin{command}{\CenturyPart} |
| 255 |
% \changes{v3.05a}{2010/03/10}{added} |
| 256 |
% This is the century part of a year number and so only a shortcut to |
| 257 |
% |\XdivY{...}{100}|, that is defined at \pkg*{scrbase}. |
| 258 |
% \begin{macrocode} |
| 259 |
\newcommand*{\CenturyPart}[1]{\XdivY{#1}{100}} |
| 260 |
% \end{macrocode} |
| 261 |
% \end{command} |
| 262 |
% |
| 263 |
% \begin{command}{\DecadePart} |
| 264 |
% \changes{v3.05a}{2010/03/10}{added} |
| 265 |
% This is the year number withoud the century part and therefrso only a |
| 266 |
% shortcut to |\XmodY{...}{100}|, that is defined at \pkg*{scrbase}. |
| 267 |
% \begin{macrocode} |
| 268 |
\newcommand*{\DecadePart}[1]{\XmodY{#1}{100}} |
| 269 |
% \end{macrocode} |
| 270 |
% \end{command} |
| 271 |
% |
| 272 |
% \begin{macro}{\@GaussYear} |
| 273 |
% \changes{v3.05a}{2010/03/10}{added} |
| 274 |
% At the Gauss calculation of the day of the week January and February relates |
| 275 |
% to the year before. This macro does the correction for any date. |
| 276 |
% \begin{macrocode} |
| 277 |
\newcommand*{\@GaussYear}[3]{% |
| 278 |
\ifcase #2 |
| 279 |
\PackageError{scrdate}{month out of range}{% |
| 280 |
You've asked for the Gauss year of ISO date #1-#2-#3,\MessageBreak |
| 281 |
this means, that month hat invalid value '#2'.}% |
| 282 |
\or |
| 283 |
\numexpr #1 - 1\relax |
| 284 |
\or |
| 285 |
\numexpr #1 - 1\relax |
| 286 |
\else |
| 287 |
#1 |
| 288 |
\fi |
| 289 |
} |
| 290 |
% \end{macrocode} |
| 291 |
% \end{macro} |
| 292 |
% |
| 293 |
% \begin{command}{\DayNumber} |
| 294 |
% \changes{v3.05a}{2010/03/10}{added} |
| 295 |
% Returns the numerical value of the day of week. Note, that Sunday is 0, |
| 296 |
% Monday is 1, \dots, Saturday is 6. We use the Gauss calculation of the day |
| 297 |
% of the week. First argument is the year, second the month and last the day |
| 298 |
% of the month. |
| 299 |
% \begin{macrocode} |
| 300 |
\newcommand*{\DayNumber}[3]{% |
| 301 |
\XmodY{% |
| 302 |
\numexpr #3 |
| 303 |
+ \ifcase #2 |
| 304 |
\PackageError{scrdate}{month out of range}{% |
| 305 |
You've asked for the dayname of ISO date #1-#2-#3,\MessageBreak |
| 306 |
this means, that month hat invalid value '#2'.}% |
| 307 |
\or 28 \or 31 \or 2 \or 5 \or 7 \or 10 \or 12 \or 15 \or 18 |
| 308 |
\or 20 \or 23 \or 25 |
| 309 |
\else |
| 310 |
\PackageError{scrdate}{month out of range}{% |
| 311 |
You've asked for the dayname of ISO date #1-#2-#3,\MessageBreak |
| 312 |
this means, that month hat invalid value '#2'.}% |
| 313 |
\fi |
| 314 |
+ \DecadePart{\@GaussYear{#1}{#2}{#3}} |
| 315 |
+ \XdivY{\DecadePart{\@GaussYear{#1}{#2}{#3}}}{4} |
| 316 |
+ \XdivY{\CenturyPart{\@GaussYear{#1}{#2}{#3}}}{4} |
| 317 |
- 2 * \CenturyPart{\@GaussYear{#1}{#2}{#3}} \relax |
| 318 |
}{7}% |
| 319 |
} |
| 320 |
% \end{macrocode} |
| 321 |
% \end{command} |
| 322 |
% \begin{command}{\ISODayNumber} |
| 323 |
% \changes{v3.05a}{2010/03/10}{added} |
| 324 |
% The same like \cs{DayNumber} but with ISO date argument. |
| 325 |
% \begin{macrocode} |
| 326 |
\newcommand*{\ISODayNumber}[1]{\expandafter\@IsoDayNumber#1\@nil} |
| 327 |
% \end{macrocode} |
| 328 |
% \begin{macro}{\@IsoDayNumber} |
| 329 |
% \changes{v3.05a}{2010/03/10}{added} |
| 330 |
% \begin{macrocode} |
| 331 |
\newcommand*{\@IsoDayNumber}{} |
| 332 |
\def\@IsoDayNumber#1-#2-#3\@nil{\DayNumber{#1}{#2}{#3}} |
| 333 |
% \end{macrocode} |
| 334 |
% \end{macro} |
| 335 |
% \end{command} |
| 336 |
% |
| 337 |
% \begin{command}{\DayName} |
| 338 |
% \changes{v3.05a}{2010/03/10}{added} |
| 339 |
% Returns the name of the day of the week. Arguments like \cs{DayNumber}. |
| 340 |
% \begin{macrocode} |
| 341 |
\newcommand*{\DayName}[3]{\@dayname{\DayNumber{#1}{#2}{#3}}} |
| 342 |
% \end{macrocode} |
| 343 |
% \end{command} |
| 344 |
% \begin{command}{\ISODayName} |
| 345 |
% \changes{v3.05a}{2010/03/10}{added} |
| 346 |
% The same like \cs{DayName} but with ISO date argument. |
| 347 |
% \begin{macrocode} |
| 348 |
\newcommand*{\ISODayName}[1]{\@dayname{\ISODayNumber{#1}}} |
| 349 |
% \end{macrocode} |
| 350 |
% \end{command} |
| 351 |
% |
| 352 |
% \begin{command}{\DayNameByNumber} |
| 353 |
% \changes{v3.05a}{2010/03/10}{added} |
| 354 |
% Returns the name of the day of the week. The argument is a number that will |
| 355 |
% be transposed to the range 0\dots6. |
| 356 |
% \begin{macrocode} |
| 357 |
\newcommand*{\DayNameByNumber}[1]{% |
| 358 |
\@dayname{\XmodY{#1}{7}}% |
| 359 |
} |
| 360 |
% \end{macrocode} |
| 361 |
% \end{command} |
| 362 |
% |
| 363 |
% \begin{command}{\ISOToday} |
| 364 |
% \changes{v3.05a}{2010/03/10}{added} |
| 365 |
% Returns the ISO date. |
| 366 |
% \begin{macrocode} |
| 367 |
\newcommand*{\ISOToday}{% |
| 368 |
\the\year-\ifnum \month<10 0\fi\the\month-\ifnum \day<10 0\fi\the\day% |
| 369 |
} |
| 370 |
% \end{macrocode} |
| 371 |
% \end{command} |
| 372 |
% |
| 373 |
% \begin{command}{\IsoToday} |
| 374 |
% \changes{v3.05a}{2010/03/10}{added} |
| 375 |
% Returns the ISO date. |
| 376 |
% \begin{macrocode} |
| 377 |
\newcommand*{\IsoToday}{% |
| 378 |
\the\year-\the\month-\the\day% |
| 379 |
} |
| 380 |
% \end{macrocode} |
| 381 |
% \end{command} |
| 382 |
% |
| 383 |
% \begin{command}{\todaysname} |
| 384 |
% \changes{v3.05a}{2010/03/10}{re-implemented} |
| 385 |
% Using \cs{DayName} this is very, very simple. |
| 386 |
% \begin{macrocode} |
| 387 |
\newcommand*{\todaysname}{\DayName{\year}{\month}{\day}} |
| 388 |
% \end{macrocode} |
| 389 |
% \end{command} |
| 390 |
% |
| 391 |
% \begin{command}{\todaysnumber} |
| 392 |
% \changes{v3.05a}{2010/03/11}{added} |
| 393 |
% Using \cs{DayNumber} this is very, very simple. |
| 394 |
% \begin{macrocode} |
| 395 |
\newcommand*{\todaysnumber}{\DayNumber{\year}{\month}{\day}} |
| 396 |
% \end{macrocode} |
| 397 |
% \end{command} |
| 398 |
% |
| 399 |
% \begin{command}{\nameday} |
| 400 |
% \changes{v3.05a}{2010/03/10}{no longer \cs{long}} |
| 401 |
% We simply have to redefine \cs{todaysname}. |
| 402 |
% \begin{macrocode} |
| 403 |
\newcommand\nameday[1]{\renewcommand*{\todaysname}{#1}} |
| 404 |
% \end{macrocode} |
| 405 |
% \end{command} |
| 406 |
% |
| 407 |
% \begin{command}{\newdaylanguage} |
| 408 |
% \changes{v3.05a}{2010/03/10}{Sunday is 0} |
| 409 |
% We write a macro to define the name of the days. |
| 410 |
% \begin{macro}{\scrdate@languagenamewarning} |
| 411 |
% But before this, we have to define a once only warning. |
| 412 |
% \begin{macrocode} |
| 413 |
\newcommand*\scrdate@languagenamewarning{% |
| 414 |
\PackageWarningNoLine{scrdate} |
| 415 |
{\string\languagename\space not |
| 416 |
defined, using \string\language.\MessageBreak |
| 417 |
This may result in use of wrong language!\MessageBreak |
| 418 |
You should use a compatible language |
| 419 |
package\MessageBreak |
| 420 |
(e.g. `babel', `german', `french', ...)}% |
| 421 |
\let\scrdate@languagenamewarning\relax |
| 422 |
} |
| 423 |
% \end{macrocode} |
| 424 |
% \end{macro} |
| 425 |
% \begin{macrocode} |
| 426 |
\newcommand\newdaylanguage[8]{% |
| 427 |
% \end{macrocode} |
| 428 |
% First we check, if the language is defined at the format, the user uses. |
| 429 |
% If it is not defined, we do not define the name of the days and warn. |
| 430 |
% \begin{macrocode} |
| 431 |
\scr@ifundefinedorrelax{l@#1}{% |
| 432 |
\PackageInfoNoLine{scrdate}{Language #1\space not defined.\MessageBreak |
| 433 |
\protect\dayname@#1\space skipped}% |
| 434 |
% \end{macrocode} |
| 435 |
% \changes{v1.1c}{1995/05/24}{missing \cs{end\{macrocode\}} added} |
| 436 |
% If it is defined, we define the name-selection-macro |
| 437 |
% \cs{dayname@\meta{language}}. |
| 438 |
% First we define the new macro \cs{dayname@\meta{language}}: |
| 439 |
% \changes{v3.05a}{2010/03/10}{group removed} |
| 440 |
% \changes{v3.15}{2014/12/11}{more robust \cs{ifcase}} |
| 441 |
% \begin{macrocode} |
| 442 |
}{% |
| 443 |
\@namedef{dayname@#1}##1{% |
| 444 |
\ifcase\numexpr \XmodY{##1}{7}\relax |
| 445 |
#8\or #2\or #3\or #4\or #5\or #6\or #7\fi% |
| 446 |
}% |
| 447 |
% \end{macrocode} |
| 448 |
% Then we define, what to do at \cs{begin\{document\}}: |
| 449 |
% \begin{macrocode} |
| 450 |
\AtBeginDocument{% |
| 451 |
% \end{macrocode} |
| 452 |
% There we first have to test, if \cs{date\meta{language}} is defined |
| 453 |
% (e.g. using package \pkg{german}). If not, we have to warn once more. |
| 454 |
% \begin{macrocode} |
| 455 |
\scr@ifundefinedorrelax{date#1}{% |
| 456 |
\PackageInfoNoLine{scrdate} |
| 457 |
{\protect\date#1\space not defined.\MessageBreak |
| 458 |
\protect\todaysname\space probably cannot use |
| 459 |
\protect\dayname@#1}% |
| 460 |
% \end{macrocode} |
| 461 |
% But if it is defined, we can use it |
| 462 |
% \begin{macrocode} |
| 463 |
}{% |
| 464 |
% \end{macrocode} |
| 465 |
% There we first save \cs{date\meta{language}} as \cs{D@date\meta{language}}. |
| 466 |
% \begin{macrocode} |
| 467 |
\expandafter\let\csname D@date#1\expandafter\endcsname |
| 468 |
\csname date#1\endcsname |
| 469 |
% \end{macrocode} |
| 470 |
% Now we redefine \cs{date\meta{language}}. It first defines \cs{@dayname} and |
| 471 |
% then calls saved macro. |
| 472 |
% \begin{macrocode} |
| 473 |
\@namedef{date#1}{% |
| 474 |
\expandafter\let\expandafter\@dayname\csname dayname@#1\endcsname |
| 475 |
\@nameuse{D@date#1}}% |
| 476 |
% \end{macrocode} |
| 477 |
% Last we have to select this new \cs{date\meta{language}}. |
| 478 |
% \changes{v1.1j}{2000/01/20}{use of \cs{languagename} if defined} |
| 479 |
% \changes{v3.08b}{2011/03/31}{one \% added} |
| 480 |
% \begin{macrocode} |
| 481 |
\@ifundefined{languagename}{% |
| 482 |
\scrdate@languagenamewarning |
| 483 |
\ifnum\language=\@nameuse{l@#1} |
| 484 |
\@nameuse{date#1}% |
| 485 |
\fi |
| 486 |
}{% |
| 487 |
\@ifundefined{date\languagename}% |
| 488 |
{}% |
| 489 |
{\@nameuse{date\languagename}}% |
| 490 |
}% |
| 491 |
}% |
| 492 |
}% |
| 493 |
}% |
| 494 |
} |
| 495 |
% \end{macrocode} |
| 496 |
% \end{command} |
| 497 |
% |
| 498 |
% \begin{macro}{\@dayname} |
| 499 |
% This should be named selecting the language. Since I changed the definitions |
| 500 |
% package \pkg{german} and equal may be loaded before or after \pkg*{scrdate} |
| 501 |
% or not. |
| 502 |
% |
| 503 |
% First we define the usual languages using \cs{newdaylanguage}: |
| 504 |
% \begin{macro}{\dayname@german} |
| 505 |
% \begin{macrocode} |
| 506 |
\newdaylanguage{german}{Montag}{Dienstag}{Mittwoch} |
| 507 |
{Donnerstag}{Freitag}{Samstag}{Sonntag} |
| 508 |
% \end{macrocode} |
| 509 |
% \end{macro} |
| 510 |
% \begin{macro}{\dayname@ngerman} |
| 511 |
% \changes{v1.1i}{1999/10/09}{new language ``ngerman''} |
| 512 |
% \begin{macrocode} |
| 513 |
\newdaylanguage{ngerman}{Montag}{Dienstag}{Mittwoch} |
| 514 |
{Donnerstag}{Freitag}{Samstag}{Sonntag} |
| 515 |
% \end{macrocode} |
| 516 |
% \end{macro} |
| 517 |
% \begin{macro}{\dayname@naustrian} |
| 518 |
% \changes{v3.08b}{2011/02/22}{new language ``naustrian''} |
| 519 |
% \begin{macrocode} |
| 520 |
\newdaylanguage{naustrian}{Montag}{Dienstag}{Mittwoch} |
| 521 |
{Donnerstag}{Freitag}{Samstag}{Sonntag} |
| 522 |
% \end{macrocode} |
| 523 |
% \end{macro} |
| 524 |
% \begin{macro}{\dayname@austrian} |
| 525 |
% \changes{v3.08b}{2011/02/22}{new language ``austrian''} |
| 526 |
% \begin{macrocode} |
| 527 |
\newdaylanguage{austrian}{Montag}{Dienstag}{Mittwoch} |
| 528 |
{Donnerstag}{Freitag}{Samstag}{Sonntag} |
| 529 |
% \end{macrocode} |
| 530 |
% \end{macro} |
| 531 |
% \begin{macro}{\dayname@swissgerman} |
| 532 |
% \changes{v3.13}{2014/01/23}{new language ``swissgerman''} |
| 533 |
% \begin{macrocode} |
| 534 |
\newdaylanguage{swissgerman}{Montag}{Dienstag}{Mittwoch} |
| 535 |
{Donnerstag}{Freitag}{Samstag}{Sonntag} |
| 536 |
% \end{macrocode} |
| 537 |
% \end{macro} |
| 538 |
% \begin{macro}{\dayname@nswissgerman} |
| 539 |
% \changes{v3.13}{2014/01/23}{new language ``nswissgerman''} |
| 540 |
% \begin{macrocode} |
| 541 |
\newdaylanguage{nswissgerman}{Montag}{Dienstag}{Mittwoch} |
| 542 |
{Donnerstag}{Freitag}{Samstag}{Sonntag} |
| 543 |
% \end{macrocode} |
| 544 |
% \end{macro} |
| 545 |
% |
| 546 |
% \begin{macro}{\dayname@american} |
| 547 |
% \changes{v3.13}{2014/01/23}{new language ``american''} |
| 548 |
% \begin{macrocode} |
| 549 |
\newdaylanguage{american}{Monday}{Tuesday}{Wednesday} |
| 550 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 551 |
% \end{macrocode} |
| 552 |
% \end{macro} |
| 553 |
% \begin{macro}{\dayname@australian} |
| 554 |
% \changes{v3.13}{2014/01/23}{new language ``australian''} |
| 555 |
% \begin{macrocode} |
| 556 |
\newdaylanguage{australian}{Monday}{Tuesday}{Wednesday} |
| 557 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 558 |
% \end{macrocode} |
| 559 |
% \end{macro} |
| 560 |
% \begin{macro}{\dayname@british} |
| 561 |
% \changes{v3.13}{2014/01/23}{new language ``british''} |
| 562 |
% \begin{macrocode} |
| 563 |
\newdaylanguage{british}{Monday}{Tuesday}{Wednesday} |
| 564 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 565 |
% \end{macrocode} |
| 566 |
% \end{macro} |
| 567 |
% \begin{macro}{\dayname@canadian} |
| 568 |
% \changes{v3.13}{2014/01/23}{new language ``canadian''} |
| 569 |
% \begin{macrocode} |
| 570 |
\newdaylanguage{canadian}{Monday}{Tuesday}{Wednesday} |
| 571 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 572 |
% \end{macrocode} |
| 573 |
% \end{macro} |
| 574 |
% \begin{macro}{\dayname@english} |
| 575 |
% \changes{v1.1g}{1997/06/21}{correct name is ``tuesday''} |
| 576 |
% \begin{macrocode} |
| 577 |
\newdaylanguage{english}{Monday}{Tuesday}{Wednesday} |
| 578 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 579 |
% \end{macrocode} |
| 580 |
% \end{macro} |
| 581 |
% \begin{macro}{\dayname@newzealand} |
| 582 |
% \changes{v3.13}{2014/01/23}{new language ``newzealand''} |
| 583 |
% \begin{macrocode} |
| 584 |
\newdaylanguage{newzealand}{Monday}{Tuesday}{Wednesday} |
| 585 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 586 |
% \end{macrocode} |
| 587 |
% \end{macro} |
| 588 |
% \begin{macro}{\dayname@UKenglish} |
| 589 |
% \changes{v3.13}{2014/01/23}{new language ``UKenglish''} |
| 590 |
% \begin{macrocode} |
| 591 |
\newdaylanguage{UKenglish}{Monday}{Tuesday}{Wednesday} |
| 592 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 593 |
% \end{macrocode} |
| 594 |
% \end{macro} |
| 595 |
% \begin{macro}{\dayname@ukenglish} |
| 596 |
% \changes{v3.24}{2017/05/29}{new language ``ukenglish''} |
| 597 |
% \begin{macrocode} |
| 598 |
\newdaylanguage{ukenglish}{Monday}{Tuesday}{Wednesday} |
| 599 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 600 |
% \end{macrocode} |
| 601 |
% \end{macro} |
| 602 |
% \begin{macro}{\dayname@USenglish} |
| 603 |
% \changes{v1.1g}{1997/06/21}{correct name is ``tuesday''} |
| 604 |
% \begin{macrocode} |
| 605 |
\newdaylanguage{USenglish}{Monday}{Tuesday}{Wednesday} |
| 606 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 607 |
% \end{macrocode} |
| 608 |
% \end{macro} |
| 609 |
% \begin{macro}{\dayname@usenglish} |
| 610 |
% \changes{v3.24}{2017/05/29}{new language ``usenglish''} |
| 611 |
% \begin{macrocode} |
| 612 |
\newdaylanguage{usenglish}{Monday}{Tuesday}{Wednesday} |
| 613 |
{Thursday}{Friday}{Saturday}{Sunday} |
| 614 |
% \end{macrocode} |
| 615 |
% \end{macro} |
| 616 |
% |
| 617 |
% \begin{macro}{\dayname@acadian} |
| 618 |
% \changes{v3.13}{2014/01/23}{new language ``acadian''} |
| 619 |
% \begin{macrocode} |
| 620 |
\newdaylanguage{acadian}{Lundi}{Mardi}{Mercredi} |
| 621 |
{Jeudi}{Vendredi}{Samedi}{Dimanche} |
| 622 |
% \end{macrocode} |
| 623 |
% \end{macro} |
| 624 |
% \begin{macro}{\dayname@canadien} |
| 625 |
% \changes{v3.13}{2014/01/23}{new language ``canadien''} |
| 626 |
% \begin{macrocode} |
| 627 |
\newdaylanguage{canadien}{Lundi}{Mardi}{Mercredi} |
| 628 |
{Jeudi}{Vendredi}{Samedi}{Dimanche} |
| 629 |
% \end{macrocode} |
| 630 |
% \end{macro} |
| 631 |
% \begin{macro}{\dayname@francais} |
| 632 |
% \changes{v3.13}{2014/01/23}{new language ``francais''} |
| 633 |
% \begin{macrocode} |
| 634 |
\newdaylanguage{francais}{Lundi}{Mardi}{Mercredi} |
| 635 |
{Jeudi}{Vendredi}{Samedi}{Dimanche} |
| 636 |
% \end{macrocode} |
| 637 |
% \end{macro} |
| 638 |
% \begin{macro}{\dayname@french} |
| 639 |
% \begin{macrocode} |
| 640 |
\newdaylanguage{french}{Lundi}{Mardi}{Mercredi} |
| 641 |
{Jeudi}{Vendredi}{Samedi}{Dimanche} |
| 642 |
% \end{macrocode} |
| 643 |
% \end{macro} |
| 644 |
% \begin{macro}{\dayname@italian} |
| 645 |
% \changes{v1.1f}{1997/06/06}{New (thanks to Lorenzo M.\ Catucci)} |
| 646 |
% \begin{macrocode} |
| 647 |
\newdaylanguage{italian}{Luned\`\i}{Marted\`\i}{Mercoled\`\i} |
| 648 |
{Gioved\`\i}{Venerd\`\i}{Sabato}{Domenica} |
| 649 |
% \end{macrocode} |
| 650 |
% \end{macro} |
| 651 |
% \begin{macro}{\dayname@spanish} |
| 652 |
% \changes{v1.1h}{1997/07/26}{New (thanks to Ralph J.\ Hangleiter)} |
| 653 |
% \begin{macrocode} |
| 654 |
\newdaylanguage{spanish}{Lunes}{Martes}{Mi\'ercoles} |
| 655 |
{Jueves}{Viernes}{S\'abado}{Domingo} |
| 656 |
% \end{macrocode} |
| 657 |
% \end{macro} |
| 658 |
% \begin{macro}{\dayname@croatian} |
| 659 |
% \changes{v1.1l}{2001/10/05}{New (thanks to Branka Lon\v{c}arevi\'{c})} |
| 660 |
% \begin{macrocode} |
| 661 |
\newdaylanguage{croatian}{Ponedjeljak}{Utorak}{Srijeda} |
| 662 |
{\v{C}etvrtak}{Petak}{Subota}{Nedjelja} |
| 663 |
% \end{macrocode} |
| 664 |
% \end{macro} |
| 665 |
% \begin{macro}{\dayname@dutch} |
| 666 |
% \changes{v1.1m}{2002/02/02}{New (thanks to Henk Jongbloets)} |
| 667 |
% \changes{v1.1p}{2009/01/01}{fixed to upper case} |
| 668 |
% \begin{macrocode} |
| 669 |
\newdaylanguage{dutch}{Maandag}{Dinsdag}{Woensdag} |
| 670 |
{Donderdag}{Vrijdag}{Zaterdag}{Zondag} |
| 671 |
% \end{macrocode} |
| 672 |
% \end{macro} |
| 673 |
% |
| 674 |
% \begin{macro}{\dayname@finnish} |
| 675 |
% \changes{v1.1n}{2005/02/07}{New (thanks to Hannu V\"ais\"anen)} |
| 676 |
% \begin{macrocode} |
| 677 |
\newdaylanguage{finnish}{Maanantai}{Tiistai}{Keskiviikko} |
| 678 |
{Torstai}{Perjantai}{Lauantai}{Sunnuntai} |
| 679 |
% \end{macrocode} |
| 680 |
% \end{macro} |
| 681 |
% |
| 682 |
% \begin{macro}{\dayname@norsk} |
| 683 |
% \changes{v1.1p}{2009/01/01}{New (thank to Sveinung Heggen)} |
| 684 |
% \begin{macrocode} |
| 685 |
\newdaylanguage{norsk}{Mandag}{Tirsdag}{Onsdag} |
| 686 |
{Torsdag}{Fredag}{L\o{}rdag}{S\o{}ndag} |
| 687 |
% \end{macrocode} |
| 688 |
% \end{macro} |
| 689 |
% |
| 690 |
% \begin{macro}{\dayname@danish} |
| 691 |
% \changes{v3.08}{2011/01/18}{New (thanks to Benjamin Hell)} |
| 692 |
% \begin{macrocode} |
| 693 |
\newdaylanguage{danish}{Mandag}{Tirsdag}{Onsdag} |
| 694 |
{Torsdag}{Fredag}{L\o{}rdag}{S\o{}ndag} |
| 695 |
% \end{macrocode} |
| 696 |
% \end{macro} |
| 697 |
% |
| 698 |
% \begin{macro}{\dayname@swedish} |
| 699 |
% \changes{v3.08}{2011/01/18}{New (thanks to Benjamin Hell)} |
| 700 |
% \begin{macrocode} |
| 701 |
\newdaylanguage{swedish}{M\aa{}ndag}{Tisdag}{Onsdag} |
| 702 |
{Torsdag}{Fredag}{L\"ordag}{S\"ondag} |
| 703 |
% \end{macrocode} |
| 704 |
% \end{macro} |
| 705 |
% |
| 706 |
% \begin{macro}{\dayname@polish} |
| 707 |
% \changes{v3.13}{2014/01/07}{New (thanks to Blandyna Bogdol)} |
| 708 |
% \changes{v3.13}{2014/01/23}{Fixed (thanks to Elke Schubert)} |
| 709 |
% \begin{macrocode} |
| 710 |
\newdaylanguage{polish}{Poniedzia\l{}ek}{Wtorek}{\'Sroda} |
| 711 |
{Czwartek}{Pi\aob{}tek}{Sobota}{Niedziela} |
| 712 |
% \end{macrocode} |
| 713 |
% \end{macro} |
| 714 |
% |
| 715 |
% \begin{macro}{\dayname@czech} |
| 716 |
% \changes{v3.13}{2014/01/23}{New (thanks to Elke Schubert)} |
| 717 |
% \begin{macrocode} |
| 718 |
\newdaylanguage{czech}{Pond\v{e}l\'\i}{\'Uter\'y}{St\v{r}eda} |
| 719 |
{\v{C}tvrtek}{P\'atek}{Sobota}{Ned\v{e}le} |
| 720 |
% \end{macrocode} |
| 721 |
% \end{macro} |
| 722 |
% |
| 723 |
% \begin{macro}{\dayname@slovak} |
| 724 |
% \changes{v3.13}{2014/02/26}{New (thanks to Elke Schubert)} |
| 725 |
% \begin{macrocode} |
| 726 |
\newdaylanguage{slovak}{Pondelok}{Utorok}{Streda} |
| 727 |
{\v{S}tvrtok}{Piatok}{Sobota}{Nede\v{l}a} |
| 728 |
% \end{macrocode} |
| 729 |
% \end{macro} |
| 730 |
% |
| 731 |
% If there are no language-definitions, we simply want the US-english names |
| 732 |
% of the days. |
| 733 |
% \changes{v1.1g}{1997/06/21}{correct name is ``tuesday''} |
| 734 |
% \changes{v3.15}{2014/12/11}{default language definition fixed} |
| 735 |
% \begin{macrocode} |
| 736 |
\let\@dayname\dayname@english |
| 737 |
% \end{macrocode} |
| 738 |
% \end{macro} |
| 739 |
% |
| 740 |
% Last but not least file \file{scrdate.cfg} has to be included, |
| 741 |
% if it exists. |
| 742 |
% \changes{v3.42}{2024/02/01}{\cs{typeout} replaced by either |
| 743 |
% \cs{PackageNote} or \cs{PackageInfo}} |
| 744 |
% \begin{macrocode} |
| 745 |
\InputIfFileExists{scrdate.cfg} |
| 746 |
{% |
| 747 |
\@ifundefined{PackageNote}{\PackageInfo}{\PackageNote}% |
| 748 |
{scrdate}{Local configuration file scrdate.cfg loaded}% |
| 749 |
}{} |
| 750 |
% \end{macrocode} |
| 751 |
% |
| 752 |
% \begin{macrocode} |
| 753 |
%</scrdate> |
| 754 |
% \end{macrocode} |
| 755 |
% |
| 756 |
% \begin{macrocode} |
| 757 |
%</body> |
| 758 |
% \end{macrocode} |
| 759 |
% |
| 760 |
% \Finale |
| 761 |
% \PrintChanges |
| 762 |
% |
| 763 |
% \endinput |
| 764 |
% Local Variables: |
| 765 |
% mode: doctex |
| 766 |
% ispell-local-dictionary: "en_US" |
| 767 |
% eval: (flyspell-mode 1) |
| 768 |
% TeX-master: t |
| 769 |
% TeX-engine: luatex-dev |
| 770 |
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx")) |
| 771 |
% End: |