% \CheckSum{283} % \iffalse % ====================================================================== % scrtime.dtx % Copyright (C) 1995-2004 Markus Kohm % % This file is part of the LaTeX2e KOMA-Script-Bundle % % This file can be redistributed and/or modified under the terms % of the LaTeX Project Public License Version 1.0 distributed % together with this file. See LEGAL.TXT or LEGALDE.TXT. % % This bundle is written specialy for use at german-language. So the % main documentation is german. There is also a english documentation, % but this is NOT up-to-date. % ---------------------------------------------------------------------- % scrtime.dtx % Copyright (C) 1995-2004 Markus Kohm % % Diese Datei ist Teil des LaTeX2e KOMA-Script-Pakets. % % Diese Datei kann nach den Regeln der LaTeX Project Public % Licence Version 1.0, wie sie zusammen mit dieser Datei verteilt % wird, weiterverbreitet und/oder modifiziert werden. Siehe dazu % auch LEGAL.TXT oder LEGALDE.TXT. % % Dieses Paket ist f"ur den deutschen Sprachraum konzipiert. Daher ist % auch diese Anleitung komplett in Deutsch. Zwar existiert auch eine % englische Version der Anleitung, diese hinkt der deutschen Anleitung % jedoch fast immer hinterher. % ====================================================================== % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % %<*dtx> \ProvidesFile{scrtime.dtx} % %\NeedsTeXFormat{LaTeX2e}[1995/12/01] % \ProvidesFile{scrtime.drv} %\ProvidesPackage{scrtime} %\ProvidesPackage{scrdate} [2002/02/02 v1.1m LaTeX2e KOMA % BETA-VERSION % package] %<*driver> driver] \documentclass{ltxdoc} \usepackage[a4paper]{typearea} \CodelineIndex \begin{document} \DocInput{scrtime.dtx} \end{document} % % \fi % % \GetFileInfo{scrtime.dtx} % \RecordChanges % \title{The \textsf{KOMA}-timedate-bundle\thanks{This file has % version number \fileversion, last revised \filedate.}} % \author{Markus Kohm} % \date{\filedate} % \maketitle % % \def\oarg#1{{\ttfamily[}{\em#1\/}{\ttfamily]}} % \def\arg#1{{\ttfamily\char`\{}{\em#1\/}{\ttfamily\char`\}}} % \def\star{{\ttfamily*}} % \makeatletter % \def\Describe@Macro#1{\endgroup % \setbox0=\lastbox\llap{\PrintDescribeMacro{#1}}}% % \def\Describe@Env#1{\endgroup % \setbox0=\lastbox\llap{\PrintDescribeEnv{#1}}}% % \makeatother % \marginparsep0pt % % \begin{abstract} % This bundle includes a package \texttt{scrtime} defining some % macros to handle compilation-time. % It's a very simple implementation similar to \texttt{time.sty}. % I've tried to use no additional register. % % The second package \texttt{scrdate} defines some macros to % handle the name of the day! % \end{abstract} % % \tableofcontents % % \section{Introduction} % \subsection{\texttt{scrtime}-package} % \DescribeMacro % \today\\ % \DescribeMacro % \date\arg{today's-value}\\ % \DescribeMacro % \thistime\oarg{hourseparator}\\ % \DescribeMacro % \settime\arg{thistime's-value}\\ % At \LaTeX\ there's a macro |\today| to get compilation-date. There's % a macro |\date| to set the value of |\today|, too. But to handle % compilation-time there is only a macro |\time| which shows the % gone minutes of the day. % % With the macro |\thistime| you get the actual time. The optional % argument \oarg{hourseparator} is used to separate hours and minutes. % Default-value is ``|:|''. |\thistime| writes values of minutes less than % ten with prefix ``0''. |\thistime*| doesn't. % % With the macro |\settime| you may set the value of |\thistime|. After % this the optional argument of |\thistime| will be ignored. % % % \subsection{\texttt{scrdate}-package} % % At \LaTeX\ there are macros to get the actual day or month or year. Using % |\today| you even may get the name of the month, but you will never get the % name of the day. % % This package defines some macros to handle the name of the day. % % \begin{description} % \item[Important:] If you use language-packages like \texttt{german} or % \texttt{babel}, these \emph{must} be loaded \emph{after} % \texttt{scrdate}-package. Otherwise the name of the day'll be wrong! % \end{description} % % \noindent\texttt{scrdate} knows five languages: % \begin{itemize} % \item english % \item USenglish % \item german % \item ngerman % \item french % \end{itemize} % % \DescribeMacro % \newdaylanguage\arg{language}\arg{Monday}\arg{Tuesday}\arg{Wednesday}% % \arg{Thursday}\arg{Friday}\arg{Saturday}\arg{Sunday}\\ % You may add additional languages using the configurationfile % \texttt{scrdate.cfg}. There you have to define a macro % |\dayname@|\emph{language}. You may use |\newdaylanguage| to do so. % % % \DescribeMacro % \todaysname\\ % shows the name of the actual day (defined by |\year|, |\month| and % |\day| or by |\dayname|). % % \DescribeMacro % \dayname\arg{Name}\\ % sets the name of the day to \arg{Name}. % % % \StopEventually % % \section{Implementation} % %\iffalse % \begin{macrocode} %<*beta> \PackageWarningNoLine % {scrtime} % {scrdate} {THIS IS A BETA VERSION!\MessageBreak YOU SHOULD NOT USE THIS VERSION!\MessageBreak YOU SHOULD INSTALL THE RELEASE FROM CTAN\MessageBreak AND USE THAT INSTEAD OF THIS BETA VERSION} % % \end{macrocode} %\fi % % \subsection{Time-macros} % % \begin{macrocode} %<*scrtime> % \end{macrocode} % % \subsubsection{Options} % \changes{v1.1b}{1995/02/15}{Options \texttt{12h} and \texttt{24h} added.} % There are two the two Options |24h| and |12h|. We need a switch to % distinguish. % \begin{macrocode} \newif\if@Hxii % \end{macrocode} % % So the Options are simple. % \begin{macrocode} \DeclareOption{12h}{\@Hxiitrue} \DeclareOption{24h}{\@Hxiifalse} % \end{macrocode} % % Default is 24h-mode. % \begin{macrocode} \ExecuteOptions{24h} \ProcessOptions % \end{macrocode} % % \subsubsection{Macros} % We use |\@tempcnta| and |\@tempcntb| but we know, that this is not % a very good idea. % % \begin{macro}{\thistime} % \changes{v1.1b}{1995/02/15}{{\cmd\thistime*} added.} % \changes{v1.1b}{1995/02/15}{{\cmd\thistime} works.} % First we have to decide, is it a star-version ore not. % \begin{macrocode} \def\thistime{% \@ifstar {\let\@tempif\iffalse\@thistime} {\let\@tempif\iftrue\@thistime}} % \end{macrocode} % Know we have to calculate the hours and minutes. |\@tempcnta| are the % hours and |\@tempcntb| are the minutes. % \begin{macrocode} \newcommand*{\@thistime}[1][:]{% \begingroup \@tempcnta\time\divide\@tempcnta60\multiply\@tempcnta60 \@tempcntb\time\advance\@tempcntb-\@tempcnta \divide\@tempcnta60 % \end{macrocode} % If we use 12h-mode, we have to cut the houres. % \changes{v1.1d}{1996/01/14}{Space added at \cs{@thistime} between -12 % and \cs{fi} (Martin Schroeder).} % \begin{macrocode} \if@Hxii\ifnum\@tempcnta>12 \advance\@tempcnta-12 \fi\fi % \end{macrocode} % Know we have to compose the value. If the minutes are less than 10 % maybe there has to be an additional 0. % \begin{macrocode} \the\@tempcnta{#1}\@tempif\ifnum\@tempcntb<10 0\fi\fi\the\@tempcntb% \endgroup} % \end{macrocode} % \end{macro} % % \begin{macro}{\settime} % \changes{v1.1b}{1995/02/15}{{\cmd\settime} redefines {\cmd\@thistime}} % \changes{v1.1c}{1995/05/24}{missing macrocode-environment inserted} % We simply have to set |\thistime|. % \begin{macrocode} \newcommand*{\settime}[1]{\renewcommand*{\@thistime}[1][]{#1}} % \end{macrocode} % \end{macro} % % % That's it: % \begin{macrocode} % % \end{macrocode} % % % \subsection{Date-macros} % % \begin{macrocode} %<*scrdate> % \end{macrocode} % % \changes{v1.1a}{1995/02/12}{Changed simply all but the user-interface.} % To handle them, we need counters. We use the same as in \texttt{scrtime}. % % \begin{macro}{\todaysname} % This is not so easy. First we have to calculate how many days they are % from 1st January 1980. % \begin{macrocode} \newcommand\todaysname{% \begingroup% \@tempcnta=\year \@tempcntb=1 % 1. Januar 1980 war ein Dienstag \ifnum\@tempcnta<1980 unknown\else% \advance\@tempcnta by-1980% \@whilenum\@tempcnta>3\do% {\advance\@tempcntb by5\advance\@tempcnta by-4}% \ifnum\@tempcnta=0% \ifnum\month>2\advance \@tempcntb by1\fi% \else% \advance\@tempcntb by\@tempcnta% \advance\@tempcntb by1 \fi% \ifcase\month\or\or\advance\@tempcntb3% Jan = 28 + 3 \or\advance\@tempcntb3% +Feb = 56 + 3 \or\advance\@tempcntb6% +Mar = 84 + 6 \or\advance\@tempcntb1% +Apr = 119 + 1 \or\advance\@tempcntb4% +May = 147 + 4 \or\advance\@tempcntb6% +Jun = 175 + 6 \or\advance\@tempcntb2% +Jul = 210 + 2 \or\advance\@tempcntb5% +Aug = 238 + 5 \or% +Sep = 273 + 0 \or\advance\@tempcntb3% +Oct = 301 + 3 \or\advance\@tempcntb5% +Nov = 329 + 5 \fi% \advance\@tempcntb by\day% \advance\@tempcntb by-1% die Zaehlung beginnt bei 0 \@whilenum\@tempcntb>6\do% {\advance\@tempcntb by-7}% % \end{macrocode} % Now we can say which day it is. % \begin{macrocode} \@dayname{\@tempcntb}% \fi\endgroup} % \end{macrocode} % \end{macro} % % \begin{macro}{\nameday} % We simply have to redefine |\todaysname| % \begin{macrocode} \newcommand\nameday[1]{\renewcommand\todaysname{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{\newdaylanguage} % We write a macro to define the name of the days. % \changes{v1.1e}{1996/12/07}{Bernd's expandafter-trick to not define % a new language.} % \begin{macro}{\scrdate@languagenamewarning} % But before this, we have to define a once only warning. % \begin{macrocode} \newcommand*\scrdate@languagenamewarning{ \PackageWarningNoLine{scrdate} {\string\languagename\space not defined, using \string\language.\MessageBreak This may result in use of wrong language!\MessageBreak You should use a compatible language package\MessageBreak (e.g. `Babel', `german', `french', ...)} \let\scrdate@languagenamewarning\relax} % \end{macrocode} % \end{macro} % \begin{macrocode} \newcommand\newdaylanguage[8]{% % \end{macrocode} % First we check, if the language is defined at the format, the user uses. % If it is not defined, we do not define the name of the days and warn. % \begin{macrocode} \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname l@#1\endcsname\relax \PackageWarningNoLine{scrdate}{Language #1\space not defined.\MessageBreak \protect\dayname@#1\space skipped!} % \end{macrocode} % \changes{v1.1c}{1995/05/24}{missing \cs{end\{macrocode\}} added.} % If it is defined, we define the name-selection-macro % |\dayname@|\emph{language}. % First we define the new macro |\dayname@|\emph{language}: % \begin{macrocode} \else \@namedef{dayname@#1}##1{% \begingroup% \@tempcnta ##1% \ifcase\@tempcnta% #2\or #3\or #4\or #5\or #6\or #7\or #8\fi\endgroup% } % \end{macrocode} % Then we define, what to do at |\begin{document}|: % \begin{macrocode} \AtBeginDocument{ % \end{macrocode} % There we first have to test, if |\date|\emph{language} is defined % (e.g. using |german.sty|). If not, we have to warn once more. % \changes{v1.1e}{1996/12/07}{Bernd's expandafter-trick to not define % new \cs{date}\emph{language}.} % \begin{macrocode} \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname date#1\endcsname\relax \PackageWarningNoLine{scrdate} {\protect\date#1\space not defined.\MessageBreak \protect\todaysname maybe can't use \protect\dayname@#1!} % \end{macrocode} % But if it is defined, we can use it % \begin{macrocode} \else % \end{macrocode} % There we first save |\date|\emph{language} as |\D@date|\emph{language}. % This is a bit tricky, but I think, you'll understand it. % \begin{macrocode} \expandafter\let\csname D@date#1\expandafter\endcsname \csname date#1\endcsname % \end{macrocode} % Now we redefine |\date|\emph{language}. It first defines |\@dayname| and % then calls saved macro. If you've understand the definition before, you'll % understand this tricky one, too. % \begin{macrocode} \@namedef{date#1}{% \expandafter\let\expandafter\@dayname\csname dayname@#1\endcsname \@nameuse{D@date#1}}% % \end{macrocode} % Last we have to select this new |\date|\emph{language}. % \changes{v1.1j}{2000/01/20}{use of \cs{languagename} if defined} % \begin{macrocode} \@ifundefined{languagename}{ \scrdate@languagenamewarning \ifnum\language=\@nameuse{l@#1} \@nameuse{date#1} \fi}{ \@ifundefined{date\languagename} {} {\@nameuse{date\languagename}} } \fi } \fi } % \end{macrocode} % \end{macro} % % \begin{macro}{\@dayname} % This should be named selecting the language. Since I changed the definitions % |german.sty| and equal may be loaded before or after |scrdate.sty| or not. % % First we define the usual languages using |\newdaylanguage|: % \begin{macro}{\dayname@german} % \begin{macrocode} \newdaylanguage{german}{Montag}{Dienstag}{Mittwoch} {Donnerstag}{Freitag}{Samstag}{Sonntag} % \end{macrocode} % \end{macro} % \begin{macro}{\dayname@ngerman} % \changes{v1.1i}{1999/10/09}{new language ``ngerman''.} % \begin{macrocode} \newdaylanguage{ngerman}{Montag}{Dienstag}{Mittwoch} {Donnerstag}{Freitag}{Samstag}{Sonntag} % \end{macrocode} % \end{macro} % \begin{macro}{\dayname@english} % \changes{v1.1g}{1997/06/21}{correct name is ``tuesday''.} % \begin{macrocode} \newdaylanguage{english}{Monday}{Tuesday}{Wednesday} {Thursday}{Friday}{Saturday}{Sunday} % \end{macrocode} % \end{macro} % \begin{macro}{\dayname@USenglish} % \changes{v1.1g}{1997/06/21}{correct name is ``tuesday''.} % \begin{macrocode} \newdaylanguage{USenglish}{Monday}{Tuesday}{Wednesday} {Thursday}{Friday}{Saturday}{Sunday} % \end{macrocode} % \end{macro} % \begin{macro}{\dayname@french} % \begin{macrocode} \newdaylanguage{french}{Lundi}{Mardi}{Mercredi} {Jeudi}{Vendredi}{Samedi}{Dimanche} % \end{macrocode} % \end{macro} % \begin{macro}{\dayname@italian} % \changes{v1.1f}{1997/06/06}{New (thanks to Lorenzo M.\ Catucci)} % \begin{macrocode} \newdaylanguage{italian}{Luned\`\i}{Marted\`\i}{Mercoled\`\i} {Gioved\`\i}{Venerd\`\i}{Sabato}{Domenica} % \end{macrocode} % \end{macro} % \begin{macro}{\dayname@spanish} % \changes{v1.1h}{1997/07/26}{New (thanks to Ralph J.\ Hangleiter)} % \begin{macrocode} \newdaylanguage{spanish}{Lunes}{Martes}{Mi\'ercoles} {Jueves}{Viernes}{S\'abado}{Domingo} % \end{macrocode} % \end{macro} % \begin{macro}{\dayname@croatian} % \changes{v1.1l}{2001/10/05}{New (thanks to Branka Lon\v{c}arevi\'{c})} % \begin{macrocode} \newdaylanguage{croatian}{Ponedjeljak}{Utorak}{Srijeda} {\v{C}etvrtak}{Petak}{Subota}{Nedjelja} % \end{macrocode} % \end{macro} % \begin{macro}{\dayname@dutch} % \changes{v1.1m}{2002/02/02}{New (thanks to Henk Jongbloets)} % \begin{macrocode} \newdaylanguage{dutch}{Maandag}{Dinsdag}{Woensdag} {Donderdag}{Vrijdag}{Zaterdag}{Zondag} % \end{macrocode} % \end{macro} % % If there are no language-definitions, we simply want the US-english names % of the days. % \changes{v1.1g}{1997/06/21}{correct name is ``tuesday''.} % \begin{macrocode} \def\@dayname#1{% \begingroup% \@tempcnta #1% \ifcase\@tempcnta% Monday\or Tuesday\or Wednesday\or Thursday\or Friday\or Saturday\or Sunday\fi\endgroup% } % \end{macrocode} % \end{macro} % % Last but not least file \texttt{scrdate.cfg} has to be included, % if it exists. % \begin{macrocode} \InputIfFileExists{scrdate.cfg} {\typeout{*************************************^^J% * Local config file scrdate.cfg used^^J% *************************************}} {} % \end{macrocode} % % That's it: % \begin{macrocode} % % \end{macrocode} % % \def\englishonly{} % \input{scrlogo.dtx} % % \Finale % \endinput % % Ende der Datei `scrtime.dtx' %%% Local Variables: %%% mode: latex %%% Text-master: scrclass.ins %%% TeX-open-quote: "\"`" %%% TeX-close-quote: "\"'" %%% End: