Debian Codegraph @

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