Debian Codegraph @

texmf-dist/source/latex/datetime2-greek/datetime2-greek.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 Greek Module}]{hyperref}
37
38 \newfontfamily\greekfont{Liberation Serif}
39 \setmonofont{Liberation Mono}
40
41 \CheckSum{230}
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-greek.dtx}
57 \end{document}
58 %</driver>
59 %\fi
60 %
61 %\MakeShortVerb{"}
62 %
63 %\title{Greek Module for datetime2 Package}
64 %\author{Nicola L. C. Talbot (inactive)}
65 %\date{2018-04-18 (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 Greek 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-greek}'s \cs{today}.
86 %
87 %I don't know if these settings are correct as I can't speak Greek.
88 %In particular, I don't know if the "greek" 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-greek.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. There is currently no
102 %support for Ancient Greek.
103 %
104 %\StopEventually{%
105 %\clearpage
106 %\phantomsection
107 %\addcontentsline{toc}{section}{Change History}%
108 %\PrintChanges
109 %\addcontentsline{toc}{section}{\indexname}%
110 %\PrintIndex}
111 %\section{The Code}
112 %\iffalse
113 % \begin{macrocode}
114 %<*datetime2-greek-utf8.ldf>
115 % \end{macrocode}
116 %\fi
117 %\subsection{UTF-8}
118 %This file contains the settings that use UTF-8 characters. This
119 %file is loaded if XeLaTeX or LuaLaTeX are used. Please make sure
120 %your text editor is set to UTF-8 if you want to view this code.
121 %\changes{1.0}{2015-03-30}{Initial release}
122 % Identify module
123 % \begin{macrocode}
124 \ProvidesDateTimeModule{greek-utf8}[2018/04/18 v1.1]
125 % \end{macrocode}
126 %\begin{macro}{\DTMgreekordinal}
127 % \begin{macrocode}
128 \newcommand*{\DTMgreekordinal}[1]{%
129 \number#1
130 }
131 % \end{macrocode}
132 %\end{macro}
133 %
134 %
135 %\begin{macro}{\DTMgreekmonthname}
136 % Greek month names.
137 % \begin{macrocode}
138 \newcommand*{\DTMgreekmonthname}[1]{%
139 \ifcase#1
140 \or
141 Ιανουαρίου%
142 \or
143 Φεβρουαρίου%
144 \or
145 Μαρτίου%
146 \or
147 Απριλίου%
148 \or
149 Μαΐου%
150 \or
151 Ιουνίου%
152 \or
153 Ιουλίου%
154 \or
155 Αυγούστου%
156 \or
157 Σεπτεμβρίου%
158 \or
159 Οκτωβρίου%
160 \or
161 Νοεμβρίου%
162 \or
163 Δεκεμβρίου%
164 \fi
165 }
166 % \end{macrocode}
167 %\end{macro}
168 %
169 %
170 %If abbreviated dates are supported, short month names should be
171 %likewise provided.
172 %
173 %\iffalse
174 % \begin{macrocode}
175 %</datetime2-greek-utf8.ldf>
176 % \end{macrocode}
177 %\fi
178 %\iffalse
179 % \begin{macrocode}
180 %<*datetime2-greek-ascii.ldf>
181 % \end{macrocode}
182 %\fi
183 %\subsection{ASCII}
184 %This file contains the settings that use \LaTeX\ commands for
185 %non-ASCII characters. This should be input if neither XeLaTeX nor
186 %LuaLaTeX are used. Even if the user has loaded \sty{inputenc} with
187 %"utf8", this file should still be used not the
188 %\texttt{datetime2-greek-utf8.ldf} file as the non-ASCII
189 %characters are made active in that situation and would need
190 %protecting against expansion.
191 %\changes{1.0}{2015-03-30}{Initial release}
192 % Identify module
193 % \begin{macrocode}
194 \ProvidesDateTimeModule{greek-ascii}[2018/04/18 v1.1]
195 % \end{macrocode}
196 %
197 %If abbreviated dates are supported, short month names should be
198 %likewise provided.
199 %\begin{macro}{\DTMgreekordinal}
200 % \begin{macrocode}
201 \newcommand*{\DTMgreekordinal}[1]{%
202 \number#1
203 }
204 % \end{macrocode}
205 %\end{macro}
206 %
207 %\begin{macro}{\DTMgreekmonthname}
208 % Greek month names.
209 % \begin{macrocode}
210 \newcommand*{\DTMgreekmonthname}[1]{%
211 \ifcase#1
212 \or
213 Ianouar\protect\'iou%
214 \or
215 Febrouar\protect\'iou%
216 \or
217 Mart\protect\'iou%
218 \or
219 April\protect\'iou%
220 \or
221 Ma\protect\'{\protect\"i}ou%
222 \or
223 Ioun\protect\'iou%
224 \or
225 Ioul\protect\'iou%
226 \or
227 Augo\protect\'ustou%
228 \or
229 Septembr\protect\'iou%
230 \or
231 Oktwbr\protect\'iou%
232 \or
233 Noembr\protect\'iou%
234 \or
235 Dekembr\protect\'iou%
236 \fi
237 }
238 % \end{macrocode}
239 %\end{macro}
240 %
241 %\iffalse
242 % \begin{macrocode}
243 %</datetime2-greek-ascii.ldf>
244 % \end{macrocode}
245 %\fi
246 %
247 %\subsection{Main Greek Module (\texttt{datetime2-greek.ldf})}
248 %\changes{1.0}{2015-03-30}{Initial release}
249 %
250 %\iffalse
251 % \begin{macrocode}
252 %<*datetime2-greek.ldf>
253 % \end{macrocode}
254 %\fi
255 %
256 % Identify Module
257 % \begin{macrocode}
258 \ProvidesDateTimeModule{greek}[2018/04/18 v1.1]
259 % \end{macrocode}
260 % Need to find out if XeTeX or LuaTeX are being used.
261 % \begin{macrocode}
262 \RequirePackage{ifxetex,ifluatex}
263 % \end{macrocode}
264 % XeTeX and LuaTeX natively support UTF-8, so load
265 % \texttt{greek-utf8} if either of those engines are used
266 % otherwise load \texttt{greek-ascii}.
267 % \begin{macrocode}
268 \ifxetex
269 \RequireDateTimeModule{greek-utf8}
270 \else
271 \ifluatex
272 \RequireDateTimeModule{greek-utf8}
273 \else
274 \RequireDateTimeModule{greek-ascii}
275 \fi
276 \fi
277 % \end{macrocode}
278 %
279 % Define the \texttt{greek} style.
280 % The time style is the same as the "default" style
281 % provided by \sty{datetime2}. This may need correcting. For
282 % example, if a 12 hour style similar to the "englishampm" (from the
283 % "english-base" module) is required.
284 %
285 % Allow the user a way of configuring the "greek" and
286 % "greek-numeric" styles. This doesn't use the package wide
287 % separators such as
288 % \cs{dtm@datetimesep} in case other date formats are also required.
289 %\begin{macro}{\DTMgreekdaymonthsep}
290 % The separator between the day and month for the text format.
291 % \begin{macrocode}
292 \newcommand*{\DTMgreekdaymonthsep}{\space}
293 % \end{macrocode}
294 %\end{macro}
295 %
296 %\begin{macro}{\DTMgreekmonthyearsep}
297 % The separator between the month and year for the text format.
298 % \begin{macrocode}
299 \newcommand*{\DTMgreekmonthyearsep}{\space}
300 % \end{macrocode}
301 %\end{macro}
302 %
303 %\begin{macro}{\DTMgreekdatetimesep}
304 % The separator between the date and time blocks in the full format
305 % (either text or numeric).
306 % \begin{macrocode}
307 \newcommand*{\DTMgreekdatetimesep}{\space}
308 % \end{macrocode}
309 %\end{macro}
310 %
311 %\begin{macro}{\DTMgreektimezonesep}
312 % The separator between the time and zone blocks in the full format
313 % (either text or numeric).
314 % \begin{macrocode}
315 \newcommand*{\DTMgreektimezonesep}{\space}
316 % \end{macrocode}
317 %\end{macro}
318 %
319 %\begin{macro}{\DTMgreekdatesep}
320 % The separator for the numeric date format.
321 % \begin{macrocode}
322 \newcommand*{\DTMgreekdatesep}{.}
323 % \end{macrocode}
324 %\end{macro}
325 %
326 %\begin{macro}{\DTMgreektimesep}
327 % The separator for the numeric time format.
328 % \begin{macrocode}
329 \newcommand*{\DTMgreektimesep}{:}
330 % \end{macrocode}
331 %\end{macro}
332 %
333 %Provide keys that can be used in \cs{DTMlangsetup} to set these
334 %separators.
335 % \begin{macrocode}
336 \DTMdefkey{greek}{daymonthsep}{\renewcommand*{\DTMgreekdaymonthsep}{#1}}
337 \DTMdefkey{greek}{monthyearsep}{\renewcommand*{\DTMgreekmonthyearsep}{#1}}
338 \DTMdefkey{greek}{datetimesep}{\renewcommand*{\DTMgreekdatetimesep}{#1}}
339 \DTMdefkey{greek}{timezonesep}{\renewcommand*{\DTMgreektimezonesep}{#1}}
340 \DTMdefkey{greek}{datesep}{\renewcommand*{\DTMgreekdatesep}{#1}}
341 \DTMdefkey{greek}{timesep}{\renewcommand*{\DTMgreektimesep}{#1}}
342 % \end{macrocode}
343 %
344 % TODO: provide a boolean key to switch between full and abbreviated
345 % formats if appropriate. (I don't know how the date should be
346 % abbreviated.)
347 %
348 % Define a boolean key that determines if the time zone mappings
349 % should be used.
350 % \begin{macrocode}
351 \DTMdefboolkey{greek}{mapzone}[true]{}
352 % \end{macrocode}
353 % The default is to use mappings.
354 % \begin{macrocode}
355 \DTMsetbool{greek}{mapzone}{true}
356 % \end{macrocode}
357 %
358 % Define a boolean key that determines if the day of month should be
359 % displayed.
360 % \begin{macrocode}
361 \DTMdefboolkey{greek}{showdayofmonth}[true]{}
362 % \end{macrocode}
363 % The default is to show the day of month.
364 % \begin{macrocode}
365 \DTMsetbool{greek}{showdayofmonth}{true}
366 % \end{macrocode}
367 %
368 % Define a boolean key that determines if the year should be
369 % displayed.
370 % \begin{macrocode}
371 \DTMdefboolkey{greek}{showyear}[true]{}
372 % \end{macrocode}
373 % The default is to show the year.
374 % \begin{macrocode}
375 \DTMsetbool{greek}{showyear}{true}
376 % \end{macrocode}
377 %
378 % Define the "greek" style. (TODO: implement day of week?)
379 % \begin{macrocode}
380 \DTMnewstyle
381 {greek}% label
382 {% date style
383 \renewcommand*\DTMdisplaydate[4]{%
384 \DTMifbool{greek}{showdayofmonth}
385 {\DTMgreekordinal{##3}\DTMgreekdaymonthsep}%
386 {}%
387 \DTMgreekmonthname{##2}%
388 \DTMifbool{greek}{showyear}%
389 {%
390 \DTMgreekmonthyearsep
391 \number##1
392 }%
393 {}%
394 }%
395 \renewcommand*\DTMDisplaydate{\DTMdisplaydate}%
396 }%
397 {% time style (use default)
398 \DTMsettimestyle{default}%
399 }%
400 {% zone style
401 \DTMresetzones
402 \DTMgreekzonemaps
403 \renewcommand*{\DTMdisplayzone}[2]{%
404 \DTMifbool{greek}{mapzone}%
405 {\DTMusezonemapordefault{##1}{##2}}%
406 {%
407 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
408 \ifDTMshowzoneminutes\DTMgreektimesep\DTMtwodigits{##2}\fi
409 }%
410 }%
411 }%
412 {% full style
413 \renewcommand*{\DTMdisplay}[9]{%
414 \ifDTMshowdate
415 \DTMdisplaydate{##1}{##2}{##3}{##4}%
416 \DTMgreekdatetimesep
417 \fi
418 \DTMdisplaytime{##5}{##6}{##7}%
419 \ifDTMshowzone
420 \DTMgreektimezonesep
421 \DTMdisplayzone{##8}{##9}%
422 \fi
423 }%
424 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
425 }%
426 % \end{macrocode}
427 %
428 % Define numeric style.
429 % \begin{macrocode}
430 \DTMnewstyle
431 {greek-numeric}% label
432 {% date style
433 \renewcommand*\DTMdisplaydate[4]{%
434 \DTMifbool{greek}{showdayofmonth}%
435 {%
436 \number##3 % space intended
437 \DTMgreekdatesep
438 }%
439 {}%
440 \number##2 % space intended
441 \DTMifbool{greek}{showyear}%
442 {%
443 \DTMgreekdatesep
444 \number##1 % space intended
445 }%
446 {}%
447 }%
448 \renewcommand*{\DTMDisplaydate}[4]{\DTMdisplaydate{##1}{##2}{##3}{##4}}%
449 }%
450 {% time style
451 \renewcommand*\DTMdisplaytime[3]{%
452 \number##1
453 \DTMgreektimesep\DTMtwodigits{##2}%
454 \ifDTMshowseconds\DTMgreektimesep\DTMtwodigits{##3}\fi
455 }%
456 }%
457 {% zone style
458 \DTMresetzones
459 \DTMgreekzonemaps
460 \renewcommand*{\DTMdisplayzone}[2]{%
461 \DTMifbool{greek}{mapzone}%
462 {\DTMusezonemapordefault{##1}{##2}}%
463 {%
464 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
465 \ifDTMshowzoneminutes\DTMgreektimesep\DTMtwodigits{##2}\fi
466 }%
467 }%
468 }%
469 {% full style
470 \renewcommand*{\DTMdisplay}[9]{%
471 \ifDTMshowdate
472 \DTMdisplaydate{##1}{##2}{##3}{##4}%
473 \DTMgreekdatetimesep
474 \fi
475 \DTMdisplaytime{##5}{##6}{##7}%
476 \ifDTMshowzone
477 \DTMgreektimezonesep
478 \DTMdisplayzone{##8}{##9}%
479 \fi
480 }%
481 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
482 }
483 % \end{macrocode}
484 %
485 %\begin{macro}{\DTMgreekzonemaps}
486 % The time zone mappings are set through this command, which can be
487 % redefined if extra mappings are required or mappings need to be
488 % removed.
489 % \begin{macrocode}
490 \newcommand*{\DTMgreekzonemaps}{%
491 \DTMdefzonemap{02}{00}{EET}%
492 \DTMdefzonemap{03}{00}{EEST}%
493 }
494 % \end{macrocode}
495 %\end{macro}
496
497 % Switch style according to the \opt{useregional} setting.
498 % \begin{macrocode}
499 \DTMifcaseregional
500 {}% do nothing
501 {\DTMsetstyle{greek}}
502 {\DTMsetstyle{greek-numeric}}
503 % \end{macrocode}
504 %
505 % Redefine \cs{dategreek} (or \cs{date}\meta{dialect}) to prevent
506 % \sty{babel} from resetting \cs{today}. (For this to work,
507 % \sty{babel} must already have been loaded if it's required.)
508 %\changes{1.1}{2018-04-18}{removed spurious space}
509 % \begin{macrocode}
510 \ifcsundef{date\CurrentTrackedDialect}
511 {%
512 \ifundef\dategreek
513 {% do nothing
514 }%
515 {%
516 \def\dategreek{%
517 \DTMifcaseregional
518 {}% do nothing
519 {\DTMsetstyle{greek}}%
520 {\DTMsetstyle{greek-numeric}}%
521 }%
522 }%
523 }%
524 {%
525 \csdef{date\CurrentTrackedDialect}{%
526 \DTMifcaseregional
527 {}% do nothing
528 {\DTMsetstyle{greek}}%
529 {\DTMsetstyle{greek-numeric}}%
530 }%
531 }%
532 % \end{macrocode}
533 %\iffalse
534 % \begin{macrocode}
535 %</datetime2-greek.ldf>
536 % \end{macrocode}
537 %\fi
538 %\Finale
539 \endinput