Debian Codegraph @

texmf-dist/source/latex/datetime2-breton/datetime2-breton.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[utf8]{inputenc}
32 \usepackage[T1]{fontenc}
33 \usepackage[colorlinks,
34 bookmarks,
35 hyperindex=false,
36 pdfauthor={Nicola L.C. Talbot},
37 pdftitle={datetime2.sty Breton Module}]{hyperref}
38
39
40 \CheckSum{252}
41
42 \renewcommand*{\usage}[1]{\hyperpage{#1}}
43 \renewcommand*{\main}[1]{\hyperpage{#1}}
44 \IndexPrologue{\section*{\indexname}\markboth{\indexname}{\indexname}}
45 \setcounter{IndexColumns}{2}
46
47 \newcommand*{\sty}[1]{\textsf{#1}}
48 \newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}|main}}
49
50 \RecordChanges
51 \PageIndex
52 \CodelineNumbered
53
54 \begin{document}
55 \DocInput{datetime2-breton.dtx}
56 \end{document}
57 %</driver>
58 %\fi
59 %
60 %\MakeShortVerb{"}
61 %
62 %\title{Breton Module for datetime2 Package}
63 %\author{Nicola L. C. Talbot (inactive)}
64 %\date{2019-11-05 (v1.2)}
65 %\maketitle
66 %
67 %This module is currently unmaintained and may be subject to change.
68 %If you want to volunteer to take over maintenance, contact me at
69 %\url{http://www.dickimaw-books.com/contact.html}
70 %
71 %\begin{abstract}
72 %This is the Breton language module for the \sty{datetime2}
73 %package. If you want to use the settings in this module you must
74 %install it in addition to installing \sty{datetime2}. If you use
75 %\sty{babel} or \sty{polyglossia}, you will need this module to
76 %prevent them from redefining \cs{today}. The \sty{datetime2}
77 % \opt{useregional} setting must be set to "text" or "numeric"
78 % for the language styles to be set.
79 % Alternatively, you can set the style in the document using
80 % \cs{DTMsetstyle}, but this may be changed by \cs{date}\meta{language}
81 % depending on the value of the \opt{useregional} setting.
82 %\end{abstract}
83 %
84 %I've copied the date style from \texttt{babel-breton}'s \cs{today}.
85 %
86 %I don't know if these settings are correct as I can't speak Breton.
87 %In particular, I don't know if the "breton" time style is
88 %correct. Currently this just uses the "default" time style. Please
89 %be aware that this may change. Whoever takes over maintenance
90 %of this module may change it as appropriate.
91 %
92 %The new maintainer should add the line:
93 %\begin{verbatim}
94 % The Current Maintainer of this work is Name.
95 %\end{verbatim}
96 %to the preamble part in \texttt{datetime2-breton.ins} where Name
97 %is the name of the maintainer(s) and replace
98 %the `inactive' status to `maintained'.
99 %
100 %Currently there is only a regionless style.
101 %
102 %\StopEventually{%
103 %\clearpage
104 %\phantomsection
105 %\addcontentsline{toc}{section}{Change History}%
106 %\PrintChanges
107 %\addcontentsline{toc}{section}{\indexname}%
108 %\PrintIndex}
109 %\section{The Code}
110 %\iffalse
111 % \begin{macrocode}
112 %<*datetime2-breton-utf8.ldf>
113 % \end{macrocode}
114 %\fi
115 %\subsection{UTF-8}
116 %This file contains the settings that use UTF-8 characters. This
117 %file is loaded if XeLaTeX or LuaLaTeX are used. Please make sure
118 %your text editor is set to UTF-8 if you want to view this code.
119 %\changes{1.0}{2015-03-29}{Initial release}
120 % Identify module
121 % \begin{macrocode}
122 \ProvidesDateTimeModule{breton-utf8}[2019/11/05 v1.2]
123 % \end{macrocode}
124 %\begin{macro}{\DTMbretonordinal}
125 % \begin{macrocode}
126 \newcommand*{\DTMbretonordinal}[1]{%
127 \number#1
128 \ifnum#1=1
129 \DTMbretonfmtordinal{aƱ}%
130 \fi
131 }
132 % \end{macrocode}
133 %\end{macro}
134 %
135 %\begin{macro}{\DTMbretonfmtordinal}
136 % \begin{macrocode}
137 \newcommand*{\DTMbretonfmtordinal}[1]{%
138 \DTMtexorpdfstring{\protect\/\protect\textsuperscript{#1}}{#1}%
139 }
140 % \end{macrocode}
141 %\end{macro}
142 %
143 %\begin{macro}{\DTMbretonmonthname}
144 % Breton month names.
145 % \begin{macrocode}
146 \newcommand*{\DTMbretonmonthname}[1]{%
147 \ifcase#1
148 \or
149 Genver%
150 \or
151 C'hwevrer%
152 \or
153 Meurzh%
154 \or
155 Ebrel%
156 \or
157 Mae%
158 \or
159 Mezheven%
160 \or
161 Gouere%
162 \or
163 Eost%
164 \or
165 Gwengolo%
166 \or
167 Here%
168 \or
169 Du%
170 \or
171 Kerzu%
172 \fi
173 }
174 % \end{macrocode}
175 %\end{macro}
176 %
177 %If abbreviated dates are supported, short month names should be
178 %likewise provided.
179 %
180 %\iffalse
181 % \begin{macrocode}
182 %</datetime2-breton-utf8.ldf>
183 % \end{macrocode}
184 %\fi
185 %\iffalse
186 % \begin{macrocode}
187 %<*datetime2-breton-ascii.ldf>
188 % \end{macrocode}
189 %\fi
190 %\subsection{ASCII}
191 %This file contains the settings that use \LaTeX\ commands for
192 %non-ASCII characters. This should be input if neither XeLaTeX nor
193 %LuaLaTeX are used. Even if the user has loaded \sty{inputenc} with
194 %"utf8", this file should still be used not the
195 %\texttt{datetime2-breton-utf8.ldf} file as the non-ASCII
196 %characters are made active in that situation and would need
197 %protecting against expansion.
198 %\changes{1.0}{2015-03-29}{Initial release}
199 % Identify module
200 % \begin{macrocode}
201 \ProvidesDateTimeModule{breton-ascii}[2019/11/05 v1.2]
202 % \end{macrocode}
203 %
204 %If abbreviated dates are supported, short month names should be
205 %likewise provided.
206 %\begin{macro}{\DTMbretonordinal}
207 % \begin{macrocode}
208 \newcommand*{\DTMbretonordinal}[1]{%
209 \number#1
210 \ifnum#1=1
211 \DTMbretonfmtordsuffix{a\protect\~{n}}%
212 \fi
213 }
214 % \end{macrocode}
215 %\end{macro}
216 %
217 %\begin{macro}{\DTMbretonfmtordsuffix}
218 % \begin{macrocode}
219 \newcommand*{\DTMbretonfmtordsuffix}[1]{%
220 \DTMtexorpdfstring{\protect\/\protect\textsuperscript{#1}}{#1}%
221 }
222 % \end{macrocode}
223 %\end{macro}
224 %
225 %\begin{macro}{\DTMbretonmonthname}
226 % Breton month names.
227 % \begin{macrocode}
228 \newcommand*{\DTMbretonmonthname}[1]{%
229 \ifcase#1
230 \or
231 Genver%
232 \or
233 C'hwevrer%
234 \or
235 Meurzh%
236 \or
237 Ebrel%
238 \or
239 Mae%
240 \or
241 Mezheven%
242 \or
243 Gouere%
244 \or
245 Eost%
246 \or
247 Gwengolo%
248 \or
249 Here%
250 \or
251 Du%
252 \or
253 Kerzu%
254 \fi
255 }
256 % \end{macrocode}
257 %\end{macro}
258 %
259 %\iffalse
260 % \begin{macrocode}
261 %</datetime2-breton-ascii.ldf>
262 % \end{macrocode}
263 %\fi
264 %
265 %\subsection{Main Breton Module (\texttt{datetime2-breton.ldf})}
266 %\changes{1.0}{2015-03-29}{Initial release}
267 %
268 %\iffalse
269 % \begin{macrocode}
270 %<*datetime2-breton.ldf>
271 % \end{macrocode}
272 %\fi
273 %
274 % Identify Module
275 % \begin{macrocode}
276 \ProvidesDateTimeModule{breton}[2019/11/05 v1.2]
277 % \end{macrocode}
278 % Need to find out if XeTeX or LuaTeX are being used.
279 % \begin{macrocode}
280 \RequirePackage{ifxetex,ifluatex}
281 % \end{macrocode}
282 % XeTeX and LuaTeX natively support UTF-8, so load
283 % \texttt{breton-utf8} if either of those engines are used
284 % otherwise load \texttt{breton-ascii}.
285 % \begin{macrocode}
286 \ifxetex
287 \RequireDateTimeModule{breton-utf8}
288 \else
289 \ifluatex
290 \RequireDateTimeModule{breton-utf8}
291 \else
292 \RequireDateTimeModule{breton-ascii}
293 \fi
294 \fi
295 % \end{macrocode}
296 %
297 % Define the \texttt{breton} style.
298 % The time style is the same as the "default" style
299 % provided by \sty{datetime2}. This may need correcting. For
300 % example, if a 12 hour style similar to the "englishampm" (from the
301 % "english-base" module) is required.
302 %
303 % Allow the user a way of configuring the "breton" and
304 % "breton-numeric" styles. This doesn't use the package wide
305 % separators such as
306 % \cs{dtm@datetimesep} in case other date formats are also required.
307 %\begin{macro}{\DTMbretondaymonthsep}
308 % The separator between the day and month for the text format.
309 % \begin{macrocode}
310 \newcommand*{\DTMbretondaymonthsep}{\space a\space viz\space}
311 % \end{macrocode}
312 %\end{macro}
313 %
314 %\begin{macro}{\DTMbretonmonthyearsep}
315 % The separator between the month and year for the text format.
316 % \begin{macrocode}
317 \newcommand*{\DTMbretonmonthyearsep}{\space}
318 % \end{macrocode}
319 %\end{macro}
320 %
321 %\begin{macro}{\DTMbretondatetimesep}
322 % The separator between the date and time blocks in the full format
323 % (either text or numeric).
324 % \begin{macrocode}
325 \newcommand*{\DTMbretondatetimesep}{\space}
326 % \end{macrocode}
327 %\end{macro}
328 %
329 %\begin{macro}{\DTMbretontimezonesep}
330 % The separator between the time and zone blocks in the full format
331 % (either text or numeric).
332 % \begin{macrocode}
333 \newcommand*{\DTMbretontimezonesep}{\space}
334 % \end{macrocode}
335 %\end{macro}
336 %
337 %\begin{macro}{\DTMbretondatesep}
338 % The separator for the numeric date format.
339 % \begin{macrocode}
340 \newcommand*{\DTMbretondatesep}{/}
341 % \end{macrocode}
342 %\end{macro}
343 %
344 %\begin{macro}{\DTMbretontimesep}
345 % The separator for the numeric time format.
346 % \begin{macrocode}
347 \newcommand*{\DTMbretontimesep}{:}
348 % \end{macrocode}
349 %\end{macro}
350 %
351 %Provide keys that can be used in \cs{DTMlangsetup} to set these
352 %separators.
353 % \begin{macrocode}
354 \DTMdefkey{breton}{daymonthsep}{\renewcommand*{\DTMbretondaymonthsep}{#1}}
355 \DTMdefkey{breton}{monthyearsep}{\renewcommand*{\DTMbretonmonthyearsep}{#1}}
356 \DTMdefkey{breton}{datetimesep}{\renewcommand*{\DTMbretondatetimesep}{#1}}
357 \DTMdefkey{breton}{timezonesep}{\renewcommand*{\DTMbretontimezonesep}{#1}}
358 \DTMdefkey{breton}{datesep}{\renewcommand*{\DTMbretondatesep}{#1}}
359 \DTMdefkey{breton}{timesep}{\renewcommand*{\DTMbretontimesep}{#1}}
360 % \end{macrocode}
361 %
362 % Define a setting to change the ordinal suffix style.
363 %\changes{1.2}{2019-11-05}{renamed scratch variables to avoid conflict}
364 % \begin{macrocode}
365 \DTMdefchoicekey{breton}{ord}[\@dtm@val\@dtm@nr]{level,raise,omit,sc}{%
366 \ifcase\@dtm@nr\relax
367 \renewcommand*{\DTMbretonfmtordsuffix}[1]{##1}%
368 \or
369 \renewcommand*{\DTMbretonfmtordsuffix}[1]{%
370 \DTMtexorpdfstring{\protect\textsuperscript{##1}}{##1}}%
371 \or
372 \renewcommand*{\DTMbretonfmtordsuffix}[1]{}%
373 \or
374 \renewcommand*{\DTMbretonfmtordsuffix}[1]{%
375 \DTMtexorpdfstring{\protect\textsc{##1}}{##1}}%
376 \fi
377 }
378 % \end{macrocode}
379 %
380 % TODO: provide a boolean key to switch between full and abbreviated
381 % formats if appropriate. (I don't know how the date should be
382 % abbreviated.)
383 %
384 % Define a boolean key that determines if the time zone mappings
385 % should be used.
386 % \begin{macrocode}
387 \DTMdefboolkey{breton}{mapzone}[true]{}
388 % \end{macrocode}
389 % The default is to use mappings.
390 % \begin{macrocode}
391 \DTMsetbool{breton}{mapzone}{true}
392 % \end{macrocode}
393 %
394 % Define a boolean key that determines if the day of month should be
395 % displayed.
396 % \begin{macrocode}
397 \DTMdefboolkey{breton}{showdayofmonth}[true]{}
398 % \end{macrocode}
399 % The default is to show the day of month.
400 % \begin{macrocode}
401 \DTMsetbool{breton}{showdayofmonth}{true}
402 % \end{macrocode}
403 %
404 % Define a boolean key that determines if the year should be
405 % displayed.
406 % \begin{macrocode}
407 \DTMdefboolkey{breton}{showyear}[true]{}
408 % \end{macrocode}
409 % The default is to show the year.
410 % \begin{macrocode}
411 \DTMsetbool{breton}{showyear}{true}
412 % \end{macrocode}
413 %
414 % Define the "breton" style. (TODO: implement day of week?)
415 % \begin{macrocode}
416 \DTMnewstyle
417 {breton}% label
418 {% date style
419 \renewcommand*\DTMdisplaydate[4]{%
420 \DTMifbool{breton}{showdayofmonth}
421 {\DTMbretonordinal{##3}\DTMbretondaymonthsep}%
422 {}%
423 \DTMbretonmonthname{##2}%
424 \DTMifbool{breton}{showyear}%
425 {%
426 \DTMbretonmonthyearsep
427 \number##1 % space intended
428 }%
429 {}%
430 }%
431 \renewcommand*\DTMDisplaydate{\DTMdisplaydate}%
432 }%
433 {% time style (use default)
434 \DTMsettimestyle{default}%
435 }%
436 {% zone style
437 \DTMresetzones
438 \DTMbretonzonemaps
439 \renewcommand*{\DTMdisplayzone}[2]{%
440 \DTMifbool{breton}{mapzone}%
441 {\DTMusezonemapordefault{##1}{##2}}%
442 {%
443 \ifnum##1<0 \else+\fi\DTMtwodigits{##1}%
444 \ifDTMshowzoneminutes\DTMbretontimesep\DTMtwodigits{##2}\fi
445 }%
446 }%
447 }%
448 {% full style
449 \renewcommand*{\DTMdisplay}[9]{%
450 \ifDTMshowdate
451 \DTMdisplaydate{##1}{##2}{##3}{##4}%
452 \DTMbretondatetimesep
453 \fi
454 \DTMdisplaytime{##5}{##6}{##7}%
455 \ifDTMshowzone
456 \DTMbretontimezonesep
457 \DTMdisplayzone{##8}{##9}%
458 \fi
459 }%
460 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
461 }%
462 % \end{macrocode}
463 %
464 % Define numeric style.
465 % \begin{macrocode}
466 \DTMnewstyle
467 {breton-numeric}% label
468 {% date style
469 \renewcommand*\DTMdisplaydate[4]{%
470 \DTMifbool{breton}{showdayofmonth}%
471 {%
472 \number##3 % space intended
473 \DTMbretondatesep
474 }%
475 {}%
476 \number##2 % space intended
477 \DTMifbool{breton}{showyear}%
478 {%
479 \DTMbretondatesep
480 \number##1 % space intended
481 }%
482 {}%
483 }%
484 \renewcommand*{\DTMDisplaydate}[4]{\DTMdisplaydate{##1}{##2}{##3}{##4}}%
485 }%
486 {% time style
487 \renewcommand*\DTMdisplaytime[3]{%
488 \number##1 % space intended
489 \DTMbretontimesep\DTMtwodigits{##2}%
490 \ifDTMshowseconds\DTMbretontimesep\DTMtwodigits{##3}\fi
491 }%
492 }%
493 {% zone style
494 \DTMresetzones
495 \DTMbretonzonemaps
496 \renewcommand*{\DTMdisplayzone}[2]{%
497 \DTMifbool{breton}{mapzone}%
498 {\DTMusezonemapordefault{##1}{##2}}%
499 {%
500 \ifnum##1<0 \else+\fi\DTMtwodigits{##1}%
501 \ifDTMshowzoneminutes\DTMbretontimesep\DTMtwodigits{##2}\fi
502 }%
503 }%
504 }%
505 {% full style
506 \renewcommand*{\DTMdisplay}[9]{%
507 \ifDTMshowdate
508 \DTMdisplaydate{##1}{##2}{##3}{##4}%
509 \DTMbretondatetimesep
510 \fi
511 \DTMdisplaytime{##5}{##6}{##7}%
512 \ifDTMshowzone
513 \DTMbretontimezonesep
514 \DTMdisplayzone{##8}{##9}%
515 \fi
516 }%
517 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
518 }
519 % \end{macrocode}
520 %
521 %\begin{macro}{\DTMbretonzonemaps}
522 % The time zone mappings are set through this command, which can be
523 % redefined if extra mappings are required or mappings need to be
524 % removed.
525 % \begin{macrocode}
526 \newcommand*{\DTMbretonzonemaps}{%
527 \DTMdefzonemap{01}{00}{CET}%
528 \DTMdefzonemap{02}{00}{CEST}%
529 }
530 % \end{macrocode}
531 %\end{macro}
532
533 % Switch style according to the \opt{useregional} setting.
534 % \begin{macrocode}
535 \DTMifcaseregional
536 {}% do nothing
537 {\DTMsetstyle{breton}}
538 {\DTMsetstyle{breton-numeric}}
539 % \end{macrocode}
540 %
541 % Redefine \cs{datebreton} (or \cs{date}\meta{dialect}) to prevent
542 % \sty{babel} from resetting \cs{today}. (For this to work,
543 % \sty{babel} must already have been loaded if it's required.)
544 %\changes{1.1}{2018-03-19}{removed spurious space}
545 % \begin{macrocode}
546 \ifcsundef{date\CurrentTrackedDialect}
547 {%
548 \ifundef\datebreton
549 {% do nothing
550 }%
551 {%
552 \def\datebreton{%
553 \DTMifcaseregional
554 {}% do nothing
555 {\DTMsetstyle{breton}}%
556 {\DTMsetstyle{breton-numeric}}%
557 }%
558 }%
559 }%
560 {%
561 \csdef{date\CurrentTrackedDialect}{%
562 \DTMifcaseregional
563 {}% do nothing
564 {\DTMsetstyle{breton}}%
565 {\DTMsetstyle{breton-numeric}}%
566 }%
567 }%
568 % \end{macrocode}
569 %\iffalse
570 % \begin{macrocode}
571 %</datetime2-breton.ldf>
572 % \end{macrocode}
573 %\fi
574 %\Finale
575 \endinput