diff options
author | Karl Berry <karl@freefriends.org> | 2012-05-16 23:12:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-05-16 23:12:50 +0000 |
commit | 33a91552392adacad1480db2e7ea4e966c0f4533 (patch) | |
tree | 6e4a4f772fcce778b4726d75f2ae00a217ca41d1 /Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex | |
parent | 20572a9d0911336a8588b561872220d6aba8e208 (diff) |
koma-script (15may12)
git-svn-id: svn://tug.org/texlive/trunk@26455 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex')
-rw-r--r-- | Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex | 308 |
1 files changed, 257 insertions, 51 deletions
diff --git a/Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex b/Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex index 5f7bd41991e..39be1185e0f 100644 --- a/Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex +++ b/Master/texmf-dist/source/latex/koma-script/doc/english/scrdatetime.tex @@ -40,16 +40,16 @@ % % ---------------------------------------------------------------------- % -% Kapitel über scrpage2 in der KOMA-Script-Anleitung +% Kapitel ueber scrpage2 in der KOMA-Script-Anleitung % Verwaltet von Markus Kohm % % ============================================================================ -\ProvidesFile{scrdatetime.tex}[{2011/02/22 KOMA-Script guide (chapter: +\ProvidesFile{scrdatetime.tex}[{2012/02/23 KOMA-Script guide (chapter: scrdate, scrtime)}] -\translator{Gernot Hassenpflug\and Markus Kohm} +\translator{Markus Kohm\and Gernot Hassenpflug} -% Date of translated german file: 2005-11-27 +% Date of translated German file: 2012/02/23 \chapter{Weekday and Time Using \Package{scrdate} and \Package{scrtime}} @@ -62,34 +62,207 @@ what is provided by the standard commands \Macro{today} and bundle these two packages may be used not only with {\KOMAScript} classes but also with the standard and many other classes. -\section{The Name of the Current Day of the Week Using +Since +\KOMAScript~3.05a\ChangedAt{v3.05a}{\Package{scrdate}\and\Package{scrtime}} +this packages use the common version number of \KOMAScript. This change has +been done, because the packages need the corresponding version of +\Package{scrkbase} and \Package{scrbase}. + + +\section{The Day of the Week Using \Package{scrdate}} -\label{sec:sec:datetime.scrdate} +\label{sec:datetime.scrdate} \BeginIndex{Package}{scrdate} -The first problem is the question of the current day of the week. The -answer may be given using the package \Package{scrdate}. +With version~3.05a the functionality of this package enhanced a lot. Beside of +the current day of the week\Index{day>of the week} this package provides the +day of the week of every date of the Gregorian calendar now. + +\begin{Declaration} + \Macro{CenturyPart}\Parameter{year}\\% + \Macro{DecadePart}\Parameter{year}% +\end{Declaration}% +\BeginIndex{Cmd}{CenturyPart}% +\BeginIndex{Cmd}{DecadePart}% +The\ChangedAt{v3.05a}{\Package{scrdate}} command \Macro{CenturyPart} offers +the value of the century digits\,---\,hundreds and thousands\,---\,of a +\PName{year}. The command \Macro{DecadePart} in difference offers the other +digits which are the units and tens. The number of digits of \PName{year} +doesn't care. The value may be assigned to a counter or may be used for +calculations, i.\,e., using \Macro{numexpr}\IndexCmd{numexpr}. For output of +an Arabic number of the value prefix it with \Macro{the}\IndexCmd{the}. + +\begin{Example} + You want to calculate and output the century of the current year. +\begin{lstcode} + The year \the\year\ is the year \the\DecadePart{\year} + of the \engord{\numexpr\CenturyPart{\year}+1\relax} century. +\end{lstcode} + The result would be: + \begin{quote} + The year \the\year\ is the year \the\DecadePart{\year} + of the \engordnumber{\numexpr\CenturyPart{\year}+1\relax} century. + \end{quote} + Package \Package{engord}\IndexPackage{engord} has been used for this + example. See \cite{package:engord} for more information. +\end{Example} + +Please\textnote{Attention!} note, that within used method of counting the +year~2000 is the year~0\,---\,and therefore the first year\,---\,of the +21st~century.% +\EndIndex{Cmd}{DecadePart}% +\EndIndex{Cmd}{CenturyPart}% + +\begin{Declaration} + \Macro{DayNumber}\Parameter{year}\Parameter{month}\Parameter{day}\\% + \Macro{ISODayNumber}\Parameter{ISO-date}% +\end{Declaration}% +\BeginIndex{Cmd}{DayNumber}% +\BeginIndex{Cmd}{ISODayNumber}% +These\ChangedAt{v3.05a}{\Package{scrdate}} two commands offers the value of +the number of the day of the week\Index{day>of the week} of any date. The +differ only in the kind of date declaration. Command \Macro{DayNumber} needs +\PName{year}, \PName{month}, and \PName{day} as separate parameters. Command +\Macro{ISODayNumber} expects an \PName{ISO-date} as a single argument. The +expected format of the \PName{ISO-date} is: +\PName{year}\texttt{-}\PName{month}\texttt{-}\PName{day}. It doesn't matter +whether \PName{month} or \PName{day} have one or two digits. The result of +both commands may be assigned to a counter or used for calculations, i.\,e., +using \Macro{numexpr}\IndexCmd{numexpr}. For output of +an Arabic number of the value prefix it with \Macro{the}\IndexCmd{the}. + +\begin{Example} + You want to know the number of the day of the week of the 1st~May~2027. +\begin{lstcode} + The 1st~May~2027 has \the\ISODayNumber{2027-5-1} + as the number of the day of the week. +\end{lstcode} + The result will be: + \begin{quote} + The 1st~May~2027 has \the\ISODayNumber{2027-5-1} + as the number of the day of the week. + \end{quote} +\end{Example} + +A special feature is to walk a number of days into future or past from a given +date. +\begin{Example} + You want to know the number of the day of the week, that will be in 12~days + and that will be 24~days before the 24th~December~2027. +\begin{lstcode} + In 12~days the number of the day of the week + will be \the\DayNumber{\year}{\month}{\day+12} and + 24~days before the 24th~December~2027 it will be + \the\ISODayNumber{2027-12-24-24}. +\end{lstcode} + The result may be, e.\,g.: + \begin{quote} + In 12~days the number of the day of the week + will be \the\DayNumber{\year}{\month}{\day+12} and + 24~days before the 24th~December~2027 it will be + \the\ISODayNumber{2027-12-24-24}. + \end{quote} +\end{Example} + +The days of the week are numbered: Sunday\,=\,0, Monday\,=\,1, Tuesday\,=\,2, +Wednesday\,=\,3, Thursday\,=\,4, Friday\,=\,5, and Saturday\,=\,6.% +% +\EndIndex{Cmd}{DayNumber}% +\EndIndex{Cmd}{ISODayNumber}% + + +\begin{Declaration} + \Macro{DayNameByNumber}\Parameter{number of the day of the week}\\% + \Macro{DayName}\Parameter{year}\Parameter{month}\Parameter{day}\\% + \Macro{ISODayName}\Parameter{ISO-date}% +\end{Declaration}% +\BeginIndex{Cmd}{DayNameByNumber}% +\BeginIndex{Cmd}{DayName}% +\BeginIndex{Cmd}{ISODayName}% +Usually\ChangedAt{v3.05a}{\Package{scrdate}} you don't want to know the number +of the day of the week, but the name of the day of the week. Because of this, +the command \Macro{DayNameByNumber} offers the name of the day of the week +corresponding with a number. The number may be the result of \Macro{DayNumber} +or \Macro{ISODayNumber}. The two commands \Macro{DayName} and +\Macro{ISODayName} directly offer the name of the day of the week of a given +date. + +\begin{Example} + You want to know the name of the day of the week of the 24th~December~2027. +\begin{lstcode} + Please pay you bill until \ISODayName{2027-12-24}, + 24th~December~2027. +\end{lstcode} + The result will be: + \begin{quote} + Please pay you bill until \ISODayName{2027-12-24}, + 24th~December~2027. + \end{quote} +\end{Example} + +Again a special feature is to make some calculations inside the argument of +\Macro{DayName}. +\begin{Example} + You want to know the names of the days of the week, that will be in 12~days + and that will be 24~days before the 24th~December~2027. +\begin{lstcode} + In 12~days the name of the day of the week + will be \DayName{\year}{\month}{\day+12} and + 24~days before the 24th~December~2027 it will be + \ISODayName{2027-12-24-24}. Nevertheless two weeks + and three days after a Wednesday a + \DayNameByNumber{3+2*7+3} will follow. +\end{lstcode} + The result may be, e.\,g.: + \begin{quote} + In 12~days the name of the day of the week + will be \DayName{\year}{\month}{\day+12} and + 24~days before the 24th~December~2027 it will be + \ISODayName{2027-12-24-24}. Nevertheless two weeks + and three days after a Wednesday a + \DayNameByNumber{3+2*7+3} will follow. + \end{quote} +\end{Example}% +% +\EndIndex{Cmd}{ISODayName}% +\EndIndex{Cmd}{DayName}% +\EndIndex{Cmd}{DayNameByNumber}% + \begin{Declaration} - \Macro{todaysname} + \Macro{ISOToday}\\% + \Macro{IsoToday}\\ + \Macro{todaysname}\\% + \Macro{todaysnumber}% \end{Declaration}% \BeginIndex{Cmd}{todaysname}% -You should know that with \Macro{today}\IndexCmd{today} one obtains -the current date in a language-dependent spelling. \Package{scrdate} -offers you the command \Macro{todaysname} with which one can obtain -the name of the current day of the week in a language-dependent -spelling. +\BeginIndex{Cmd}{todaysnumber}% +\BeginIndex{Cmd}{ISOToday}% +\BeginIndex{Cmd}{IsoToday}% +In the prior examples the current date have been given cumbersomely and +explicitly using the \TeX{} registers \Macro{year}\IndexCmd{year}, +\Macro{month}\IndexCmd{month}, and \Macro{day}\IndexCmd{day}. The commands +\Macro{ISOToday}\ChangedAt{v3.05a}{\Package{scrdate}} and \Macro{IsoToday} +offers the current date in ISO-notation directly. These commands differ in the +number of digits for numbers less than 10 only. \Macro{ISOToday} prefixes +numbers less than 10 for the month and day with a 0. In opposite to this +\Macro{IsoToday} will show numbers less than 10 for the month and day with one +digit only. Command \Macro{todaysname} directly offers the name of the current +day of the week. Command \Macro{todaysnumber} offers the number of that name +instead. More information about usability of this value may be found at +previous description of \Macro{DayNumber} and \Macro{ISODayNumber}. \begin{Example} - In your document you want to show the name of the weekday on which - the \File{dvi} file was generated using {\LaTeX}. To do this, you - write: + I want to show you the name of the weekday in which this document has been + type-set: \begin{lstlisting} - I have done the {\LaTeX} run of this document on a \todaysname. + I have done the {\LaTeX} run of this document + on a \todaysname. \end{lstlisting} This will result in, e.\,g.: \begin{quote} - I have done the {\LaTeX} run of this document on a \todaysname. + I have done the {\LaTeX} run of this document + on a \todaysname. \end{quote} \end{Example} @@ -99,15 +272,28 @@ letter. Given this limitation, the example above can work correctly only for some languages. \begin{Explain} - \textbf{Tip:} The names of the weekdays are saved in capitalized - form, i.\,e., the first letter is a capital letter, all the others are - lowercase letters. But for some languages you may need the names - completely in lowercase. You may achieve this using the standard - {\LaTeX} command \Macro{MakeLowercase}. You simply have to write - \Macro{MakeLowercase}\PParameter{\Macro{todaysname}}. -\end{Explain} + The\textnote{Hint!} names of the weekdays are saved in capitalized form, + i.\,e., the first letter is a capital letter, all the others are lowercase + letters. But for some languages you may need the names completely in + lowercase. You may achieve this using the standard {\LaTeX} command + \Macro{MakeLowercase}\IndexCmd{MakeLowercase}% + \important{\Macro{MakeLowercase}}, e.\,g.: + % Umbruchkorrektur: listings +\begin{lstcode}[belowskip=\dp\strutbox] + \MakeLowercase{\todaysname} +\end{lstcode} + This converts the whole argument into lower case letters. Of course, this + may be done also using previous described commands + \Macro{DayNameByNumber}\IndexCmd{DayNameByNumber}, + \Macro{DayName}\IndexCmd{DayName} and + \Macro{ISODayName}\IndexCmd{ISODayName}.% +\end{Explain}% +\EndIndex{Cmd}{IsoToday}% +\EndIndex{Cmd}{ISOToday}% +\EndIndex{Cmd}{todaysnumber}% \EndIndex{Cmd}{todaysname} + \begin{Declaration} \Macro{nameday}\Parameter{name} \end{Declaration}% @@ -123,39 +309,42 @@ be changed to \PName{name} by using \Macro{nameday}. \nameday{workday} \end{lstlisting} After this the previous example will result in: - \begin{quote} - I have done the {\LaTeX} run of this document on a workday. + \begin{quote}\nameday{workday} + I have done the {\LaTeX} run of this document on a \todaysname. \end{quote} \end{Example} +There's no such command for changing the result of +\Macro{ISOToday}\IndexCmd{ISOToday} or \Macro{IsoToday}\IndexCmd{IsoToday}. \EndIndex{Cmd}{nameday} -Currently the package \Package{scrdate} knows the languages english (english, -american, USenglish, UKenglish and british), german (german, ngerman, -austrian, and naustrian), french, italian, spanish, croatian, finnish, and -norsk. If you want to configure it for other languages, see -\File{scrdate.dtx}. + +\minisec{Name of the day of the week in different languages}% +Currently the package \Package{scrdate} knows the languages English (english, +american, USenglish, UKenglish and british), German (german, ngerman, +austrian\ChangedAt{v3.08b}{\Package{scrdate}}, and naustrian), French +(french), Italian (italian), Spanish (spanish), Croatian (croatian), Finnish +(finnish), Norwegian (norsk), Swedish (swedish), and Danish (danish). If you +want to configure it for other languages, see \File{scrdate.dtx}. In the current implementation it does not matter whether you load \Package{scrdate} before or after \Package{german}\IndexPackage{german}, \Package{ngerman}\IndexPackage{ngerman}, -\Package{babel}\IndexPackage{babel} or similar packages. The current -language will be set up at \Macro{begin}\PParameter{document}. +\Package{babel}\IndexPackage{babel} or similar packages. In both cases the +correct language will be used. \begin{Explain} To explain a little bit more exactly: while you are using a language selection which works in a compatible way to \Package{babel}\IndexPackage{babel} or - \Package{german}\IndexPackage{german}, the correct language will be - used by \Package{scrdate}. If you are using another language - selection you will get (US) english names. In \File{scrdate.dtx} you - will find the description of the \Package{scrdate} commands for - defining the names. + \Package{ngerman}\IndexPackage{ngerman}, the correct language will be used + by \Package{scrdate}. If you are using another language selection you will + get (US-)English names. \end{Explain} \EndIndex{Package}{scrdate} -\section{Getting the Time with Package \Package{scrtime}} +\section{Getting the Time with Package} \label{sec:datetime.scrtime} \BeginIndex{Package}{scrtime} @@ -218,20 +407,37 @@ determined using \Macro{settime}.% \EndIndex{Cmd}{settime} \begin{Declaration} - \Option{12h}\\ - \Option{24h} + \KOption{12h}\PName{simple-switch}% \end{Declaration}% -\BeginIndex{Option}{12h}\BeginIndex{Option}{24h}% -Using the options \Option{12h} and \Option{24h} one can select whether -the result of \Macro{thistime} and \Macro{thistime*} is in 12- or in -24-hour format. The default is \Option{24h}. The option has no effect -on the results of \Macro{thistime} and \Macro{thistime*} if -\Macro{settime} is used.% -\EndIndex{Option}{12h}\EndIndex{Option}{24h} +\BeginIndex{Option}{12h~=\PName{simple switch}}% +\BeginIndex{Option}{24h}% +With option \Option{12h}\ChangedAt{v3.05a}{\Package{scrtime}} one can select +whether the result of \Macro{thistime} and \Macro{thistime*} is in 12- or in +24-hour format. The option understands the values for simple-switch listed in +\autoref{tab:truefalseswitch}, \autopageref{tab:truefalseswitch}. The option +without a value is same like \OptionValue{12h}{true} and therefore +12-hour-format will be used. The default is \Option{24h}. + +You may use this option either as a global option in the optional argument of +\Macro{documentclass}, as a package option in the optional argument of +\Macro{usepackage} or after loading the package using \Macro{KOMAoptions} or +\Macro{KOMAoption} (see, e.\,g., \autoref{sec:typearea.options}, +\autopageref{desc:typearea.cmd.KOMAoptions}). The option has no effect on the +results of \Macro{thistime} and \Macro{thistime*} if \Macro{settime} is used. + +Only\textnote{Attention!} for compatibility with former releases of +\Package{scrtime} also option \Option{24h} will switch to 24-hour format if +used in the optional argument of \Macro{documentclass} or +\Macro{usepackage}. Nevertheless, you should not use this option any longer.% +\EndIndex{Option}{24h}% +\EndIndex{Option}{12h~=\PName{simple switch}}% +% \EndIndex{Package}{scrtime} +\endinput + %%% Local Variables: %%% mode: latex -%%% coding: iso-latin-1 +%%% coding: us-ascii %%% TeX-master: "../guide" %%% End: |