Debian Codegraph @

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