Debian Codegraph @

texmf-dist/source/latex/datetime2-slovak/datetime2-slovak.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) 2015-2019 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 Slovak Module}]{hyperref}
37
38 \setmainfont{Liberation Serif}
39 \setmonofont{Liberation Mono}
40
41 \CheckSum{285}
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-slovak.dtx}
57 \end{document}
58 %</driver>
59 %\fi
60 %
61 %\MakeShortVerb{"}
62 %
63 %\title{Slovak Module for datetime2 Package}
64 %\author{Nicola L. C. Talbot (inactive)}
65 %\date{2019-10-04 (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 maintenance, contact me at
70 %\url{http://www.dickimaw-books.com/contact.html}
71 %
72 %\begin{abstract}
73 %This is the Slovak 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-slovak}'s \cs{today}.
86 %
87 %I don't know if these settings are correct as I can't speak Slovak.
88 %In particular, I don't know if the "slovak" 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-slovak.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-slovak-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-04-01}{Initial release}
121 % Identify module
122 % \begin{macrocode}
123 \ProvidesDateTimeModule{slovak-utf8}[2019/10/04 v1.1]
124 % \end{macrocode}
125 %\begin{macro}{\DTMslovakordinal}
126 % \begin{macrocode}
127 \newcommand*{\DTMslovakordinal}[1]{%
128 \number#1.%
129 }
130 % \end{macrocode}
131 %\end{macro}
132 %
133 %\begin{macro}{\DTMslovakmonthname}
134 % Slovak month names.
135 % \begin{macrocode}
136 \newcommand*{\DTMslovakmonthname}[1]{%
137 \ifcase#1
138 \or
139 januára%
140 \or
141 februára%
142 \or
143 marca%
144 \or
145 apríla%
146 \or
147 mája%
148 \or
149 júna%
150 \or
151 júla%
152 \or
153 augusta%
154 \or
155 septembra%
156 \or
157 októbra%
158 \or
159 novembra%
160 \or
161 decembra%
162 \fi
163 }
164 % \end{macrocode}
165 %\end{macro}
166 %
167 %\begin{macro}{\DTMslovakMonthname}
168 % As above but capitalize.
169 % \begin{macrocode}
170 \newcommand*{\DTMslovakMonthname}[1]{%
171 \ifcase#1
172 \or
173 Januára%
174 \or
175 Februára%
176 \or
177 Marca%
178 \or
179 Apríla%
180 \or
181 Mája%
182 \or
183 Júna%
184 \or
185 Júla%
186 \or
187 Augusta%
188 \or
189 Septembra%
190 \or
191 Októbra%
192 \or
193 Novembra%
194 \or
195 Decembra%
196 \fi
197 }
198 % \end{macrocode}
199 %\end{macro}
200 %
201 %If abbreviated dates are supported, short month names should be
202 %likewise provided.
203 %
204 %\iffalse
205 % \begin{macrocode}
206 %</datetime2-slovak-utf8.ldf>
207 % \end{macrocode}
208 %\fi
209 %\iffalse
210 % \begin{macrocode}
211 %<*datetime2-slovak-ascii.ldf>
212 % \end{macrocode}
213 %\fi
214 %\subsection{ASCII}
215 %This file contains the settings that use \LaTeX\ commands for
216 %non-ASCII characters. This should be input if neither XeLaTeX nor
217 %LuaLaTeX are used. Even if the user has loaded \sty{inputenc} with
218 %"utf8", this file should still be used not the
219 %\texttt{datetime2-slovak-utf8.ldf} file as the non-ASCII
220 %characters are made active in that situation and would need
221 %protecting against expansion.
222 %\changes{1.0}{2015-04-01}{Initial release}
223 % Identify module
224 % \begin{macrocode}
225 \ProvidesDateTimeModule{slovak-ascii}[2019/10/04 v1.1]
226 % \end{macrocode}
227 %
228 %If abbreviated dates are supported, short month names should be
229 %likewise provided.
230 %\begin{macro}{\DTMslovakordinal}
231 % \begin{macrocode}
232 \newcommand*{\DTMslovakordinal}[1]{%
233 \number#1.%
234 }
235 % \end{macrocode}
236 %\end{macro}
237 %
238 %\begin{macro}{\DTMslovakmonthname}
239 % Slovak month names.
240 % \begin{macrocode}
241 \newcommand*{\DTMslovakmonthname}[1]{%
242 \ifcase#1
243 \or
244 janu\protect\'ara%
245 \or
246 febru\protect\'ara%
247 \or
248 marca%
249 \or
250 apr\protect\'{\protect\i}la%
251 \or
252 m\protect\'aja%
253 \or
254 j\protect\'una%
255 \or
256 j\protect\'ula%
257 \or
258 augusta%
259 \or
260 septembra%
261 \or
262 okt\protect\'obra%
263 \or
264 novembra%
265 \or
266 decembra%
267 \fi
268 }
269 % \end{macrocode}
270 %\end{macro}
271 %
272 %\begin{macro}{\DTMslovakMonthname}
273 % As above but capitalize.
274 % \begin{macrocode}
275 \newcommand*{\DTMslovakMonthname}[1]{%
276 \ifcase#1
277 \or
278 Janu\protect\'ara%
279 \or
280 Febru\protect\'ara%
281 \or
282 Marca%
283 \or
284 Apr\protect\'{\protect\i}la%
285 \or
286 M\protect\'aja%
287 \or
288 J\protect\'una%
289 \or
290 J\protect\'ula%
291 \or
292 Augusta%
293 \or
294 Septembra%
295 \or
296 Okt\protect\'obra%
297 \or
298 Novembra%
299 \or
300 Decembra%
301 \fi
302 }
303 % \end{macrocode}
304 %\end{macro}
305 %
306 %
307 %\iffalse
308 % \begin{macrocode}
309 %</datetime2-slovak-ascii.ldf>
310 % \end{macrocode}
311 %\fi
312 %
313 %\subsection{Main Slovak Module (\texttt{datetime2-slovak.ldf})}
314 %\changes{1.0}{2015-04-01}{Initial release}
315 %
316 %\iffalse
317 % \begin{macrocode}
318 %<*datetime2-slovak.ldf>
319 % \end{macrocode}
320 %\fi
321 %
322 % Identify Module
323 % \begin{macrocode}
324 \ProvidesDateTimeModule{slovak}[2019/10/04 v1.1]
325 % \end{macrocode}
326 % Need to find out if XeTeX or LuaTeX are being used.
327 % \begin{macrocode}
328 \RequirePackage{ifxetex,ifluatex}
329 % \end{macrocode}
330 % XeTeX and LuaTeX natively support UTF-8, so load
331 % \texttt{slovak-utf8} if either of those engines are used
332 % otherwise load \texttt{slovak-ascii}.
333 % \begin{macrocode}
334 \ifxetex
335 \RequireDateTimeModule{slovak-utf8}
336 \else
337 \ifluatex
338 \RequireDateTimeModule{slovak-utf8}
339 \else
340 \RequireDateTimeModule{slovak-ascii}
341 \fi
342 \fi
343 % \end{macrocode}
344 %
345 % Define the \texttt{slovak} style.
346 % The time style is the same as the "default" style
347 % provided by \sty{datetime2}. This may need correcting. For
348 % example, if a 12 hour style similar to the "englishampm" (from the
349 % "english-base" module) is required.
350 %
351 % Allow the user a way of configuring the "slovak" and
352 % "slovak-numeric" styles. This doesn't use the package wide
353 % separators such as
354 % \cs{dtm@datetimesep} in case other date formats are also required.
355 %\begin{macro}{\DTMslovakdaymonthsep}
356 % The separator between the day and month for the text format.
357 % \begin{macrocode}
358 \newcommand*{\DTMslovakdaymonthsep}{%
359 \DTMtexorpdfstring{\protect~}{\space}}
360 % \end{macrocode}
361 %\end{macro}
362 %
363 %\begin{macro}{\DTMslovakmonthyearsep}
364 % The separator between the month and year for the text format.
365 % \begin{macrocode}
366 \newcommand*{\DTMslovakmonthyearsep}{\space}
367 % \end{macrocode}
368 %\end{macro}
369 %
370 %\begin{macro}{\DTMslovakdatetimesep}
371 % The separator between the date and time blocks in the full format
372 % (either text or numeric).
373 % \begin{macrocode}
374 \newcommand*{\DTMslovakdatetimesep}{\space}
375 % \end{macrocode}
376 %\end{macro}
377 %
378 %\begin{macro}{\DTMslovaktimezonesep}
379 % The separator between the time and zone blocks in the full format
380 % (either text or numeric).
381 % \begin{macrocode}
382 \newcommand*{\DTMslovaktimezonesep}{\space}
383 % \end{macrocode}
384 %\end{macro}
385 %
386 %\begin{macro}{\DTMslovakdatesep}
387 % The separator for the numeric date format.
388 % \begin{macrocode}
389 \newcommand*{\DTMslovakdatesep}{.}
390 % \end{macrocode}
391 %\end{macro}
392 %
393 %\begin{macro}{\DTMslovaktimesep}
394 % The separator for the numeric time format.
395 % \begin{macrocode}
396 \newcommand*{\DTMslovaktimesep}{:}
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{slovak}{daymonthsep}{\renewcommand*{\DTMslovakdaymonthsep}{#1}}
404 \DTMdefkey{slovak}{monthyearsep}{\renewcommand*{\DTMslovakmonthyearsep}{#1}}
405 \DTMdefkey{slovak}{datetimesep}{\renewcommand*{\DTMslovakdatetimesep}{#1}}
406 \DTMdefkey{slovak}{timezonesep}{\renewcommand*{\DTMslovaktimezonesep}{#1}}
407 \DTMdefkey{slovak}{datesep}{\renewcommand*{\DTMslovakdatesep}{#1}}
408 \DTMdefkey{slovak}{timesep}{\renewcommand*{\DTMslovaktimesep}{#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{slovak}{mapzone}[true]{}
419 % \end{macrocode}
420 % The default is to use mappings.
421 % \begin{macrocode}
422 \DTMsetbool{slovak}{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{slovak}{showdayofmonth}[true]{}
429 % \end{macrocode}
430 % The default is to show the day of month.
431 % \begin{macrocode}
432 \DTMsetbool{slovak}{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{slovak}{showyear}[true]{}
439 % \end{macrocode}
440 % The default is to show the year.
441 % \begin{macrocode}
442 \DTMsetbool{slovak}{showyear}{true}
443 % \end{macrocode}
444 %
445 % Define the "slovak" style. (TODO: implement day of week?)
446 % \begin{macrocode}
447 \DTMnewstyle
448 {slovak}% label
449 {% date style
450 \renewcommand*\DTMdisplaydate[4]{%
451 \DTMifbool{slovak}{showdayofmonth}
452 {%
453 \DTMslovakordinal{##3}%
454 \DTMslovakdaymonthsep
455 }%
456 {}%
457 \DTMslovakmonthname{##2}%
458 \DTMifbool{slovak}{showyear}%
459 {%
460 \DTMslovakmonthyearsep
461 \number##1 % space intended
462 }%
463 {}%
464 }%
465 \renewcommand*\DTMDisplaydate[4]{%
466 \DTMifbool{slovak}{showdayofmonth}
467 {%
468 \DTMslovakordinal{##3}%
469 \DTMslovakdaymonthsep
470 \DTMslovakmonthname{##2}%
471 }%
472 {%
473 \DTMslovakMonthname{##2}%
474 }%
475 \DTMifbool{slovak}{showyear}%
476 {%
477 \DTMslovakmonthyearsep
478 \number##1 % space intended
479 }%
480 {}%
481 }%
482 }%
483 {% time style (use default)
484 \DTMsettimestyle{default}%
485 }%
486 {% zone style
487 \DTMresetzones
488 \DTMslovakzonemaps
489 \renewcommand*{\DTMdisplayzone}[2]{%
490 \DTMifbool{slovak}{mapzone}%
491 {\DTMusezonemapordefault{##1}{##2}}%
492 {%
493 \ifnum##1<0 \else+\fi\DTMtwodigits{##1}%
494 \ifDTMshowzoneminutes\DTMslovaktimesep\DTMtwodigits{##2}\fi
495 }%
496 }%
497 }%
498 {% full style
499 \renewcommand*{\DTMdisplay}[9]{%
500 \ifDTMshowdate
501 \DTMdisplaydate{##1}{##2}{##3}{##4}%
502 \DTMslovakdatetimesep
503 \fi
504 \DTMdisplaytime{##5}{##6}{##7}%
505 \ifDTMshowzone
506 \DTMslovaktimezonesep
507 \DTMdisplayzone{##8}{##9}%
508 \fi
509 }%
510 \renewcommand*{\DTMDisplay}[9]{%
511 \ifDTMshowdate
512 \DTMDisplaydate{##1}{##2}{##3}{##4}%
513 \DTMslovakdatetimesep
514 \fi
515 \DTMdisplaytime{##5}{##6}{##7}%
516 \ifDTMshowzone
517 \DTMslovaktimezonesep
518 \DTMdisplayzone{##8}{##9}%
519 \fi
520 }%
521 }%
522 % \end{macrocode}
523 %
524 % Define numeric style.
525 % \begin{macrocode}
526 \DTMnewstyle
527 {slovak-numeric}% label
528 {% date style
529 \renewcommand*\DTMdisplaydate[4]{%
530 \DTMifbool{slovak}{showdayofmonth}%
531 {%
532 \number##3 % space intended
533 \DTMslovakdatesep
534 }%
535 {}%
536 \number##2 % space intended
537 \DTMifbool{slovak}{showyear}%
538 {%
539 \DTMslovakdatesep
540 \number##1 % space intended
541 }%
542 {}%
543 }%
544 \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
545 }%
546 {% time style
547 \renewcommand*\DTMdisplaytime[3]{%
548 \number##1 % space intended
549 \DTMslovaktimesep\DTMtwodigits{##2}%
550 \ifDTMshowseconds\DTMslovaktimesep\DTMtwodigits{##3}\fi
551 }%
552 }%
553 {% zone style
554 \DTMresetzones
555 \DTMslovakzonemaps
556 \renewcommand*{\DTMdisplayzone}[2]{%
557 \DTMifbool{slovak}{mapzone}%
558 {\DTMusezonemapordefault{##1}{##2}}%
559 {%
560 \ifnum##1<0 \else+\fi\DTMtwodigits{##1}%
561 \ifDTMshowzoneminutes\DTMslovaktimesep\DTMtwodigits{##2}\fi
562 }%
563 }%
564 }%
565 {% full style
566 \renewcommand*{\DTMdisplay}[9]{%
567 \ifDTMshowdate
568 \DTMdisplaydate{##1}{##2}{##3}{##4}%
569 \DTMslovakdatetimesep
570 \fi
571 \DTMdisplaytime{##5}{##6}{##7}%
572 \ifDTMshowzone
573 \DTMslovaktimezonesep
574 \DTMdisplayzone{##8}{##9}%
575 \fi
576 }%
577 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
578 }
579 % \end{macrocode}
580 %
581 %\begin{macro}{\DTMslovakzonemaps}
582 % The time zone mappings are set through this command, which can be
583 % redefined if extra mappings are required or mappings need to be
584 % removed.
585 % \begin{macrocode}
586 \newcommand*{\DTMslovakzonemaps}{%
587 \DTMdefzonemap{01}{00}{CET}%
588 \DTMdefzonemap{02}{00}{CEST}%
589 }
590 % \end{macrocode}
591 %\end{macro}
592
593 % Switch style according to the \opt{useregional} setting.
594 % \begin{macrocode}
595 \DTMifcaseregional
596 {}% do nothing
597 {\DTMsetstyle{slovak}}%
598 {\DTMsetstyle{slovak-numeric}}
599 % \end{macrocode}
600 %
601 % Redefine \cs{dateslovak} (or \cs{date}\meta{dialect}) to prevent
602 % \sty{babel} from resetting \cs{today}. (For this to work,
603 % \sty{babel} must already have been loaded if it's required.)
604 %\changes{1.1}{2019-10-04}{removed spurious space}
605 % \begin{macrocode}
606 \ifcsundef{date\CurrentTrackedDialect}
607 {%
608 \ifundef\dateslovak
609 {% do nothing
610 }%
611 {%
612 \def\dateslovak{%
613 \DTMifcaseregional
614 {}% do nothing
615 {\DTMsetstyle{slovak}}%
616 {\DTMsetstyle{slovak-numeric}}%
617 }%
618 }%
619 }%
620 {%
621 \csdef{date\CurrentTrackedDialect}{%
622 \DTMifcaseregional
623 {}% do nothing
624 {\DTMsetstyle{slovak}}%
625 {\DTMsetstyle{slovak-numeric}}%
626 }%
627 }%
628 % \end{macrocode}
629 %\iffalse
630 % \begin{macrocode}
631 %</datetime2-slovak.ldf>
632 % \end{macrocode}
633 %\fi
634 %\Finale
635 \endinput