| 1 |
% ====================================================================== |
| 2 |
% scrdate-en.tex |
| 3 |
% Copyright (c) Markus Kohm, 2001-2022 |
| 4 |
% |
| 5 |
% This file is part of the LaTeX2e KOMA-Script bundle. |
| 6 |
% |
| 7 |
% This work may be distributed and/or modified under the conditions of |
| 8 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 9 |
% The latest version of this license is in |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 12 |
% version 2005/12/01 or later and of this work. |
| 13 |
% |
| 14 |
% This work has the LPPL maintenance status "author-maintained". |
| 15 |
% |
| 16 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 17 |
% |
| 18 |
% This work consists of all files listed in MANIFEST.md. |
| 19 |
% ====================================================================== |
| 20 |
% |
| 21 |
% Chapter about scrdate of the KOMA-Script guide |
| 22 |
% Maintained by Markus Kohm |
| 23 |
% |
| 24 |
% ============================================================================ |
| 25 |
|
| 26 |
\KOMAProvidesFile{scrdate-en.tex} |
| 27 |
[$Date: 2022-06-05 12:40:11 +0200 (So, 05. Jun 2022) $ |
| 28 |
KOMA-Script guide (chapter: scrdate)] |
| 29 |
\translator{Markus Kohm\and Gernot Hassenpflug\and Karl Hagen} |
| 30 |
|
| 31 |
\chapter{The Day of the Week with \Package{scrdate}} |
| 32 |
\labelbase{scrdate} |
| 33 |
\BeginIndexGroup |
| 34 |
\BeginIndex{Package}{scrdate} |
| 35 |
|
| 36 |
Originally, the \Package{scrdate} package could only give the day of the week |
| 37 |
for the current date. Nowadays, it offers this and more for any date in the |
| 38 |
Gregorian calendar. |
| 39 |
|
| 40 |
\begin{Declaration} |
| 41 |
\Macro{CenturyPart}\Parameter{year}\\% |
| 42 |
\Macro{DecadePart}\Parameter{year}% |
| 43 |
\end{Declaration}% |
| 44 |
The\ChangedAt{v3.05a}{\Package{scrdate}} \Macro{CenturyPart} command returns |
| 45 |
the value of the century digits\,---\,thousands and hundreds\,---\,of a |
| 46 |
\PName{year}. The \Macro{DecadePart} command, on the other hand, gives the |
| 47 |
value of the remaining digits, i.\,e. the tens and the units. The |
| 48 |
\PName{year} can have any number of digits. You can assign the value directly |
| 49 |
to a counter or use it for calculations with |
| 50 |
\Macro{numexpr}\IndexCmd{numexpr}. To output\textnote{Attention!} it as an |
| 51 |
Arabic number, you should prefix it with \Macro{the}\IndexCmd{the}. |
| 52 |
|
| 53 |
\begin{Example} |
| 54 |
You want to calculate and print the century of the current year. |
| 55 |
\begin{lstcode} |
| 56 |
The year \the\year\ is year \the\DecadePart{\year} |
| 57 |
of the \engord{\numexpr\CenturyPart{\year}+1\relax} century. |
| 58 |
\end{lstcode} |
| 59 |
The result would be: |
| 60 |
\begin{ShowOutput} |
| 61 |
The year \the\year\ is year \the\DecadePart{\year} |
| 62 |
of the \engordnumber{\numexpr\CenturyPart{\year}+1\relax} century. |
| 63 |
\end{ShowOutput} |
| 64 |
This example uses the \Package{engord}\IndexPackage{engord} package. |
| 65 |
See \cite{package:engord} for more information. |
| 66 |
\end{Example} |
| 67 |
|
| 68 |
Note\textnote{Attention!} that the counting method used here treats the year |
| 69 |
2000 as year~0\,---\,and therefore the first year\,---\,of the 21st~century. |
| 70 |
If necessary, however, you can make a correction with \Macro{numexpr}, as |
| 71 |
shown for the ordinal number in the example.% |
| 72 |
\EndIndexGroup |
| 73 |
|
| 74 |
|
| 75 |
\begin{Declaration} |
| 76 |
\Macro{DayNumber}\Parameter{year}\Parameter{month}\Parameter{day}\\% |
| 77 |
\Macro{ISODayNumber}\Parameter{ISO-date}% |
| 78 |
\end{Declaration}% |
| 79 |
These\ChangedAt{v3.05a}{\Package{scrdate}} two commands return the value of |
| 80 |
the day-of-the-week\Index{day>of the week} number for any date. They differ |
| 81 |
only in the method of specifying the date. While the \Macro{DayNumber} command |
| 82 |
requires the \PName{year}, \PName{month}, and \PName{day} as separate |
| 83 |
parameters, the \Macro{ISODayNumber} command expects an \PName{ISO-date} as a |
| 84 |
single argument, \PName{ISO-date}, using the ISO notation |
| 85 |
\PName{year}\texttt{-}\PName{month}\texttt{-}\PName{day}. It does not matter |
| 86 |
if the \PName{month} or \PName{day} have one or two digits. You can use the |
| 87 |
result of both commands to assign directly to a counter or for calculations |
| 88 |
using \Macro{numexpr}\IndexCmd{numexpr}. To print\textnote{Attention!} it as |
| 89 |
an Arabic number, you should prefix it with \Macro{the}\IndexCmd{the}. |
| 90 |
|
| 91 |
\begin{Example} |
| 92 |
You want to know the number of the day of the week of the 1st~May~2027. |
| 93 |
\begin{lstcode} |
| 94 |
The 1st~May~2027 has \the\ISODayNumber{2027-5-1} |
| 95 |
as the number of the day of the week. |
| 96 |
\end{lstcode} |
| 97 |
The result will be: |
| 98 |
\begin{ShowOutput} |
| 99 |
The 1st~May~2027 has \the\ISODayNumber{2027-5-1} |
| 100 |
as the number of the day of the week. |
| 101 |
\end{ShowOutput} |
| 102 |
\end{Example} |
| 103 |
|
| 104 |
It is particularly worth noting that you can even step a specified number of |
| 105 |
days into the future or or the past from a given date. |
| 106 |
\begin{Example} |
| 107 |
You want to know the number of the day of the week 12~days from now |
| 108 |
and 24~days before the 24th~December~2027. |
| 109 |
\begin{lstcode} |
| 110 |
In 12~days, the number of the day of the week |
| 111 |
will be \the\DayNumber{\year}{\month}{\day+12}, and |
| 112 |
24~days before the 24th~December~2027 it will be |
| 113 |
\the\ISODayNumber{2027-12-24-24}. |
| 114 |
\end{lstcode} |
| 115 |
The result could be, for example: |
| 116 |
\begin{ShowOutput} |
| 117 |
In 12~days, the number of the day of the week |
| 118 |
will be \the\DayNumber{\year}{\month}{\day+12}, and |
| 119 |
24~days before the 24th~December~2027 it will be |
| 120 |
\the\ISODayNumber{2027-12-24-24}. |
| 121 |
\end{ShowOutput} |
| 122 |
\end{Example} |
| 123 |
|
| 124 |
The days of the week are numbered as follows: Sunday\,=\,0, Monday\,=\,1, |
| 125 |
Tuesday\,=\,2, Wednesday\,=\,3, Thursday\,=\,4, Friday\,=\,5, and |
| 126 |
Saturday\,=\,6.% |
| 127 |
% |
| 128 |
\EndIndexGroup |
| 129 |
|
| 130 |
|
| 131 |
\begin{Declaration} |
| 132 |
\Macro{DayNameByNumber}\Parameter{number of the day of the week}\\% |
| 133 |
\Macro{DayName}\Parameter{year}\Parameter{month}\Parameter{day}\\% |
| 134 |
\Macro{ISODayName}\Parameter{ISO-date}% |
| 135 |
\end{Declaration}% |
| 136 |
Usually\ChangedAt{v3.05a}{\Package{scrdate}} you are less interested in the |
| 137 |
number of the day of the week than in its name. Therefore, the |
| 138 |
\Macro{DayNameByNumber} command returns the name of the day of the week |
| 139 |
corresponding to a day-of-the-week number. This number can be the result, for |
| 140 |
example, of \Macro{DayNumber} or \Macro{ISODayNumber}. The two commands |
| 141 |
\Macro{DayName} and \Macro{ISODayName} directly return the name of the day of |
| 142 |
the week of a given date. |
| 143 |
|
| 144 |
\begin{Example} |
| 145 |
You want to know the name of the day of the week of the 24th~December~2027. |
| 146 |
\begin{lstcode} |
| 147 |
Please pay by \ISODayName{2027-12-24}, |
| 148 |
24th~December~2027 the amount of \dots. |
| 149 |
\end{lstcode} |
| 150 |
The result will be: |
| 151 |
\begin{ShowOutput} |
| 152 |
Please pay by \ISODayName{2027-12-24}, |
| 153 |
24th~December~2027 the amount of \dots. |
| 154 |
\end{ShowOutput} |
| 155 |
\end{Example} |
| 156 |
|
| 157 |
Once again, it is particularly worth noting that you can perform calculations, |
| 158 |
to a certain extent: |
| 159 |
\begin{Example} |
| 160 |
You want to know the names of the day of the week 12~days from now |
| 161 |
and 24~days before the 24th~December~2027. |
| 162 |
\begin{lstcode} |
| 163 |
In 12~days, the name of the day of the week |
| 164 |
will be \DayName{\year}{\month}{\day+12}, and |
| 165 |
24~days before the 24th~December~2027 it will be |
| 166 |
\ISODayName{2027-12-24-24}, while two weeks |
| 167 |
and three days after a Wednesday will be a |
| 168 |
\DayNameByNumber{3+2*7+3}. |
| 169 |
\end{lstcode} |
| 170 |
The result could be, for example: |
| 171 |
\begin{ShowOutput} |
| 172 |
In 12~days, the name of the day of the week |
| 173 |
will be \DayName{\year}{\month}{\day+12}, and |
| 174 |
24~days before the 24th~December~2027 it will be |
| 175 |
\ISODayName{2027-12-24-24}, while two weeks |
| 176 |
and three days after a Wednesday will be a |
| 177 |
\DayNameByNumber{3+2*7+3}. |
| 178 |
\end{ShowOutput} |
| 179 |
\end{Example}% |
| 180 |
% |
| 181 |
\EndIndexGroup |
| 182 |
|
| 183 |
|
| 184 |
\begin{Declaration} |
| 185 |
\Macro{ISOToday}% |
| 186 |
\Macro{IsoToday}% |
| 187 |
\Macro{todaysname}% |
| 188 |
\Macro{todaysnumber}% |
| 189 |
\end{Declaration}% |
| 190 |
In the previous examples, the current date was always specified cumbersomely |
| 191 |
using the \TeX{} registers \Macro{year}\IndexCmd{year}, |
| 192 |
\Macro{month}\IndexCmd{month}, and \Macro{day}\IndexCmd{day}. The |
| 193 |
\Macro{ISOToday}\ChangedAt{v3.05a}{\Package{scrdate}} and \Macro{IsoToday} |
| 194 |
commands directly return the current date in ISO-notation. These commands |
| 195 |
differ only in the fact that \Macro{ISOToday} always outputs a two-digit month |
| 196 |
and day, while \Macro{IsoToday} outputs single-digit numbers for values less |
| 197 |
than 10. The \Macro{todaysname} command directly returns the name of the |
| 198 |
current day of the week, while \Macro{todaysnumber} returns the number of the |
| 199 |
current day of the week. You can find more information about using this value |
| 200 |
in the explanations of \DescRef{scrdate.cmd.DayNumber} and |
| 201 |
\DescRef{scrdate.cmd.ISODayNumber}. |
| 202 |
|
| 203 |
\begin{Example} |
| 204 |
I want to show you on what day of the week this document was typeset: |
| 205 |
\begin{lstlisting} |
| 206 |
This document was created on a \todaysname. |
| 207 |
\end{lstlisting} |
| 208 |
This will result, for example, in: |
| 209 |
\begin{ShowOutput} |
| 210 |
This document was created on a \todaysname. |
| 211 |
\end{ShowOutput} |
| 212 |
\end{Example} |
| 213 |
|
| 214 |
For languages that have a case system for nouns, note that the package cannot |
| 215 |
decline words. The terms are given in the form appropriate for displaying a |
| 216 |
date in a letter, which is the nominative singular for the currently supported |
| 217 |
languages. Given this limitation, the example above will not work correctly if |
| 218 |
translated directly into some other languages. |
| 219 |
|
| 220 |
\begin{Explain} |
| 221 |
The\textnote{Hint!} names of the weekdays in \Package{scrdate} all have |
| 222 |
initial capital letters. If you need the names completely in lower case, for |
| 223 |
example because that is the convention in the relevant language, simply wrap |
| 224 |
the command with the \LaTeX{} \Macro{MakeLowercase}\IndexCmd{MakeLowercase}% |
| 225 |
\important{\Macro{MakeLowercase}} command: |
| 226 |
% Umbruchkorrektur: listings |
| 227 |
\begin{lstcode} |
| 228 |
\MakeLowercase{\todaysname} |
| 229 |
\end{lstcode} |
| 230 |
This converts the whole argument into lower-case letters. Of course, you can |
| 231 |
also do this for |
| 232 |
\DescRef{scrdate.cmd.DayNameByNumber}\IndexCmd{DayNameByNumber}, |
| 233 |
\DescRef{scrdate.cmd.DayName}\IndexCmd{DayName}, and |
| 234 |
\DescRef{scrdate.cmd.ISODayName}\IndexCmd{ISODayName} commands described |
| 235 |
above.% |
| 236 |
\end{Explain}% |
| 237 |
\EndIndexGroup |
| 238 |
|
| 239 |
|
| 240 |
\begin{Declaration} |
| 241 |
\Macro{nameday}\Parameter{name} |
| 242 |
\end{Declaration}% |
| 243 |
Just as you can directly modify the output of \Macro{today} with |
| 244 |
\DescRef{maincls.cmd.date}\IndexCmd{date}, so you can change the output of |
| 245 |
\DescRef{scrdate.cmd.todaysname} to \PName{name} with \Macro{nameday}. |
| 246 |
\begin{Example} |
| 247 |
You change the current date to a fixed value using |
| 248 |
\DescRef{maincls.cmd.date}. You are not interested in the actual name of the |
| 249 |
day, but want only to show that it is a workday. So you write: |
| 250 |
\begin{lstlisting} |
| 251 |
\nameday{workday} |
| 252 |
\end{lstlisting} |
| 253 |
After this, the previous example will result in: |
| 254 |
\begin{ShowOutput}\nameday{workday} |
| 255 |
This document was created on a \todaysname. |
| 256 |
\end{ShowOutput} |
| 257 |
\end{Example} |
| 258 |
There's no corresponding command to change the result of |
| 259 |
\DescRef{scrdate.cmd.ISOToday}\IndexCmd{ISOToday} or |
| 260 |
\DescRef{scrdate.cmd.IsoToday}\IndexCmd{IsoToday}.% |
| 261 |
\EndIndexGroup |
| 262 |
|
| 263 |
|
| 264 |
\begin{Declaration} |
| 265 |
\Macro{newdaylanguage}\Parameter{language}% |
| 266 |
\Parameter{Monday}\Parameter{Tuesday}% |
| 267 |
\Parameter{Wednesday}\Parameter{Thursday}% |
| 268 |
\Parameter{Friday}\Parameter{Saturday} |
| 269 |
\Parameter{Sunday}% |
| 270 |
\end{Declaration} |
| 271 |
Currently the \Package{scrdate} package recognizes the following languages: |
| 272 |
\begin{itemize}\setlength{\itemsep}{.5\itemsep} |
| 273 |
\item Croatian (\PValue{croatian}), |
| 274 |
\item Czech (\PValue{czech}\ChangedAt{v3.13}{\Package{scrdate}}), |
| 275 |
\item Danish (\PValue{danish}), |
| 276 |
\item Dutch (\PValue{dutch}), |
| 277 |
\item English (\PValue{american}\ChangedAt{v3.13}{\Package{scrdate}}, |
| 278 |
\PValue{australian}, \PValue{british}, \PValue{canadian}, \PValue{english}, |
| 279 |
\PValue{UKenglish}, and USenglish), |
| 280 |
\item Finnish (\PValue{finnish}), |
| 281 |
\item French (\PValue{acadian}, \PValue{canadien}, |
| 282 |
\PValue{francais}\ChangedAt{v3.13}{\Package{scrdate}}, and \PValue{french}), |
| 283 |
\item German (\PValue{austrian}\ChangedAt{v3.08b}{\Package{scrdate}}, |
| 284 |
\PValue{german}, \PValue{naustrian}, \PValue{ngerman}, |
| 285 |
\PValue{nswissgerman}, and |
| 286 |
\PValue{swissgerman}\ChangedAt{v3.13}{\Package{scrdate}}), |
| 287 |
\item Italian (\PValue{italian}), |
| 288 |
\item Norwegian (\PValue{norsk}), |
| 289 |
\item Polish (\PValue{polish}\ChangedAt{v3.13}{\Package{scrdate}}), |
| 290 |
\item Slovak (\PValue{slovak}), |
| 291 |
\item Spanish (\PValue{spanish}), |
| 292 |
\item Swedish (\PValue{swedish}). |
| 293 |
\end{itemize} |
| 294 |
You can also configure it for additional languages. To do so, the first |
| 295 |
argument of \Macro{newdaylanguage} is the name of the language, and the other |
| 296 |
arguments are the names of the corresponding days of the week. |
| 297 |
|
| 298 |
In the current implementation, it does not matter whether you load |
| 299 |
\Package{scrdate} before or after \Package{ngerman}\IndexPackage{ngerman}, |
| 300 |
\Package{babel}\IndexPackage{babel}, or similar packages. In each case the |
| 301 |
correct language will be used provided it is supported. |
| 302 |
|
| 303 |
\begin{Explain} |
| 304 |
To be more precise, as long as you select a language in a way that is |
| 305 |
compatible with \Package{babel}\IndexPackage{babel}, \Package{scrdate} will |
| 306 |
use the correct language. If this is not the case, you will get (US) English |
| 307 |
names. |
| 308 |
\end{Explain} |
| 309 |
|
| 310 |
Of course, if you create definitions for a language that was previously |
| 311 |
unsupported, please mail them to the author of \KOMAScript{}. There is a good |
| 312 |
chance that future versions of \KOMAScript{} will add support for that |
| 313 |
language.% |
| 314 |
\EndIndexGroup |
| 315 |
% |
| 316 |
\EndIndexGroup |
| 317 |
|
| 318 |
\endinput |
| 319 |
|
| 320 |
%%% Local Variables: |
| 321 |
%%% mode: latex |
| 322 |
%%% TeX-master: "scrguide-en.tex" |
| 323 |
%%% coding: utf-8 |
| 324 |
%%% ispell-local-dictionary: "en_GB" |
| 325 |
%%% eval: (flyspell-mode 1) |
| 326 |
%%% End: |