Debian Codegraph @

texmf-dist/source/latex/datetime2-czech/datetime2-czech.dtx

raw
1 %\iffalse
2 %<*package>
3 %% \CharacterTable
4 %% {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
5 %% 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
6 %% Digits \0\1\2\3\4\5\6\7\8\9
7 %% Exclamation \! Double quote \" Hash (number) \#
8 %% Dollar \$ Percent \% Ampersand \&
9 %% Acute accent \' Left paren \( Right paren \)
10 %% Asterisk \* Plus \+ Comma \,
11 %% Minus \- Point \. Solidus \/
12 %% Colon \: Semicolon \; Less than \<
13 %% Equals \= Greater than \> Question mark \?
14 %% Commercial at \@ Left bracket \[ Backslash \\
15 %% Right bracket \] Circumflex \^ Underscore \_
16 %% Grave accent \` Left brace \{ Vertical bar \|
17 %% Right brace \} Tilde \~}
18 %</package>
19 %\fi
20 % \iffalse
21 % Doc-Source file to use with LaTeX2e
22 % Copyright (C) 2018 Nicola Talbot, all rights reserved.
23 % (New maintainer add relevant lines here.)
24 % \fi
25 % \iffalse
26 %<*driver>
27 \documentclass{ltxdoc}
28
29 \usepackage{alltt}
30 \usepackage{graphicx}
31 \usepackage{fontspec}
32 \usepackage[colorlinks,
33 bookmarks,
34 hyperindex=false,
35 pdfauthor={Nicola L.C. Talbot},
36 pdftitle={datetime2.sty Czech Module}]{hyperref}
37
38 \setmainfont{Liberation Serif}
39 \setmonofont{Liberation Mono}
40
41 \CheckSum{301}
42
43 \renewcommand*{\usage}[1]{\hyperpage{#1}}
44 \renewcommand*{\main}[1]{\hyperpage{#1}}
45 \IndexPrologue{\section*{\indexname}\markboth{\indexname}{\indexname}}
46 \setcounter{IndexColumns}{2}
47
48 \newcommand*{\sty}[1]{\textsf{#1}}
49 \newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}|main}}
50
51 \RecordChanges
52 \PageIndex
53 \CodelineNumbered
54
55 \begin{document}
56 \DocInput{datetime2-czech.dtx}
57 \end{document}
58 %</driver>
59 %\fi
60 %
61 %\MakeShortVerb{"}
62 %
63 %\title{Czech Module for datetime2 Package}
64 %\author{Nicola L. C. Talbot (inactive)}
65 %\date{2018-03-19 (v1.1)}
66 %\maketitle
67 %
68 %This module is currently unmaintained and may be subject to change.
69 %If you want to volunteer to take over maintanance, contact me at
70 %\url{http://www.dickimaw-books.com/contact.html}
71 %
72 %\begin{abstract}
73 %This is the Czech language module for the \sty{datetime2}
74 %package. If you want to use the settings in this module you must
75 %install it in addition to installing \sty{datetime2}. If you use
76 %\sty{babel} or \sty{polyglossia}, you will need this module to
77 %prevent them from redefining \cs{today}. The \sty{datetime2}
78 % \opt{useregional} setting must be set to "text" or "numeric"
79 % for the language styles to be set.
80 % Alternatively, you can set the style in the document using
81 % \cs{DTMsetstyle}, but this may be changed by \cs{date}\meta{language}
82 % depending on the value of the \opt{useregional} setting.
83 %\end{abstract}
84 %
85 %I've copied the date style from \texttt{babel-czech}'s \cs{today}.
86 %
87 %I don't know if these settings are correct as I can't speak Czech.
88 %In particular, I don't know if the "czech" time style is
89 %correct. Currently this just uses the "default" time style. Please
90 %be aware that this may change. Whoever takes over maintanance
91 %of this module may can change it as appropriate.
92 %
93 %The new maintainer should add the line:
94 %\begin{verbatim}
95 % The Current Maintainer of this work is Name.
96 %\end{verbatim}
97 %to the preamble part in \texttt{datetime2-czech.ins} where Name
98 %is the name of the maintainer(s) and replace
99 %the `inactive' status to `maintained'.
100 %
101 %Currently there is only a regionless style.
102 %
103 %\StopEventually{%
104 %\clearpage
105 %\phantomsection
106 %\addcontentsline{toc}{section}{Change History}%
107 %\PrintChanges
108 %\addcontentsline{toc}{section}{\indexname}%
109 %\PrintIndex}
110 %\section{The Code}
111 %\iffalse
112 % \begin{macrocode}
113 %<*datetime2-czech-utf8.ldf>
114 % \end{macrocode}
115 %\fi
116 %\subsection{UTF-8}
117 %This file contains the settings that use UTF-8 characters. This
118 %file is loaded if XeLaTeX or LuaLaTeX are used. Please make sure
119 %your text editor is set to UTF-8 if you want to view this code.
120 %\changes{1.0}{2015-03-30}{Initial release}
121 % Identify module
122 % \begin{macrocode}
123 \ProvidesDateTimeModule{czech-utf8}[2018/03/19 v1.1]
124 % \end{macrocode}
125 %\begin{macro}{\DTMczechordinal}
126 % \begin{macrocode}
127 \newcommand*{\DTMczechordinal}[1]{%
128 \number#1.%
129 }
130 % \end{macrocode}
131 %\end{macro}
132 %
133 %
134 %\begin{macro}{\DTMczechmonthname}
135 % Czech month names.
136 % \begin{macrocode}
137 \newcommand*{\DTMczechmonthname}[1]{%
138 \ifcase#1
139 \or
140 ledna%
141 \or
142 února%
143 \or
144 března%
145 \or
146 dubna%
147 \or
148 května%
149 \or
150 června%
151 \or
152 července%
153 \or
154 srpna%
155 \or
156 září%
157 \or
158 října%
159 \or
160 listopadu%
161 \or
162 prosince%
163 \fi
164 }
165 % \end{macrocode}
166 %\end{macro}
167 %
168 %\begin{macro}{\DTMczechMonthname}
169 % As above but capitalize.
170 % \begin{macrocode}
171 \newcommand*{\DTMczechMonthname}[1]{%
172 \ifcase#1
173 \or
174 Ledna%
175 \or
176 Února%
177 \or
178 Března%
179 \or
180 Dubna%
181 \or
182 Května%
183 \or
184 Června%
185 \or
186 Července%
187 \or
188 Srpna%
189 \or
190 Září%
191 \or
192 Října%
193 \or
194 Listopadu%
195 \or
196 Prosince%
197 \fi
198 }
199 % \end{macrocode}
200 %\end{macro}
201 %
202 %If abbreviated dates are supported, short month names should be
203 %likewise provided.
204 %
205 %
206 %\iffalse
207 % \begin{macrocode}
208 %</datetime2-czech-utf8.ldf>
209 % \end{macrocode}
210 %\fi
211 %\iffalse
212 % \begin{macrocode}
213 %<*datetime2-czech-ascii.ldf>
214 % \end{macrocode}
215 %\fi
216 %\subsection{ASCII}
217 %This file contains the settings that use \LaTeX\ commands for
218 %non-ASCII characters. This should be input if neither XeLaTeX nor
219 %LuaLaTeX are used. Even if the user has loaded \sty{inputenc} with
220 %"utf8", this file should still be used not the
221 %\texttt{datetime2-czech-utf8.ldf} file as the non-ASCII
222 %characters are made active in that situation and would need
223 %protecting against expansion.
224 %\changes{1.0}{2015-03-30}{Initial release}
225 % Identify module
226 % \begin{macrocode}
227 \ProvidesDateTimeModule{czech-ascii}[2018/03/19 v1.1]
228 % \end{macrocode}
229 %
230 %If abbreviated dates are supported, short month names should be
231 %likewise provided.
232 %\begin{macro}{\DTMczechordinal}
233 % \begin{macrocode}
234 \newcommand*{\DTMczechordinal}[1]{%
235 \number#1.%
236 }
237 % \end{macrocode}
238 %\end{macro}
239 %
240 %\begin{macro}{\DTMczechmonthname}
241 % Czech month names.
242 % \begin{macrocode}
243 \newcommand*{\DTMczechmonthname}[1]{%
244 \ifcase#1
245 \or
246 ledna%
247 \or
248 \protect\'unora%
249 \or
250 b\protect\v{r}ezna%
251 \or
252 dubna%
253 \or
254 kv\protect\v{e}tna%
255 \or
256 \protect\v{c}ervna%
257 \or
258 \protect\v{c}ervence%
259 \or
260 srpna%
261 \or
262 z\protect\'a\protect\v{r}\protect\'{\protect\i}%
263 \or
264 \protect\v{r}\protect\'{\protect\i}jna%
265 \or
266 listopadu%
267 \or
268 prosince%
269 \fi
270 }
271 % \end{macrocode}
272 %\end{macro}
273 %
274 %\begin{macro}{\DTMczechMonthname}
275 % As above but start with a capital.
276 % \begin{macrocode}
277 \newcommand*{\DTMczechMonthname}[1]{%
278 \ifcase#1
279 \or
280 Ledna%
281 \or
282 \protect\'Unora%
283 \or
284 B\protect\v{r}ezna%
285 \or
286 Dubna%
287 \or
288 Kv\protect\v{e}tna%
289 \or
290 \protect\v{C}ervna%
291 \or
292 \protect\v{C}ervence%
293 \or
294 Srpna%
295 \or
296 Z\protect\'a\protect\v{r}\protect\'{\protect\i}%
297 \or
298 \protect\v{R}\protect\'{\protect\i}jna%
299 \or
300 Listopadu%
301 \or
302 Prosince%
303 \fi
304 }
305 % \end{macrocode}
306 %\end{macro}
307 %
308 %\iffalse
309 % \begin{macrocode}
310 %</datetime2-czech-ascii.ldf>
311 % \end{macrocode}
312 %\fi
313 %
314 %\subsection{Main Czech Module (\texttt{datetime2-czech.ldf})}
315 %\changes{1.0}{2015-03-30}{Initial release}
316 %
317 %\iffalse
318 % \begin{macrocode}
319 %<*datetime2-czech.ldf>
320 % \end{macrocode}
321 %\fi
322 %
323 % Identify Module
324 % \begin{macrocode}
325 \ProvidesDateTimeModule{czech}[2018/03/19 v1.1]
326 % \end{macrocode}
327 % Need to find out if XeTeX or LuaTeX are being used.
328 % \begin{macrocode}
329 \RequirePackage{ifxetex,ifluatex}
330 % \end{macrocode}
331 % XeTeX and LuaTeX natively support UTF-8, so load
332 % \texttt{czech-utf8} if either of those engines are used
333 % otherwise load \texttt{czech-ascii}.
334 % \begin{macrocode}
335 \ifxetex
336 \RequireDateTimeModule{czech-utf8}
337 \else
338 \ifluatex
339 \RequireDateTimeModule{czech-utf8}
340 \else
341 \RequireDateTimeModule{czech-ascii}
342 \fi
343 \fi
344 % \end{macrocode}
345 %
346 % Define the \texttt{czech} style.
347 % The time style is the same as the "default" style
348 % provided by \sty{datetime2}. This may need correcting. For
349 % example, if a 12 hour style similar to the "englishampm" (from the
350 % "english-base" module) is required.
351 %
352 % Allow the user a way of configuring the "czech" and
353 % "czech-numeric" styles. This doesn't use the package wide
354 % separators such as
355 % \cs{dtm@datetimesep} in case other date formats are also required.
356 %\begin{macro}{\DTMczechdaymonthsep}
357 % The separator between the day and month for the text format.
358 % \begin{macrocode}
359 \newcommand*{\DTMczechdaymonthsep}{\DTMtexorpdfstring{\protect~}{\space}}
360 % \end{macrocode}
361 %\end{macro}
362 %
363 %\begin{macro}{\DTMczechmonthyearsep}
364 % The separator between the month and year for the text format.
365 % \begin{macrocode}
366 \newcommand*{\DTMczechmonthyearsep}{\space}
367 % \end{macrocode}
368 %\end{macro}
369 %
370 %\begin{macro}{\DTMczechdatetimesep}
371 % The separator between the date and time blocks in the full format
372 % (either text or numeric).
373 % \begin{macrocode}
374 \newcommand*{\DTMczechdatetimesep}{\space}
375 % \end{macrocode}
376 %\end{macro}
377 %
378 %\begin{macro}{\DTMczechtimezonesep}
379 % The separator between the time and zone blocks in the full format
380 % (either text or numeric).
381 % \begin{macrocode}
382 \newcommand*{\DTMczechtimezonesep}{\space}
383 % \end{macrocode}
384 %\end{macro}
385 %
386 %\begin{macro}{\DTMczechdatesep}
387 % The separator for the numeric date format.
388 % \begin{macrocode}
389 \newcommand*{\DTMczechdatesep}{.}
390 % \end{macrocode}
391 %\end{macro}
392 %
393 %\begin{macro}{\DTMczechtimesep}
394 % The separator for the numeric time format.
395 % \begin{macrocode}
396 \newcommand*{\DTMczechtimesep}{:}
397 % \end{macrocode}
398 %\end{macro}
399 %
400 %Provide keys that can be used in \cs{DTMlangsetup} to set these
401 %separators.
402 % \begin{macrocode}
403 \DTMdefkey{czech}{daymonthsep}{\renewcommand*{\DTMczechdaymonthsep}{#1}}
404 \DTMdefkey{czech}{monthyearsep}{\renewcommand*{\DTMczechmonthyearsep}{#1}}
405 \DTMdefkey{czech}{datetimesep}{\renewcommand*{\DTMczechdatetimesep}{#1}}
406 \DTMdefkey{czech}{timezonesep}{\renewcommand*{\DTMczechtimezonesep}{#1}}
407 \DTMdefkey{czech}{datesep}{\renewcommand*{\DTMczechdatesep}{#1}}
408 \DTMdefkey{czech}{timesep}{\renewcommand*{\DTMczechtimesep}{#1}}
409 % \end{macrocode}
410 %
411 % TODO: provide a boolean key to switch between full and abbreviated
412 % formats if appropriate. (I don't know how the date should be
413 % abbreviated.)
414 %
415 % Define a boolean key that determines if the time zone mappings
416 % should be used.
417 % \begin{macrocode}
418 \DTMdefboolkey{czech}{mapzone}[true]{}
419 % \end{macrocode}
420 % The default is to use mappings.
421 % \begin{macrocode}
422 \DTMsetbool{czech}{mapzone}{true}
423 % \end{macrocode}
424 %
425 % Define a boolean key that determines if the day of month should be
426 % displayed.
427 % \begin{macrocode}
428 \DTMdefboolkey{czech}{showdayofmonth}[true]{}
429 % \end{macrocode}
430 % The default is to show the day of month.
431 % \begin{macrocode}
432 \DTMsetbool{czech}{showdayofmonth}{true}
433 % \end{macrocode}
434 %
435 % Define a boolean key that determines if the year should be
436 % displayed.
437 % \begin{macrocode}
438 \DTMdefboolkey{czech}{showyear}[true]{}
439 % \end{macrocode}
440 % The default is to show the year.
441 % \begin{macrocode}
442 \DTMsetbool{czech}{showyear}{true}
443 % \end{macrocode}
444 %
445 % Define the "czech" style. (TODO: implement day of week?)
446 % \begin{macrocode}
447 \DTMnewstyle
448 {czech}% label
449 {% date style
450 \renewcommand*\DTMdisplaydate[4]{%
451 \DTMifbool{czech}{showdayofmonth}
452 {\DTMczechordinal{##3}\DTMczechdaymonthsep}%
453 {}%
454 \DTMczechmonthname{##2}%
455 \DTMifbool{czech}{showyear}%
456 {%
457 \DTMczechmonthyearsep
458 \number##1
459 }%
460 {}%
461 }%
462 \renewcommand*\DTMDisplaydate[4]{%
463 \DTMifbool{czech}{showdayofmonth}
464 {%
465 \DTMczechordinal{##3}\DTMczechdaymonthsep
466 \DTMczechmonthname{##2}%
467 }%
468 {%
469 \DTMczechMonthname{##2}%
470 }%
471 \DTMifbool{czech}{showyear}%
472 {%
473 \DTMczechmonthyearsep
474 \number##1
475 }%
476 {}%
477 }%
478 }%
479 {% time style (use default)
480 \DTMsettimestyle{default}%
481 }%
482 {% zone style
483 \DTMresetzones
484 \DTMczechzonemaps
485 \renewcommand*{\DTMdisplayzone}[2]{%
486 \DTMifbool{czech}{mapzone}%
487 {\DTMusezonemapordefault{##1}{##2}}%
488 {%
489 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
490 \ifDTMshowzoneminutes\DTMczechtimesep\DTMtwodigits{##2}\fi
491 }%
492 }%
493 }%
494 {% full style
495 \renewcommand*{\DTMdisplay}[9]{%
496 \ifDTMshowdate
497 \DTMdisplaydate{##1}{##2}{##3}{##4}%
498 \DTMczechdatetimesep
499 \fi
500 \DTMdisplaytime{##5}{##6}{##7}%
501 \ifDTMshowzone
502 \DTMczechtimezonesep
503 \DTMdisplayzone{##8}{##9}%
504 \fi
505 }%
506 \renewcommand*{\DTMDisplay}[9]{%
507 \ifDTMshowdate
508 \DTMDisplaydate{##1}{##2}{##3}{##4}%
509 \DTMczechdatetimesep
510 \fi
511 \DTMdisplaytime{##5}{##6}{##7}%
512 \ifDTMshowzone
513 \DTMczechtimezonesep
514 \DTMdisplayzone{##8}{##9}%
515 \fi
516 }%
517 }%
518 % \end{macrocode}
519 %
520 % Define numeric style.
521 % \begin{macrocode}
522 \DTMnewstyle
523 {czech-numeric}% label
524 {% date style
525 \renewcommand*\DTMdisplaydate[4]{%
526 \DTMifbool{czech}{showdayofmonth}%
527 {%
528 \number##3 % space intended
529 \DTMczechdatesep
530 }%
531 {}%
532 \number##2 % space intended
533 \DTMifbool{czech}{showyear}%
534 {%
535 \DTMczechdatesep
536 \number##1 % space intended
537 }%
538 {}%
539 }%
540 \renewcommand*{\DTMDisplaydate}[4]{\DTMdisplaydate{##1}{##2}{##3}{##4}}%
541 }%
542 {% time style
543 \renewcommand*\DTMdisplaytime[3]{%
544 \number##1
545 \DTMczechtimesep\DTMtwodigits{##2}%
546 \ifDTMshowseconds\DTMczechtimesep\DTMtwodigits{##3}\fi
547 }%
548 }%
549 {% zone style
550 \DTMresetzones
551 \DTMczechzonemaps
552 \renewcommand*{\DTMdisplayzone}[2]{%
553 \DTMifbool{czech}{mapzone}%
554 {\DTMusezonemapordefault{##1}{##2}}%
555 {%
556 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
557 \ifDTMshowzoneminutes\DTMczechtimesep\DTMtwodigits{##2}\fi
558 }%
559 }%
560 }%
561 {% full style
562 \renewcommand*{\DTMdisplay}[9]{%
563 \ifDTMshowdate
564 \DTMdisplaydate{##1}{##2}{##3}{##4}%
565 \DTMczechdatetimesep
566 \fi
567 \DTMdisplaytime{##5}{##6}{##7}%
568 \ifDTMshowzone
569 \DTMczechtimezonesep
570 \DTMdisplayzone{##8}{##9}%
571 \fi
572 }%
573 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
574 }
575 % \end{macrocode}
576 %
577 %\begin{macro}{\DTMczechzonemaps}
578 % The time zone mappings are set through this command, which can be
579 % redefined if extra mappings are required or mappings need to be
580 % removed.
581 % \begin{macrocode}
582 \newcommand*{\DTMczechzonemaps}{%
583 \DTMdefzonemap{01}{00}{CET}%
584 \DTMdefzonemap{02}{00}{CEST}%
585 }
586 % \end{macrocode}
587 %\end{macro}
588
589 % Switch style according to the \opt{useregional} setting.
590 % \begin{macrocode}
591 \DTMifcaseregional
592 {}% do nothing
593 {\DTMsetstyle{czech}}
594 {\DTMsetstyle{czech-numeric}}
595 % \end{macrocode}
596 %
597 % Redefine \cs{dateczech} (or \cs{date}\meta{dialect}) to prevent
598 % \sty{babel} from resetting \cs{today}. (For this to work,
599 % \sty{babel} must already have been loaded if it's required.)
600 %\changes{1.1}{2018-03-19}{removed spurious space}
601 % \begin{macrocode}
602 \ifcsundef{date\CurrentTrackedDialect}
603 {%
604 \ifundef\dateczech
605 {% do nothing
606 }%
607 {%
608 \def\dateczech{%
609 \DTMifcaseregional
610 {}% do nothing
611 {\DTMsetstyle{czech}}%
612 {\DTMsetstyle{czech-numeric}}%
613 }%
614 }%
615 }%
616 {%
617 \csdef{date\CurrentTrackedDialect}{%
618 \DTMifcaseregional
619 {}% do nothing
620 {\DTMsetstyle{czech}}%
621 {\DTMsetstyle{czech-numeric}}%
622 }%
623 }%
624 % \end{macrocode}
625 %\iffalse
626 % \begin{macrocode}
627 %</datetime2-czech.ldf>
628 % \end{macrocode}
629 %\fi
630 %\Finale
631 \endinput