Debian Codegraph @

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