| 1 |
%\iffalse |
| 2 |
% datetime2.dtx generated using makedtx version 1.2 (c) Nicola Talbot |
| 3 |
% Command line args: |
| 4 |
% -section "chapter" |
| 5 |
% -src "datetime2.sty\Z=>datetime2.sty" |
| 6 |
% -src "datetime2-calc.sty\Z=>datetime2-calc.sty" |
| 7 |
% -author "Nicola Talbot" |
| 8 |
% -doc "datetime2-manual.tex" |
| 9 |
% datetime2 |
| 10 |
% Created on 2021/3/21 11:13 |
| 11 |
%\fi |
| 12 |
%\iffalse |
| 13 |
%<*package> |
| 14 |
%% \CharacterTable |
| 15 |
%% {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 |
| 16 |
%% 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 |
| 17 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 18 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 19 |
%% Dollar \$ Percent \% Ampersand \& |
| 20 |
%% Acute accent \' Left paren \( Right paren \) |
| 21 |
%% Asterisk \* Plus \+ Comma \, |
| 22 |
%% Minus \- Point \. Solidus \/ |
| 23 |
%% Colon \: Semicolon \; Less than \< |
| 24 |
%% Equals \= Greater than \> Question mark \? |
| 25 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 26 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 27 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 28 |
%% Right brace \} Tilde \~} |
| 29 |
%</package> |
| 30 |
%\fi |
| 31 |
% \iffalse |
| 32 |
% Doc-Source file to use with LaTeX2e |
| 33 |
% Copyright (C) 2021 Nicola Talbot, all rights reserved. |
| 34 |
% \fi |
| 35 |
% \iffalse |
| 36 |
%<*driver> |
| 37 |
\documentclass[widecs,report]{nlctdoc} |
| 38 |
|
| 39 |
\usepackage{metalogo} |
| 40 |
\usepackage{graphicx} |
| 41 |
\usepackage[utf8]{inputenc} |
| 42 |
\usepackage[T1]{fontenc} |
| 43 |
\usepackage[calc,english,en-GB,useregional=false]{datetime2} |
| 44 |
\usepackage[colorlinks, |
| 45 |
bookmarks, |
| 46 |
hyperindex=false, |
| 47 |
pdfauthor={Nicola L.C. Talbot}, |
| 48 |
pdftitle={datetime2: date and time formats}]{hyperref} |
| 49 |
|
| 50 |
\CheckSum{2658} |
| 51 |
\RecordChanges |
| 52 |
\DisableCrossrefs |
| 53 |
|
| 54 |
\renewcommand*{\usage}[1]{\hyperpage{#1}} |
| 55 |
\renewcommand*{\main}[1]{\hyperpage{#1}} |
| 56 |
\IndexPrologue{\chapter*{\indexname}\markboth{\indexname}{\indexname}% |
| 57 |
\addcontentsline{toc}{chapter}{Index}} |
| 58 |
\setcounter{IndexColumns}{2} |
| 59 |
|
| 60 |
\newcommand{\style}[1]{\texttt{#1}% |
| 61 |
\index{#1=\texttt{#1} style|main}% |
| 62 |
\index{styles:>#1=\texttt{#1}|main}} |
| 63 |
|
| 64 |
\newcommand*{\module}[2][]{% |
| 65 |
\ifblank{#1}% |
| 66 |
{% |
| 67 |
\href{http://ctan.org/pkg/datetime2-#2}{\texttt{#2}}% |
| 68 |
}% |
| 69 |
{% |
| 70 |
\href{http://ctan.org/pkg/datetime2-#1}{\texttt{#2}}% |
| 71 |
}% |
| 72 |
} |
| 73 |
|
| 74 |
\doxitem{Option}{option}{options (definitions)} |
| 75 |
|
| 76 |
\DTMsavetimestamp{gmt}{2015-03-01T15:35:09+00:00} |
| 77 |
\DTMsavetimestamp{bst}{2015-04-01T08:55:39+01:00} |
| 78 |
|
| 79 |
\newcommand*{\inpkg}[1]{\llap{\styfmt{#1}}} |
| 80 |
\newcommand*{\oldcs}[1]{\cs{#1}% |
| 81 |
\index{datetime commands:=\styfmt{datetime} package commands>#1=\cs{#1}|main}% |
| 82 |
} |
| 83 |
|
| 84 |
\setlength\marginparwidth{70pt} |
| 85 |
|
| 86 |
\begin{document} |
| 87 |
\DocInput{datetime2.dtx} |
| 88 |
\end{document} |
| 89 |
%</driver> |
| 90 |
%\fi |
| 91 |
% |
| 92 |
%\MakeShortVerb{"} |
| 93 |
% |
| 94 |
%\title{datetime2 v1.5.7: |
| 95 |
%date and time formats} |
| 96 |
%\author{Nicola L. C. Talbot\\\url{http://www.dickimaw-books.com/}} |
| 97 |
% |
| 98 |
%\date{2021-03-21} |
| 99 |
%\maketitle |
| 100 |
% |
| 101 |
%\begin{abstract} |
| 102 |
%The \styfmt{datetime2} package replaces the \styfmt{datetime} |
| 103 |
%package. Languages and regional variations are dealt with by the |
| 104 |
%\styfmt{datetime2} language modules which are independently |
| 105 |
%maintained and installed. Make sure that when you install |
| 106 |
%\styfmt{datetime2} you also install the required \styfmt{datetime2} |
| 107 |
%language modules. |
| 108 |
%\end{abstract} |
| 109 |
% |
| 110 |
%\tableofcontents |
| 111 |
% |
| 112 |
%\chapter{Introduction} |
| 113 |
%\label{sec:intro} |
| 114 |
% |
| 115 |
%I~wrote the original \styfmt{datetime} package back in the 1990s as |
| 116 |
%an alternative to the \sty{ukdate} package, which had dropped out of |
| 117 |
%some of the TeX distributions, so it was designed specifically for |
| 118 |
%UK date formats.\footnote{Of course, \texttt{ukdatetime} would've |
| 119 |
%been a better name, but the 8 dot 3 filename restriction was a concern back |
| 120 |
%then.} However some users found the time formats useful |
| 121 |
%and the ability to save dates for later use, so when \sty{babel} |
| 122 |
%came along I~had a number of requests to make \styfmt{datetime} |
| 123 |
%compatible with \sty{babel} so that the regional date formats were |
| 124 |
%preserved but the other \styfmt{datetime} functions could be used. |
| 125 |
%Then PDF\TeX\ came into existence and its \cs{pdfcreationdate} now |
| 126 |
%provided a~way of obtaining the seconds and time zone, which can't |
| 127 |
%be obtained from \TeX's \cs{time} primitive. Over time, the |
| 128 |
%continual updates to the package has started to put a~strain on the |
| 129 |
%original na\"ive \LaTeX\ code of my first package, as it's been |
| 130 |
%stretched well past its intended design. |
| 131 |
% |
| 132 |
%The other problem with \styfmt{datetime} is that some of the commands |
| 133 |
%aren't expandable but some users want to be able to use them in |
| 134 |
%expandable contexts (such as, for example, PDF bookmarks or writing |
| 135 |
%a date stamp to an external file) or they |
| 136 |
%want to be able to upper case the first letter if the date comes at |
| 137 |
%the start of a~sentence. This isn't an issue in English, as the |
| 138 |
%weekday and month names are proper nouns and so automatically start |
| 139 |
%with an upper case letter, regardless of where they appear in |
| 140 |
%a~sentence. Users who don't know the history and original purpose of |
| 141 |
%the \styfmt{datetime} package are puzzled as to why the defaults are |
| 142 |
%all UK English or some styles were hard-coded, and some users are |
| 143 |
%confused as to the ordering of the day, month and year parameters. |
| 144 |
%In addition, some command names were incompatible with other |
| 145 |
%date-related packages, but renaming those commands would break |
| 146 |
%compatibility with older documents. |
| 147 |
% |
| 148 |
%In order to address all these issues, a~replacement package is |
| 149 |
%necessary. Your old documents that use \styfmt{datetime} should |
| 150 |
%still be able to compile, but for your new documents, you may prefer |
| 151 |
%the improved \styfmt{datetime2} package instead. |
| 152 |
% |
| 153 |
%\chapter{Example Usage} |
| 154 |
%\label{sec:examples} |
| 155 |
% |
| 156 |
%\begin{verbatim} |
| 157 |
%\documentclass{article} |
| 158 |
%\usepackage{datetime2} |
| 159 |
%\begin{document} |
| 160 |
%This PDF was created on \today. |
| 161 |
%\end{document} |
| 162 |
%\end{verbatim} |
| 163 |
%In the above example, the date is displayed in the form: |
| 164 |
%\begin{display} |
| 165 |
%\DTMsetstyle{default}\DTMusedate{gmt} |
| 166 |
%\end{display} |
| 167 |
%This is the \style{default} style. |
| 168 |
% |
| 169 |
%\begin{verbatim} |
| 170 |
%\documentclass{article} |
| 171 |
%\usepackage{datetime2} |
| 172 |
%\begin{document} |
| 173 |
%This PDF was created on \DTMnow. |
| 174 |
%\end{document} |
| 175 |
%\end{verbatim} |
| 176 |
%In the above example, the full date, time and time zone is displayed |
| 177 |
%in the form |
| 178 |
%\begin{display} |
| 179 |
%\DTMsetstyle{default}\DTMuse{gmt} |
| 180 |
%\end{display} |
| 181 |
%or |
| 182 |
%\begin{display} |
| 183 |
%\DTMsetstyle{default}\DTMuse{bst} |
| 184 |
%\end{display} |
| 185 |
%\emph{unless} you are using \XeLaTeX\ in which case the seconds and |
| 186 |
%time zone are omitted. (\XeLaTeX\ doesn't provide this information, |
| 187 |
%but as from v1.5.2, you can load \sty{texosquery} before |
| 188 |
%\sty{datetime2} and enable the shell escape to obtain this |
| 189 |
%information.) |
| 190 |
%Alternatively you can hide the seconds and zone |
| 191 |
%using the package options \pkgopt[false]{showseconds} and |
| 192 |
%\pkgopt[false]{showzone}. If you want UTC+0 to be displayed |
| 193 |
%numerically instead of using a Z you can use the |
| 194 |
%\pkgopt[false]{showisoZ} package option. |
| 195 |
% |
| 196 |
%\begin{verbatim} |
| 197 |
%\documentclass[british]{article} |
| 198 |
%\usepackage{babel} |
| 199 |
%\usepackage{datetime2} |
| 200 |
%\begin{document} |
| 201 |
%This PDF was created on \DTMnow. |
| 202 |
%\end{document} |
| 203 |
%\end{verbatim} |
| 204 |
%This has the same default numerical output as the previous example, |
| 205 |
%but there are now two additional styles available: \style{en-GB} and |
| 206 |
%\style{en-GB-numeric}. The \cs{datebritish} command provided by |
| 207 |
%\sty{babel} is redefined to prevent \sty{babel} from overriding your |
| 208 |
%preferred date style. The regional style can be enabled with the |
| 209 |
%\pkgopt{useregional} option. |
| 210 |
% |
| 211 |
%\begin{verbatim} |
| 212 |
%\documentclass[british]{article} |
| 213 |
%\usepackage{babel} |
| 214 |
%\usepackage[useregional]{datetime2} |
| 215 |
%\begin{document} |
| 216 |
%This PDF was created on \DTMnow. |
| 217 |
%\end{document} |
| 218 |
%\end{verbatim} |
| 219 |
%The full date, time and zone are displayed in the form |
| 220 |
%\begin{display} |
| 221 |
%\DTMsetstyle{en-GB}\DTMuse{gmt} |
| 222 |
%\end{display} |
| 223 |
%or |
| 224 |
%\begin{display} |
| 225 |
%\DTMsetstyle{en-GB}\DTMuse{bst} |
| 226 |
%\end{display} |
| 227 |
% |
| 228 |
%\begin{verbatim} |
| 229 |
%\documentclass[british]{article} |
| 230 |
%\usepackage{babel} |
| 231 |
%\usepackage[useregional=numeric]{datetime2} |
| 232 |
%\begin{document} |
| 233 |
%This PDF was created on \DTMnow. |
| 234 |
%\end{document} |
| 235 |
%\end{verbatim} |
| 236 |
%The full date, time and zone are displayed in the form |
| 237 |
%\begin{display} |
| 238 |
%\DTMsetstyle{en-GB-numeric}\DTMuse{gmt} |
| 239 |
%\end{display} |
| 240 |
%or |
| 241 |
%\begin{display} |
| 242 |
%\DTMsetstyle{en-GB-numeric}\DTMuse{bst} |
| 243 |
%\end{display} |
| 244 |
% |
| 245 |
%\begin{verbatim} |
| 246 |
%\documentclass[english]{article} |
| 247 |
%\usepackage{babel} |
| 248 |
%\usepackage[useregional=numeric]{datetime2} |
| 249 |
%\begin{document} |
| 250 |
%This PDF was created on \DTMnow. |
| 251 |
%\end{document} |
| 252 |
%\end{verbatim} |
| 253 |
%The full date, time and zone are displayed in the form |
| 254 |
%\begin{display} |
| 255 |
%\DTMsetstyle{default}\DTMuse{gmt} |
| 256 |
%\end{display} |
| 257 |
%This is because no \emph{regional dialect} has been specified. The |
| 258 |
%language name \texttt{english} is |
| 259 |
%ambiguous, so the \style{default} style is used. |
| 260 |
% |
| 261 |
%\begin{verbatim} |
| 262 |
%\documentclass[english]{article} |
| 263 |
%\usepackage{babel} |
| 264 |
%\usepackage[useregional]{datetime2} |
| 265 |
%\begin{document} |
| 266 |
%This PDF was created on \today. |
| 267 |
%\end{document} |
| 268 |
%\end{verbatim} |
| 269 |
%The date is now displayed as |
| 270 |
%\begin{display} |
| 271 |
%\DTMsetstyle{english}\DTMusedate{gmt} |
| 272 |
%\end{display} |
| 273 |
%since that's \LaTeX's default behaviour for \cs{today}. For other |
| 274 |
%languages, you should check the language module documentation to |
| 275 |
%find out what happens when the region can't be determined from the |
| 276 |
%language name. |
| 277 |
% |
| 278 |
%\begin{verbatim} |
| 279 |
%\documentclass[british]{article} |
| 280 |
%\usepackage{babel} |
| 281 |
%\usepackage[useregional,showdow]{datetime2} |
| 282 |
% |
| 283 |
%\DTMlangsetup[en-GB]{abbr} |
| 284 |
% |
| 285 |
%\begin{document} |
| 286 |
%This PDF was created on \today. |
| 287 |
%\end{document} |
| 288 |
%\end{verbatim} |
| 289 |
%The date is now displayed as |
| 290 |
%\begin{display} |
| 291 |
%\DTMsetstyle{en-GB}\DTMlangsetup[en-GB]{abbr}\DTMsetup{showdow}% |
| 292 |
%\DTMusedate{gmt} |
| 293 |
%\end{display} |
| 294 |
%The options used in \cs{DTMlangsetup} (such as \texttt{abbr}) are |
| 295 |
%provided by the language modules and should be described in the |
| 296 |
%module's documentation. Different languages may have different |
| 297 |
%options so \texttt{abbr} may not be available for some of them. The |
| 298 |
%\pkgopt{showdow} (show day of week) option is a package-wide option |
| 299 |
%even though it's a language setting. (This is because the |
| 300 |
%\styfmt{datetime2-calc} package is also needed if the day of the week |
| 301 |
%should be displayed. As a package option, \pkgopt{showdow} can |
| 302 |
%automatically load the required package.) |
| 303 |
% |
| 304 |
%\begin{important} |
| 305 |
%You need to check the documentation for the relevant language module |
| 306 |
%or package to find out which styles check |
| 307 |
%the \pkgopt{showdow} setting as not all of them do. For example, the |
| 308 |
%\module[english]{datetime2-english module} documentation indicates |
| 309 |
%which of the English date styles support this setting. |
| 310 |
%(The \styfmt{datetime} package had a similar limitation with its |
| 311 |
%\pkgoptfmt{dayofweek} package option.) |
| 312 |
%\end{important} |
| 313 |
% |
| 314 |
%If for some reason you can't load \sty{babel} before \styfmt{datetime2} |
| 315 |
%and can only load it afterwards, then you need to explicitly load |
| 316 |
%the module for each \sty{babel} dialect with: |
| 317 |
%\begin{definition}[\DescribeMacro\DTMusemodule] |
| 318 |
%\cs{DTMusemodule}\marg{language}\marg{module-name} |
| 319 |
%\end{definition} |
| 320 |
%where \meta{language} is the language (or dialect) name used with |
| 321 |
%\sty{babel} (for example, \texttt{british}) and \meta{module-name} |
| 322 |
%is the name of the \styfmt{datetime2} module (for example, \texttt{en-GB}). |
| 323 |
% |
| 324 |
%Example: |
| 325 |
%\begin{verbatim} |
| 326 |
%\documentclass{article} |
| 327 |
% |
| 328 |
%\usepackage{datetime2} |
| 329 |
% |
| 330 |
%\usepackage[british,irish]{babel} |
| 331 |
% |
| 332 |
%\DTMusemodule{british}{en-GB} |
| 333 |
%\DTMusemodule{irish}{ga-IE} |
| 334 |
% |
| 335 |
%\end{verbatim} |
| 336 |
%The \meta{language} argument should match the |
| 337 |
%\cs{date\meta{language}} command provided by \sty{babel}. Similarly |
| 338 |
%for \sty{polyglossia}: |
| 339 |
%\begin{verbatim} |
| 340 |
%\documentclass{article} |
| 341 |
% |
| 342 |
%\usepackage{datetime2} |
| 343 |
% |
| 344 |
%\usepackage{polyglossia} |
| 345 |
%\setmainlanguage[variant=uk]{english} |
| 346 |
%\setotherlanguage{irish} |
| 347 |
% |
| 348 |
%\DTMusemodule{english}{en-GB} |
| 349 |
%\DTMusemodule{irish}{ga-IE} |
| 350 |
% |
| 351 |
%\end{verbatim} |
| 352 |
%This ensures that not only is the required \styfmt{datetime2} |
| 353 |
%regional module loaded but also the date switching mechanism |
| 354 |
%\cs{date\meta{language}} is modified to prevent \sty{babel} or |
| 355 |
%\sty{polyglossia} from interfering with \styfmt{datetime2}. |
| 356 |
% |
| 357 |
%Remember that you need to switch on the regional style, if required: |
| 358 |
%\begin{verbatim} |
| 359 |
%\DTMsetregional |
| 360 |
%\end{verbatim} |
| 361 |
%or through the \pkgopt{useregional} package option. |
| 362 |
% |
| 363 |
%\chapter{Displaying the Date and Time} |
| 364 |
%\label{sec:display} |
| 365 |
% |
| 366 |
%A specific date can be displayed using: |
| 367 |
%\begin{definition}[\DescribeMacro\DTMdisplaydate] |
| 368 |
%\cs{DTMdisplaydate}\marg{year}\marg{month}\marg{day}\marg{dow} |
| 369 |
%\end{definition} |
| 370 |
%The format used to display the date is governed by the |
| 371 |
%\termdef{display style}. |
| 372 |
% |
| 373 |
%The arguments are all \emph{numerical}: \meta{year} is the year, |
| 374 |
%\meta{month} is the month number (starting from~1 for January), |
| 375 |
%\meta{day} is the day of the month and \meta{dow} is the day of the |
| 376 |
%week number starting from~0 for Monday. The day of week number may |
| 377 |
%be \texttt{-1}, which indicates that the style should ignore it. |
| 378 |
%(Some styles always ignore the day of week, regardless of its |
| 379 |
%value.) This command is intended for use in expandable contexts |
| 380 |
%(such as writing the date to another file or using the date in the |
| 381 |
%bookmarks) and is used by \cs{today}. The date styles must ensure |
| 382 |
%that any fragile content is protected. (This is why \meta{dow} |
| 383 |
%isn't an optional argument otherwise the command wouldn't be |
| 384 |
%expandable.) |
| 385 |
% |
| 386 |
%\begin{important} |
| 387 |
%The \meta{dow} argument must always be an integer from $-1$ to $6$. |
| 388 |
%It should not be left blank or set to any other value. In some |
| 389 |
%cases using an incorrect value may not cause a problem, but in other |
| 390 |
%cases it will. So it's best to get into the habit of always setting |
| 391 |
%it correctly. |
| 392 |
%\end{important} |
| 393 |
% |
| 394 |
%If you want the \meta{dow} value automatically calculated from the date, |
| 395 |
%you can use \cs{DTMdate} (described below) instead with the |
| 396 |
%\pkgopt{showdow} package option. Note that \cs{DTMdate} is |
| 397 |
%\emph{robust}. If you require an expandable alternative, the |
| 398 |
%\meta{dow} value must be calculated first. The simplest way to do |
| 399 |
%this is to first save the date and then use it (see |
| 400 |
%\sectionref{sec:store}). |
| 401 |
% |
| 402 |
%Some regional styles may end the date with a period (full stop). |
| 403 |
%This can cause a problem if the date occurs at the end of a |
| 404 |
%sentence. If the style has used \cs{DTMfinaldot} then you can use |
| 405 |
%\cs{DTMdate*} to suppress the terminating period if required. (See |
| 406 |
%below.) |
| 407 |
% |
| 408 |
%Examples (with the \pkgopt{showdow} package option set): |
| 409 |
%\begin{itemize} |
| 410 |
%\item Ignore day of week: |
| 411 |
%\begin{verbatim} |
| 412 |
%\section{\DTMdisplaydate{2016}{2}{10}{-1}} |
| 413 |
%\end{verbatim} |
| 414 |
%This overrides the \pkgopt{showdow} option in this specific |
| 415 |
%instance. |
| 416 |
% |
| 417 |
%\item Save the date first and then use it: |
| 418 |
%\begin{verbatim} |
| 419 |
%\DTMsavedate{mydate}{2016-02-10} |
| 420 |
%\section{\DTMusedate{mydate}} |
| 421 |
%\end{verbatim} |
| 422 |
%(See \sectionref{sec:store}.) |
| 423 |
% |
| 424 |
%\item Another expandable alternative (but less convenient and more |
| 425 |
%prone to error since the date has to be repeated): |
| 426 |
%\begin{verbatim} |
| 427 |
%\DTMcomputedayofweekindex{2016-02-10}{\dowindex} |
| 428 |
%\section{\DTMdisplaydate{2016}{2}{10}{\dowindex}} |
| 429 |
%\end{verbatim} |
| 430 |
%(See \sectionref{sec:calc}.) |
| 431 |
% |
| 432 |
%\item Robust version won't work in PDF bookmarks or case-changing |
| 433 |
%contexts (such as page headers): |
| 434 |
%\begin{verbatim} |
| 435 |
%\section{\DTMdate{2016-02-10}} |
| 436 |
%\end{verbatim} |
| 437 |
%Note that if there is a table of contents, this will mean that the |
| 438 |
%day of week index has to be calculated \emph{twice}. Once in the |
| 439 |
%table of contents and once in the actual section title. If the |
| 440 |
%section title is also used in the page header, then the day of week |
| 441 |
%index will additionally be calculated on every page that has this |
| 442 |
%section title in the header. |
| 443 |
%\end{itemize} |
| 444 |
%(See the accompanying \texttt{datetime2-sample-journal.tex} sample |
| 445 |
%file for more examples of using dates in section titles.) |
| 446 |
% |
| 447 |
%Some styles may start the date with a word (such as the day of the |
| 448 |
%week name or the month name). In English, proper nouns are |
| 449 |
%capitalised regardless of where they appear in a~sentence but some |
| 450 |
%languages use lower case month or day of week names. In this event, |
| 451 |
%if the initial letter needs to be capitalised then you can use: |
| 452 |
%\begin{definition}[\DescribeMacro\DTMDisplaydate] |
| 453 |
%\cs{DTMDisplaydate}\marg{year}\marg{month}\marg{day}\marg{dow} |
| 454 |
%\end{definition} |
| 455 |
%which is analogous to \cs{DTMdisplaydate}. Styles that are |
| 456 |
%unaffected by this issue (for example, numerical or English dates) |
| 457 |
%set \cs{DTMDisplaydate} to just \cs{DTMdisplaydate}. As with |
| 458 |
%\cs{DTMdisplaydate} the style needs to ensure that any fragile |
| 459 |
%content is protected in the event that \cs{DTMDisplaydate} is used |
| 460 |
%in an expandable context. (Note that for this reason, I~don't |
| 461 |
%recommend the use of the commands provided by the \sty{mfirstuc} |
| 462 |
%package as they're not expandable.) |
| 463 |
% |
| 464 |
%If you want the \meta{dow} value automatically calculated from the date, |
| 465 |
%you can use \cs{DTMDate} (described below) instead with the |
| 466 |
%\pkgopt{showdow} package option. |
| 467 |
% |
| 468 |
%The current date is displayed using |
| 469 |
%\begin{definition}[\DescribeMacro\today] |
| 470 |
%\cs{today} |
| 471 |
%\end{definition} |
| 472 |
%This uses \cs{DTMdisplaydate} to format the date so it will match |
| 473 |
%the currently selected date style. There's also a first letter |
| 474 |
%upper case version that uses \cs{DTMDisplaydate}: |
| 475 |
%\begin{definition}[\DescribeMacro\Today] |
| 476 |
%\cs{Today} |
| 477 |
%\end{definition} |
| 478 |
% |
| 479 |
%Since there are other classes and packages that redefine \cs{today}, |
| 480 |
%as from version 1.4, the \styfmt{datetime2} package provides |
| 481 |
%\begin{definition}[\DescribeMacro\DTMtoday] |
| 482 |
%\cs{DTMtoday} |
| 483 |
%\end{definition} |
| 484 |
%and |
| 485 |
%\begin{definition}[\DescribeMacro\DTMToday] |
| 486 |
%\cs{DTMToday} |
| 487 |
%\end{definition} |
| 488 |
%The package now assigns \cs{today} and \cs{Today} to \cs{DTMtoday} |
| 489 |
%and \cs{DTMToday}, respectively. If your document loads another |
| 490 |
%package or class that modifies \cs{today} at the beginning of the |
| 491 |
%document, you can switch it back to \styfmt{datetime2}'s definition |
| 492 |
%using |
| 493 |
%\begin{verbatim} |
| 494 |
%\let\today\DTMtoday |
| 495 |
%\end{verbatim} |
| 496 |
%after the start of the document or use the \cs{AtBeginDocument} |
| 497 |
%hook: |
| 498 |
%\begin{verbatim} |
| 499 |
%\AtBeginDocument{\let\today\DTMtoday} |
| 500 |
%\end{verbatim} |
| 501 |
% |
| 502 |
%\begin{important} |
| 503 |
%If you use \sty{babel} or \sty{polyglossia} you must make sure |
| 504 |
%you have the relevant \styfmt{datetime2} language modules installed. |
| 505 |
%(See \sectionref{sec:lang}.) You also need to make sure that |
| 506 |
%\styfmt{datetime2} is loaded \emph{after} |
| 507 |
%\sty{babel}\slash\sty{polyglossia} otherwise \cs{today} will be |
| 508 |
%redefined so that it no longer uses \cs{DTMdisplaydate}. |
| 509 |
%\end{important} |
| 510 |
% |
| 511 |
%As mentioned above, \emph{some styles} allow the day of the week to be |
| 512 |
%displayed. This requires the \styfmt{datetime2-calc} package which will |
| 513 |
%automatically be loaded if you set \pkgopt{showdow} in the |
| 514 |
%\styfmt{datetime2} package option list or if you set |
| 515 |
%\pkgopt{showdow} in \ics{DTMsetup} \emph{in the preamble}. The |
| 516 |
%package option \pkgopt{calc} will also load \styfmt{datetime2-calc} or |
| 517 |
%you can load it explicitly using \cs{usepackage} after |
| 518 |
%\styfmt{datetime2} has been loaded. (You may use \pkgopt[true]{showdow} in |
| 519 |
%the \env{document} environment if the \styfmt{datetime2-calc} |
| 520 |
%package has been loaded in the preamble either explicitly or through |
| 521 |
%the \pkgopt{calc} option.) |
| 522 |
% |
| 523 |
%When \styfmt{datetime2-calc} is loaded, it computes the current day of |
| 524 |
%the week (using commands provided by the \sty{pgfcalendar} package) |
| 525 |
%which can then be used by \cs{today} or \cs{Today}. If |
| 526 |
%\styfmt{datetime2-calc} isn't loaded then neither \cs{today} nor |
| 527 |
%\cs{Today} will display the day of the week, regardless of the |
| 528 |
%current style. |
| 529 |
% |
| 530 |
%If you would like a more convenient syntax and don't care about |
| 531 |
%expansion, there is also a~robust \emph{non-expandable} command that |
| 532 |
%can be used to display a~particular date: |
| 533 |
%\begin{definition}[\DescribeMacro\DTMdate] |
| 534 |
%\cs{DTMdate}\marg{date} |
| 535 |
%\end{definition} |
| 536 |
%As before there's also a capitalised version: |
| 537 |
%\begin{definition}[\DescribeMacro\DTMDate] |
| 538 |
%\cs{DTMDate}\marg{date} |
| 539 |
%\end{definition} |
| 540 |
%As from v1.5.5 there are also starred versions of these commands: |
| 541 |
%\begin{definition}[\DescribeMacro{\DTMdate*}] |
| 542 |
%\cs{DTMdate*}\marg{date} |
| 543 |
%\end{definition} |
| 544 |
%which essentially behaves like: |
| 545 |
%\begin{display} |
| 546 |
%\string{\cs{let}\cs{DTMfinaldot}\cs{empty}\cs{DTMdate}\marg{date}\string} |
| 547 |
%\end{display} |
| 548 |
%and |
| 549 |
%\begin{definition}[\DescribeMacro{\DTMDate*}] |
| 550 |
%\cs{DTMDate*}\marg{date} |
| 551 |
%\end{definition} |
| 552 |
%which essentially behaves like: |
| 553 |
%\begin{display} |
| 554 |
%\string{\cs{let}\cs{DTMfinaldot}\cs{empty}\cs{DTMDate}\marg{date}\string} |
| 555 |
%\end{display} |
| 556 |
%These commands are provided for date styles that use |
| 557 |
%\cs{DTMfinaldot} to produce a period (full stop) at the end of the date. These |
| 558 |
%two star-commands may be used at the end of a sentence to prevent |
| 559 |
%a double period. Note that there is no equivalent starred form of |
| 560 |
%\cs{DTMdisplaydate} or \cs{DTMDisplaydate}. (It would break their |
| 561 |
%ability to fully expand, which was their principle design feature.) |
| 562 |
% |
| 563 |
%In these cases (starred and unstarred) the date should be provided as |
| 564 |
%\meta{YYYY}\texttt{-}\meta{MM}\texttt{-}\meta{DD} in the argument |
| 565 |
%\meta{date}. For example: |
| 566 |
%\begin{verbatim} |
| 567 |
%\DTMdate{2015-03-23} |
| 568 |
%\end{verbatim} |
| 569 |
% |
| 570 |
%Note that hyphens must always be used, regardless of |
| 571 |
%the separator options. Take care that the category code of the |
| 572 |
%hyphen hasn't changed when you use this syntax. |
| 573 |
% |
| 574 |
%\begin{important} |
| 575 |
%The year \meta{YYYY} can't be negative\footnotemark\ in \cs{DTMdate} or |
| 576 |
%\cs{DTMDate}. Use \cs{DTMdisplaydate} or |
| 577 |
%\cs{DTMDisplaydate} instead. |
| 578 |
%\end{important}\footnotetext{Well, actually it can if you put it in braces |
| 579 |
%and don't use \styfmt{datetime2-calc}.} |
| 580 |
% |
| 581 |
%These commands internally use \cs{DTMdisplaydate} and |
| 582 |
%\cs{DTMDisplaydate}, respectively. If the \styfmt{datetime2-calc} |
| 583 |
%package has been loaded, the day of the week will be computed, |
| 584 |
%otherwise the day of the week will be set to \texttt{-1}. Another |
| 585 |
%benefit of the \styfmt{datetime2-calc} package is that it allows |
| 586 |
%additional formats permitted by the \sty{pgfcalendar} package: |
| 587 |
%\begin{itemize} |
| 588 |
%\item \meta{YYYY}\texttt{-}\meta{MM}\texttt{-last} (the last day of |
| 589 |
%the given month). |
| 590 |
% |
| 591 |
%\item |
| 592 |
%\meta{YYYY}\texttt{-}\meta{MM}\texttt{-}\meta{DD}\texttt{+-}\meta{n} |
| 593 |
%(\meta{n} days before the given date). |
| 594 |
% |
| 595 |
%\item |
| 596 |
%\meta{YYYY}\texttt{-}\meta{MM}\texttt{-}\meta{DD}\texttt{+}\meta{n} |
| 597 |
%(\meta{n} days after the given date). |
| 598 |
% |
| 599 |
%\item \meta{YYYY}\texttt{-}\meta{MM}\texttt{-last+-}\meta{n} |
| 600 |
%(\meta{n} days before the last day of |
| 601 |
%the given month). |
| 602 |
% |
| 603 |
%\item \meta{YYYY}\texttt{-}\meta{MM}\texttt{-last+}\meta{n} |
| 604 |
%(\meta{n} days after the last day of |
| 605 |
%the given month). |
| 606 |
% |
| 607 |
%\end{itemize} |
| 608 |
%See the \sty{pgfcalendar} package for further details. |
| 609 |
% |
| 610 |
%If you want to be able to use a date in an expandable context that |
| 611 |
%can perform these calculations, consider first saving the date using |
| 612 |
%one of the commands described in \sectionref{sec:store} and then use |
| 613 |
%one of the expandable commands such as \cs{DTMuse} to display the |
| 614 |
%date. |
| 615 |
% |
| 616 |
%An error or unexpected results may occur if you try using one of |
| 617 |
%these extended formats without loading the \styfmt{datetime2-calc} |
| 618 |
%package. An example that only works with \styfmt{datetime2-calc}: |
| 619 |
%\begin{verbatim} |
| 620 |
%\DTMdate{2015-03-last} |
| 621 |
%\end{verbatim} |
| 622 |
%An example that works with or without \styfmt{datetime2-calc}: |
| 623 |
%\begin{verbatim} |
| 624 |
%\DTMdate{2015-03-31} |
| 625 |
%\end{verbatim} |
| 626 |
%In this second case, you'll only notice a difference in the output |
| 627 |
%if the style should show the day of the week. |
| 628 |
% |
| 629 |
%The style of the date is the same as for \cs{DTMdisplaydate} and |
| 630 |
%\cs{DTMDisplaydate} (which \cs{DTMdate} and \cs{DTMDate} internally |
| 631 |
%use, as mentioned above). |
| 632 |
% |
| 633 |
%A time can be displayed using |
| 634 |
%\begin{definition}[\DescribeMacro\DTMdisplaytime] |
| 635 |
%\cs{DTMdisplaytime}\marg{hour}\marg{minute}\marg{sec} |
| 636 |
%\end{definition} |
| 637 |
%where the arguments are all numerical (using 24 hours). The |
| 638 |
%\termdef{time style} currently in effect determines how the time is formatted. |
| 639 |
%The command is designed to be used in an expandable context so the |
| 640 |
%styles should take care to protect any fragile commands. |
| 641 |
% |
| 642 |
%Note that this command doesn't display the time zone. To display the |
| 643 |
%time zone, you need to use |
| 644 |
%\begin{definition}[\DescribeMacro\DTMdisplayzone] |
| 645 |
%\cs{DTMdisplayzone}\marg{TZh}\marg{TZm} |
| 646 |
%\end{definition} |
| 647 |
%where \meta{TZh} is the hour offset and \meta{TZm} is the minute |
| 648 |
%offset. The display is governed by the \termdef{zone style}. |
| 649 |
%Again, the style should protect any fragile commands in case this is |
| 650 |
%used in an expandable context. |
| 651 |
% |
| 652 |
%The current time (as set at the start of the document build) |
| 653 |
%can be displayed using |
| 654 |
%\begin{definition}[\DescribeMacro\DTMcurrenttime] |
| 655 |
%\cs{DTMcurrenttime} |
| 656 |
%\end{definition} |
| 657 |
%This internally just uses \cs{DTMdisplaytime} and so is designed for |
| 658 |
%use in an expandable context. |
| 659 |
% |
| 660 |
%The current zone can be displayed using |
| 661 |
%\begin{definition}[\DescribeMacro\DTMcurrentzone] |
| 662 |
%\cs{DTMcurrentzone} |
| 663 |
%\end{definition} |
| 664 |
%This internally just uses \cs{DTMdisplayzone} and so is designed for |
| 665 |
%use in an expandable context. |
| 666 |
% |
| 667 |
%\begin{important} |
| 668 |
%If the PDF\TeX\ primitive \ics{pdfcreationdate} is defined, the |
| 669 |
%current time information is obtained from that, which includes the |
| 670 |
%seconds and time zone. Lua\TeX\ also defines this command (now |
| 671 |
%replaced with \cs{pdffeedback}\verb*| creationdate|) but |
| 672 |
%\XeTeX\ doesn't, and in that case the only way to determine the |
| 673 |
%current time is from \TeX's \ics{time} primitive which only contains |
| 674 |
%the number of minutes since midnight, which means that the seconds |
| 675 |
%and time zone are unavailable. Therefore if \XeTeX\ is used, the |
| 676 |
%\pkgopt{showseconds} and \pkgopt{showzone} options are automatically |
| 677 |
%switched off. |
| 678 |
% |
| 679 |
%New to v1.5.2: if \sty{texosquery} is loaded before |
| 680 |
%\styfmt{datetime2} and the shell escape is enabled, then |
| 681 |
%if \cs{pdfcreationdate} and \cs{pdffeedback} are undefined, |
| 682 |
%the information will be obtained through \ics{TeXOSQueryNow}. |
| 683 |
%See the \sty{texosquery} documentation for further information |
| 684 |
%about this command. |
| 685 |
%\end{important} |
| 686 |
% |
| 687 |
%There is also a~non-expandable robust command to display the time: |
| 688 |
%\begin{definition}[\DescribeMacro\DTMtime] |
| 689 |
%\cs{DTMtime}\marg{tm} |
| 690 |
%\end{definition} |
| 691 |
%where \meta{tm} must be in the 24 hour format |
| 692 |
%\meta{hh}\texttt{:}\meta{mm}\texttt{:}\meta{ss} |
| 693 |
%(colon-separated numerical arguments). Take care if you use \sty{babel} |
| 694 |
%with a~language setting that makes the colon character active. You |
| 695 |
%will have to switch off the shorthands in order to use this command |
| 696 |
%correctly. |
| 697 |
% |
| 698 |
%The full date, time and zone (if available) can be displayed using |
| 699 |
%\begin{definition}[\DescribeMacro\DTMdisplay] |
| 700 |
%\cs{DTMdisplay}\marg{year}\marg{month}\marg{day}\marg{dow}\marg{hh}\marg{mm}\marg{ss}\marg{TZh}\marg{TZm} |
| 701 |
%\end{definition} |
| 702 |
%The arguments are all numerical. The way the information is |
| 703 |
%displayed in the document is governed by the \termdef{full style} |
| 704 |
%(or \termdef{date-time style}). |
| 705 |
%Typically the full style will redefine this command to use |
| 706 |
%\cs{DTMdisplaydate}, \cs{DTMdisplaytime} and (optionally) |
| 707 |
%\cs{DTMdisplayzone}. The \pkgopt{showzone} setting may govern whether |
| 708 |
%or not to display the time zone (although a~style may ignore this |
| 709 |
%setting). The separators between the date and time and between the time |
| 710 |
%and zone are governed by the style. |
| 711 |
% |
| 712 |
%There is also an analogous version if capitalisation is required: |
| 713 |
%\begin{definition}[\DescribeMacro\DTMDisplay] |
| 714 |
%\cs{DTMDisplay}\marg{year}\marg{month}\marg{day}\marg{dow}\marg{hh}\marg{mm}\marg{ss}\marg{TZh}\marg{TZm} |
| 715 |
%\end{definition} |
| 716 |
%Some styles may simply make this equivalent to \cs{DTMdisplay}. |
| 717 |
%Other styles may use a~similar format to \cs{DTMdisplay} but replace |
| 718 |
%\cs{DTMdisplaydate} with \cs{DTMDisplaydate}. |
| 719 |
% |
| 720 |
%The full current date, time and (optionally) zone can be displayed |
| 721 |
%using: |
| 722 |
%\begin{definition}[\DescribeMacro\DTMnow] |
| 723 |
%\cs{DTMnow} |
| 724 |
%\end{definition} |
| 725 |
%which uses \cs{DTMdisplay} or |
| 726 |
%\begin{definition}[\DescribeMacro\DTMNow] |
| 727 |
%\cs{DTMNow} |
| 728 |
%\end{definition} |
| 729 |
%which uses \cs{DTMDisplay}. |
| 730 |
% |
| 731 |
%\chapter{Storing and Using Dates and Times} |
| 732 |
%\label{sec:store} |
| 733 |
% |
| 734 |
%Date, time and zone information can be saved for later use. Note |
| 735 |
%that the information is always saved numerically. The style is only |
| 736 |
%applied when the information is later used. The commands that save |
| 737 |
%the information are robust and not expandable. The commands that use the |
| 738 |
%data are typically expandable although there may be some exceptions. |
| 739 |
%Take care that the colon (\texttt{:}) and hyphen (\texttt{-}) |
| 740 |
%characters haven't had their normal category code changed. (For |
| 741 |
%example, through \sty{babel}'s shortcuts.) In the commands below, |
| 742 |
%the \meta{name} (no active characters) is a name that uniquely |
| 743 |
%identifies the information. |
| 744 |
% |
| 745 |
%Dates are saved using |
| 746 |
%\begin{definition}[\DescribeMacro\DTMsavedate] |
| 747 |
%\cs{DTMsavedate}\marg{name}\marg{date} |
| 748 |
%\end{definition} |
| 749 |
%where \meta{date} is in the same format as for \cs{DTMdate}. |
| 750 |
%As with \cs{DTMdate} (and \cs{DTMDate}) the format can be extended |
| 751 |
%with the \styfmt{datetime2-calc} package. If you want to access the day |
| 752 |
%of week, you must make sure that \styfmt{datetime2-calc} has been |
| 753 |
%loaded \emph{before you save the date}. (Remember that the \pkgopt{calc} |
| 754 |
%and \pkgopt{showdow} package options will automatically load |
| 755 |
%\styfmt{datetime2-calc}.) If \styfmt{datetime2-calc} has been loaded, the |
| 756 |
%day of week number will be calculated and saved. Whether or not it |
| 757 |
%is displayed in the document when the date is later used depends on |
| 758 |
%the settings when the date is displayed not when it's saved. |
| 759 |
% |
| 760 |
%This command will override any previously defined date saved with |
| 761 |
%this \meta{name}. If a time or zone hasn't been defined with this |
| 762 |
%\meta{name}, the time and zone elements will all be set to 0 |
| 763 |
%otherwise they will remain unchanged. |
| 764 |
% |
| 765 |
%Note that you can't have a negative year in \meta{date}. There's an |
| 766 |
%alternative command you can use instead that doesn't try parsing |
| 767 |
%\meta{date}: |
| 768 |
%\begin{definition}[\DescribeMacro\DTMsavenoparsedate] |
| 769 |
%\cs{DTMsavenoparsedate}\marg{name}\marg{YYYY}\marg{MM}\marg{DD}\marg{dow} |
| 770 |
%\end{definition} |
| 771 |
%The day of week \meta{dow} may be \texttt{-1} if unknown. This |
| 772 |
%command doesn't calculate the day of week, even if |
| 773 |
%\styfmt{datetime2-calc} has been loaded. |
| 774 |
% |
| 775 |
%Times are saved using |
| 776 |
%\begin{definition}[\DescribeMacro\DTMsavetime] |
| 777 |
%\cs{DTMsavetime}\marg{name}\marg{time} |
| 778 |
%\end{definition} |
| 779 |
%where the \meta{time} is in the same format as for \cs{DTMtime}. |
| 780 |
% |
| 781 |
%This command will override any previously defined time saved with |
| 782 |
%this \meta{name}. If a date or |
| 783 |
%zone hasn't been defined with this \meta{name}, the date and zone |
| 784 |
%elements will all be set to 0 (or \texttt{-1} for the day of week) otherwise they will remain unchanged. |
| 785 |
% |
| 786 |
%Times and zone are saved using |
| 787 |
%\begin{definition}[\DescribeMacro\DTMsavetimezn] |
| 788 |
%\cs{DTMsavetimezn}\marg{name}\marg{time and zone} |
| 789 |
%\end{definition} |
| 790 |
%where the \meta{time and zone} is in the form |
| 791 |
%\begin{display} |
| 792 |
%\meta{hh}:\meta{mm}:\meta{ss} \meta{TZh}:\meta{TZm} |
| 793 |
%\end{display} |
| 794 |
%(Note the space between the seconds and the hour offset.) |
| 795 |
% |
| 796 |
%This command will override any previously defined time and zone |
| 797 |
%saved with this \meta{name}. If a date hasn't been defined with this |
| 798 |
%\meta{name}, the year, month and day will be set to zero and the day |
| 799 |
%of the week to \texttt{-1} otherwise they will remain unchanged. |
| 800 |
% |
| 801 |
%All date, time and zone information can be saved at the same time |
| 802 |
%using: |
| 803 |
%\begin{definition}[\DescribeMacro\DTMsavetimestamp] |
| 804 |
%\cs{DTMsavetimestamp}\marg{name}\marg{data} |
| 805 |
%\end{definition} |
| 806 |
%where \meta{data} is in the format: |
| 807 |
%\begin{display} |
| 808 |
%\meta{YYYY}-\meta{MM}-\meta{DD}T\meta{hh}:\meta{mm}:\meta{ss}\meta{zone} |
| 809 |
%\end{display} |
| 810 |
%The \meta{zone} may either be \texttt{Z} or in the form |
| 811 |
%\meta{TZh}\texttt{:}\meta{TZm} (for example, \texttt{-03:00} |
| 812 |
%or \texttt{-3:0}). This will override any date, time or zone data |
| 813 |
%previously saved with this \meta{name}. |
| 814 |
% |
| 815 |
%Alternatively, if the date and time is in PDF form, that is |
| 816 |
%\begin{display} |
| 817 |
%\texttt{D:}\meta{YYYY}\meta{MM}\meta{DD}\meta{hh}\meta{mm}\meta{ss}\meta{zone} |
| 818 |
%\end{display} |
| 819 |
%where \meta{zone} is either \texttt{Z} or |
| 820 |
%\meta{TZh}\texttt{'}\meta{TZm}\texttt{'} then you can use |
| 821 |
%\begin{definition}[\DescribeMacro\DTMsavefrompdfdata] |
| 822 |
%\cs{DTMsavefrompdfdata}\marg{name}\marg{PDF data} |
| 823 |
%\end{definition} |
| 824 |
%Note that the category code of the initial \texttt{D} is |
| 825 |
%irrelevant (in fact, the initial \texttt{D} is actually |
| 826 |
%ignored) but the other characters should have their usual |
| 827 |
%category code (so take care if, say, \sty{babel} makes the colon |
| 828 |
%an active character). The \meta{PDF data} argument is automatically |
| 829 |
%expanded so may be a control sequence that contains the PDF data. |
| 830 |
%(Not the case with \cs{DTMsavetimestamp}.) |
| 831 |
% |
| 832 |
%The current date and time can be saved using: |
| 833 |
%\begin{definition}[\DescribeMacro\DTMsavenow] |
| 834 |
%\cs{DTMsavenow}\marg{name} |
| 835 |
%\end{definition} |
| 836 |
% |
| 837 |
%There is also a command that can be used to save the modification |
| 838 |
%date of a file, but it's not available for some \TeX\ engines: |
| 839 |
%\begin{definition}[\DescribeMacro\DTMsavefilemoddate] |
| 840 |
%\cs{DTMsavefilemoddate}\marg{name}\marg{file name} |
| 841 |
%\end{definition} |
| 842 |
%where \meta{file name} is the name of the file (remember to use |
| 843 |
%forward slashes \verb|/| for the directory divider). If you build |
| 844 |
%your document using PDF\LaTeX, this command will use the PDF\TeX\ |
| 845 |
%primitive \cs{pdffilemoddate}. If you use Lua\TeX\ this command will |
| 846 |
%attempt to use \texttt{os.date} but it uses \texttt{\%z} for the |
| 847 |
%time zone, which may not work on some operating systems. If you use |
| 848 |
%\XeLaTeX\ this command will generate a warning and will assume a |
| 849 |
%date of 0000-00-00T00:00:00Z unless (from v1.5.2) you have |
| 850 |
%loaded \sty{texosquery} before \styfmt{datetime2} and you have the |
| 851 |
%shell escape enabled, in which case \cs{DTMsavefilemoddate} will use |
| 852 |
%\cs{TeXOSQueryFileDate} to obtain the information. See the |
| 853 |
%\sty{texosquery} manual for further details about this command. |
| 854 |
% |
| 855 |
%The above commands are all localised to the current scope. If the |
| 856 |
%data is required after the end of the scope, you can make the |
| 857 |
%assignments global using: |
| 858 |
%\begin{definition}[\DescribeMacro\DTMmakeglobal] |
| 859 |
%\cs{DTMmakeglobal}\marg{name} |
| 860 |
%\end{definition} |
| 861 |
%For example: |
| 862 |
%\begin{verbatim} |
| 863 |
%\DTMsavenow{mydate}\DTMmakeglobal{mydate} |
| 864 |
%\end{verbatim} |
| 865 |
% |
| 866 |
%A previously saved date can be displayed using the current style |
| 867 |
%with |
| 868 |
%\begin{definition}[\DescribeMacro\DTMusedate] |
| 869 |
%\cs{DTMusedate}\marg{name} |
| 870 |
%\end{definition} |
| 871 |
%This just uses \cs{DTMdisplaydate}. An error will occur if |
| 872 |
%\meta{name} hasn't been defined. Alternatively for the capitalised |
| 873 |
%version: |
| 874 |
%\begin{definition}[\DescribeMacro\DTMUsedate] |
| 875 |
%\cs{DTMUsedate}\marg{name} |
| 876 |
%\end{definition} |
| 877 |
%which uses \cs{DTMDisplaydate} instead. |
| 878 |
% |
| 879 |
%A previously saved time can be displayed using the current style |
| 880 |
%with |
| 881 |
%\begin{definition}[\DescribeMacro\DTMusetime] |
| 882 |
%\cs{DTMusetime}\marg{name} |
| 883 |
%\end{definition} |
| 884 |
%This just uses \cs{DTMdisplaytime}. An error will occur if |
| 885 |
%\meta{name} hasn't been defined. |
| 886 |
% |
| 887 |
%A previously saved zone can be displayed using the current style |
| 888 |
%with |
| 889 |
%\begin{definition}[\DescribeMacro\DTMusezone] |
| 890 |
%\cs{DTMusezone}\marg{name} |
| 891 |
%\end{definition} |
| 892 |
%This just uses \cs{DTMdisplayzone}. An error will occur if |
| 893 |
%\meta{name} hasn't been defined. |
| 894 |
% |
| 895 |
%The entire date, time and zone can be displayed in the current style |
| 896 |
%with |
| 897 |
%\begin{definition}[\DescribeMacro\DTMuse] |
| 898 |
%\cs{DTMuse}\marg{name} |
| 899 |
%\end{definition} |
| 900 |
%This uses \cs{DTMdisplay}. An error will occur if |
| 901 |
%\meta{name} hasn't been defined. Alternatively, |
| 902 |
%\begin{definition}[\DescribeMacro\DTMUse] |
| 903 |
%\cs{DTMUse}\marg{name} |
| 904 |
%\end{definition} |
| 905 |
%will use \cs{DTMDisplay} instead. |
| 906 |
% |
| 907 |
%You can determine if a given \meta{name} has been defined |
| 908 |
%using |
| 909 |
%\begin{definition}[\DescribeMacro\DTMifsaveddate] |
| 910 |
%\cs{DTMifsaveddate}\marg{name}\marg{true}\marg{false} |
| 911 |
%\end{definition} |
| 912 |
% |
| 913 |
%The individual numerical elements can be fetched using one of the |
| 914 |
%following commands. These don't check if the given data identified |
| 915 |
%by \meta{name} has been defined and will expand to \cs{relax} if the |
| 916 |
%name isn't recognised. |
| 917 |
% |
| 918 |
%\begin{definition}[\DescribeMacro\DTMfetchyear] |
| 919 |
%\cs{DTMfetchyear}\marg{name} |
| 920 |
%\end{definition} |
| 921 |
%This expands to the year. |
| 922 |
% |
| 923 |
%\begin{definition}[\DescribeMacro\DTMfetchmonth] |
| 924 |
%\cs{DTMfetchmonth}\marg{name} |
| 925 |
%\end{definition} |
| 926 |
%This expands to the month number. |
| 927 |
% |
| 928 |
%\begin{definition}[\DescribeMacro\DTMfetchday] |
| 929 |
%\cs{DTMfetchday}\marg{name} |
| 930 |
%\end{definition} |
| 931 |
%This expands to the day of the month. |
| 932 |
% |
| 933 |
%\begin{definition}[\DescribeMacro\DTMfetchdow] |
| 934 |
%\cs{DTMfetchdow}\marg{name} |
| 935 |
%\end{definition} |
| 936 |
%This expands to the day of the week number (\texttt{-1} if unknown). |
| 937 |
% |
| 938 |
%\begin{definition}[\DescribeMacro\DTMfetchhour] |
| 939 |
%\cs{DTMfetchhour}\marg{name} |
| 940 |
%\end{definition} |
| 941 |
%This expands to the hour. |
| 942 |
% |
| 943 |
%\begin{definition}[\DescribeMacro\DTMfetchminute] |
| 944 |
%\cs{DTMfetchminute}\marg{name} |
| 945 |
%\end{definition} |
| 946 |
%This expands to the minute. |
| 947 |
% |
| 948 |
%\begin{definition}[\DescribeMacro\DTMfetchsecond] |
| 949 |
%\cs{DTMfetchsecond}\marg{name} |
| 950 |
%\end{definition} |
| 951 |
%This expands to the second. |
| 952 |
% |
| 953 |
%\begin{definition}[\DescribeMacro\DTMfetchTZhour] |
| 954 |
%\cs{DTMfetchTZhour}\marg{name} |
| 955 |
%\end{definition} |
| 956 |
%This expands to the hour offset. |
| 957 |
% |
| 958 |
%\begin{definition}[\DescribeMacro\DTMfetchTZminute] |
| 959 |
%\cs{DTMfetchTZminute}\marg{name} |
| 960 |
%\end{definition} |
| 961 |
%This expands to the minute offset. |
| 962 |
% |
| 963 |
%\chapter{Styles} |
| 964 |
%\label{sec:styles} |
| 965 |
% |
| 966 |
%If you want to just change the \term{date style} use: |
| 967 |
%\begin{definition}[\DescribeMacro\DTMsetdatestyle] |
| 968 |
%\cs{DTMsetdatestyle}\marg{name} |
| 969 |
%\end{definition} |
| 970 |
%where \meta{name} identifies the style. For example: |
| 971 |
%\begin{verbatim} |
| 972 |
%\DTMsetdatestyle{iso} |
| 973 |
%\end{verbatim} |
| 974 |
%This will just change the date style (\cs{DTMdisplaydate} and |
| 975 |
%\cs{DTMDisplaydate}), not the time or zone styles. Note that |
| 976 |
%\cs{DTMdisplay} typically uses \cs{DTMdisplaydate} so this will also |
| 977 |
%change the date element of \cs{DTMdisplay}. |
| 978 |
% |
| 979 |
%If you want to just change the \term{time style} use: |
| 980 |
%\begin{definition}[\DescribeMacro\DTMsettimestyle] |
| 981 |
%\cs{DTMsettimestyle}\marg{name} |
| 982 |
%\end{definition} |
| 983 |
%where \meta{name} identifies the style. For example: |
| 984 |
%\begin{verbatim} |
| 985 |
%\DTMsettimestyle{iso} |
| 986 |
%\end{verbatim} |
| 987 |
%This will just change the time style (\cs{DTMdisplaytime}), not the |
| 988 |
%date or zone styles. Note that \cs{DTMdisplay} typically uses |
| 989 |
%\cs{DTMdisplaytime} so this will also change the time element of |
| 990 |
%\cs{DTMdisplay}. |
| 991 |
% |
| 992 |
%If you want to just change the \term{zone style} use: |
| 993 |
%\begin{definition}[\DescribeMacro\DTMsetzonestyle] |
| 994 |
%\cs{DTMsetzonestyle}\marg{name} |
| 995 |
%\end{definition} |
| 996 |
%where \meta{name} identifies the style. For example: |
| 997 |
%\begin{verbatim} |
| 998 |
%\DTMsetzonestyle{iso} |
| 999 |
%\end{verbatim} |
| 1000 |
%This will just change the zone style (\cs{DTMdisplayzone}), not the |
| 1001 |
%date or time styles. Note that \cs{DTMdisplay} typically uses |
| 1002 |
%\cs{DTMdisplayzone} so this will also change the zone element of |
| 1003 |
%\cs{DTMdisplay}. |
| 1004 |
% |
| 1005 |
%If you want to change the \term{full style} use: |
| 1006 |
%\begin{definition}[\DescribeMacro\DTMsetstyle] |
| 1007 |
%\cs{DTMsetstyle}\marg{name} |
| 1008 |
%\end{definition} |
| 1009 |
%where \meta{name} identifies the style. For example: |
| 1010 |
%\begin{verbatim} |
| 1011 |
%\DTMsetstyle{iso} |
| 1012 |
%\end{verbatim} |
| 1013 |
% |
| 1014 |
%Note that in this case this does more than simply |
| 1015 |
%\begin{verbatim} |
| 1016 |
%\DTMsetdatestyle{iso}\DTMsettimestyle{iso}\DTMsetzonestyle{iso} |
| 1017 |
%\end{verbatim} |
| 1018 |
%as it also changes \cs{DTMdisplay} and \cs{DTMDisplay}. |
| 1019 |
%If the style \meta{name} is only a \term{partial style}, a~warning |
| 1020 |
%will be issued for any partial styles that aren't defined for the |
| 1021 |
%given name as well as a warning for the undefined full style. |
| 1022 |
%An error will occur if there are neither partial nor full styles |
| 1023 |
%with the given \meta{name}. |
| 1024 |
% |
| 1025 |
%The predefined styles listed in \sectionref{sec:predefinedfull} are all |
| 1026 |
%\emph{full styles}. This means that they change the date, time, zone |
| 1027 |
%and full format, so any of them can be used in \cs{DTMsetdatestyle}, |
| 1028 |
%\cs{DTMsettimestyle}, \cs{DTMsetzonestyle} or \cs{DTMsetstyle}. |
| 1029 |
%However it's possible for a style to be only a \emph{partial style}, |
| 1030 |
%such as those described in \sectionref{sec:predefinedtime}. |
| 1031 |
% |
| 1032 |
%For example, if \texttt{foo} is a \term{date style} and |
| 1033 |
%a \term{time style} but isn't a \term{zone style} or |
| 1034 |
%a \term{full style} then you can use |
| 1035 |
%\begin{verbatim} |
| 1036 |
%\DTMsetdatestyle{foo} |
| 1037 |
%\end{verbatim} |
| 1038 |
%and |
| 1039 |
%\begin{verbatim} |
| 1040 |
%\DTMsettimestyle{foo} |
| 1041 |
%\end{verbatim} |
| 1042 |
%but you can't use \cs{DTMsetzonestyle}. You can use |
| 1043 |
%\begin{verbatim} |
| 1044 |
%\DTMsetstyle{foo} |
| 1045 |
%\end{verbatim} |
| 1046 |
%but this will now only be equivalent to |
| 1047 |
%\begin{verbatim} |
| 1048 |
%\DTMsetdatestyle{foo}\DTMsettimestyle{foo} |
| 1049 |
%\end{verbatim} |
| 1050 |
%and while \cs{DTMdisplay} and \cs{DTMDisplay} will typically use these date |
| 1051 |
%and time settings, the way that the date, time and zone are arranged |
| 1052 |
%will be governed by the full style setting that was already in |
| 1053 |
%effect before the date and time style changed. |
| 1054 |
% |
| 1055 |
%The style changes are all local and so are affected by the current |
| 1056 |
%scope. |
| 1057 |
% |
| 1058 |
%In addition to the predefined styles, there are also styles provided |
| 1059 |
%by regional modules. These may or may not be set depending on |
| 1060 |
%the setting of \pkgopt{useregional}. Those that are provided usually |
| 1061 |
%follow the naming scheme \meta{lang-name} or \meta{lang |
| 1062 |
%code}\texttt{-}\meta{county code}, where \meta{lang name} is the |
| 1063 |
%root language name (for example, \texttt{english}), \meta{lang code} |
| 1064 |
%is the ISO language code and \meta{country code} is the ISO country |
| 1065 |
%code (for example, \texttt{en-GB}). If a numeric style is provided, |
| 1066 |
%it's usually the name of the text style with \texttt{-numeric} |
| 1067 |
%appended (for example, \texttt{en-GB-numeric}). If you're not sure |
| 1068 |
%of the exact naming scheme you can use |
| 1069 |
%\begin{definition}[\DescribeMacro\DTMtryregional] |
| 1070 |
%\cs{DTMtryregional}\oarg{lang name}\marg{lang code}\marg{country |
| 1071 |
%code} |
| 1072 |
%\end{definition} |
| 1073 |
%This takes into account the \pkgopt{useregional} option, so will do |
| 1074 |
%nothing if \pkgopt[false]{useregional}. If the optional argument is |
| 1075 |
%omitted, the root language name will be determined from the supplied ISO |
| 1076 |
%language code if it's recognised. |
| 1077 |
% |
| 1078 |
%\begin{important} |
| 1079 |
%If there's no match, no change will be made. There will be no |
| 1080 |
%warnings or error messages. |
| 1081 |
%\end{important} |
| 1082 |
% |
| 1083 |
%For example: |
| 1084 |
%\begin{verbatim} |
| 1085 |
%\DTMsetup{useregional=numeric} |
| 1086 |
%\DTMtryregional{en}{GB} |
| 1087 |
%\end{verbatim} |
| 1088 |
%This will set the style \texttt{en-GB-numeric} (assuming the |
| 1089 |
%\texttt{en-GB} module has been loaded). |
| 1090 |
% |
| 1091 |
%In this example: |
| 1092 |
%\begin{verbatim} |
| 1093 |
%\DTMsetup{useregional} |
| 1094 |
%\DTMtryregional{nl}{BE} |
| 1095 |
%\end{verbatim} |
| 1096 |
%the style is set to \texttt{dutch} (assuming the \texttt{dutch} |
| 1097 |
%module has been loaded), since there's no style called |
| 1098 |
%\texttt{nl-BE}. |
| 1099 |
% |
| 1100 |
%If the ISO codes are stored in control sequences which may or may |
| 1101 |
%not be defined, you can use the starred version which expects |
| 1102 |
%commands for the last two arguments: |
| 1103 |
%\begin{definition}[\DescribeMacro\DTMtryregional*] |
| 1104 |
%\cs{DTMtryregional*}\oarg{lang name}\marg{lang code cs}\marg{country |
| 1105 |
%code cs} |
| 1106 |
%\end{definition} |
| 1107 |
% |
| 1108 |
%\section{Predefined Styles} |
| 1109 |
%\label{sec:predefinedstyles} |
| 1110 |
% |
| 1111 |
%The base \styfmt{datetime2} package provides a number of predefined |
| 1112 |
%numerical styles. \sectionref{sec:predefinedfull} lists the full styles, |
| 1113 |
%which can be used with \cs{DTMsetstyle}, \cs{DTMsetdatestyle}, |
| 1114 |
%\cs{DTMsettimestyle} and \cs{DTMsetzonestyle}. |
| 1115 |
%\sectionref{sec:predefinedtime} lists the predefined (partial) times |
| 1116 |
%styles, which can be used with \cs{DTMsettimestyle} and |
| 1117 |
%\cs{DTMsetstyle}. |
| 1118 |
% |
| 1119 |
%\subsection{Full Styles} |
| 1120 |
%\label{sec:predefinedfull} |
| 1121 |
% |
| 1122 |
%The following are predefined full styles that are provided by the |
| 1123 |
%base \styfmt{datetime2} package. Additional styles are available |
| 1124 |
%through the language modules (see \sectionref{sec:lang}). |
| 1125 |
% |
| 1126 |
%\begin{description} |
| 1127 |
%\item[\style{default}] The \style{default} style displays the date in the form |
| 1128 |
%\begin{display} |
| 1129 |
%\meta{YYYY}\meta{YMsep}\meta{MM}\meta{MDsep}\meta{DD} |
| 1130 |
%\end{display} |
| 1131 |
%where the month \meta{MM} and day of the month \meta{DD} numbers are |
| 1132 |
%formatted as two digits. The separators \meta{YMsep} and |
| 1133 |
%\meta{MDsep} default to a hyphen but can be changed using the |
| 1134 |
%options \pkgopt{yearmonthsep}, \pkgopt{monthdaysep} or |
| 1135 |
%\pkgopt{datesep} (either through the package options or using |
| 1136 |
%\ics{DTMsetup}). |
| 1137 |
% |
| 1138 |
%The time is displayed in the form: |
| 1139 |
%\begin{display} |
| 1140 |
%\meta{hh}\meta{HMsep}\meta{mm}\meta{MSsep}\meta{ss} |
| 1141 |
%\end{display} |
| 1142 |
%where the hour, month and seconds are formatted as two digits. The |
| 1143 |
%final \meta{MSsep}\meta{ss} is omitted if the option |
| 1144 |
%\pkgopt{showseconds} has been set to \texttt{false}. The separators |
| 1145 |
%\meta{HMsep} and \meta{MSsep} default to a~colon (\texttt{:}) but |
| 1146 |
%these may be changed using the options \pkgopt{hourminsep}, |
| 1147 |
%\pkgopt{minsecsep} or \pkgopt{datetimesep}. |
| 1148 |
% |
| 1149 |
%The zone is displayed in form |
| 1150 |
%\begin{display} |
| 1151 |
%\meta{TZh}\meta{HMsep}\meta{TZm} |
| 1152 |
%\end{display} |
| 1153 |
%or just \texttt{Z} if the option \pkgopt{showisoZ} is set to |
| 1154 |
%\texttt{true} and both \meta{TZh} and \meta{TZm} are zero. |
| 1155 |
%The separator \meta{HMsep} is the same as used for the time format. |
| 1156 |
%The final \meta{HMsep}\meta{TZm} is omitted if the option |
| 1157 |
%\pkgopt{showzoneminutes} is set to \texttt{false}. The hour offset |
| 1158 |
%\meta{TZh} is formatted as two digits proceeded by either \texttt{+} |
| 1159 |
%or \texttt{-} and the minute offset is formatted as two digits. |
| 1160 |
%Note that since one of the main purposes of this package is to |
| 1161 |
%provide expandable date commands that can be used to write |
| 1162 |
%information to external files, no attempt is made to convert the |
| 1163 |
%hyphen \texttt{-} (for negative offsets) into a minus sign. If you |
| 1164 |
%want it rendered correctly in your document, consider placing the |
| 1165 |
%time zone command in math mode and adjust the separators as |
| 1166 |
%necessary. |
| 1167 |
% |
| 1168 |
%The full style is in the form |
| 1169 |
%\begin{display} |
| 1170 |
%\meta{date}\meta{DTsep}\meta{time}\meta{TZsep}\meta{zone} |
| 1171 |
%\end{display} |
| 1172 |
%The \meta{date}\meta{DTsep} part is omitted if the option |
| 1173 |
%\pkgopt{showdate} is set to \texttt{false}, and |
| 1174 |
%the \meta{TZsep}\meta{zone} part is omitted if the option |
| 1175 |
%\pkgopt{showzone} is set to \texttt{false}. The separator between |
| 1176 |
%the date and time \meta{DTsep} defaults to \cs{space} but may be |
| 1177 |
%changed using the \pkgopt{datetimesep} option. The separator between |
| 1178 |
%the time and zone \meta{TZsep} defaults to nothing but may be |
| 1179 |
%changed using the \pkgopt{timezonesep} option. |
| 1180 |
% |
| 1181 |
%\item[\style{iso}] The \style{iso} style is like the \style{default} |
| 1182 |
%style but the separators can't be changed. The separators used in |
| 1183 |
%the date format are fixed as hyphens and the separators used in the |
| 1184 |
%time and zone formats are fixed as colons. In the full format, the separator between the |
| 1185 |
%date and time is fixed as \texttt{T} and there's no separator between the |
| 1186 |
%time and zone. The only options that can change the \style{iso} |
| 1187 |
%style are \pkgopt{showseconds}, \pkgopt{showdate}, \pkgopt{showzone}, |
| 1188 |
%\pkgopt{showzoneminutes} and \pkgopt{showisoZ}. |
| 1189 |
% |
| 1190 |
%\item[\style{yyyymd}] This is like the \style{default} style |
| 1191 |
%except that the month and date aren't forced into a two-digit |
| 1192 |
%format. |
| 1193 |
% |
| 1194 |
%\item[\style{ddmmyyyy}] This is like the \style{default} style |
| 1195 |
%except that the date is formatted in the reverse order |
| 1196 |
%\begin{display} |
| 1197 |
%\meta{DD}\meta{MDsep}\meta{MM}\meta{YMsep}\meta{YYYY} |
| 1198 |
%\end{display} |
| 1199 |
%The day and month are displayed as two-digits and the separators are |
| 1200 |
%as for the \style{default} style. The options that modify the |
| 1201 |
%\style{default} style similarly modify this style. |
| 1202 |
% |
| 1203 |
%\item[\style{dmyyyy}] This is like the \style{ddmmyyyy} style except |
| 1204 |
%that it doesn't force the day and month into a~two-digit format. |
| 1205 |
%The options that modify the |
| 1206 |
%\style{default} style similarly modify this style. |
| 1207 |
% |
| 1208 |
%\item[\style{dmyy}] This is like the \style{dmyy} style except |
| 1209 |
%that it only displays the final two digits of the year. |
| 1210 |
%The options that modify the |
| 1211 |
%\style{default} style similarly modify this style. |
| 1212 |
% |
| 1213 |
%\item[\style{ddmmyy}] This is like the \style{default} style |
| 1214 |
%except that the date is formatted in the reverse order |
| 1215 |
%\begin{display} |
| 1216 |
%\meta{DD}\meta{MDsep}\meta{MM}\meta{YMsep}\meta{YY} |
| 1217 |
%\end{display} |
| 1218 |
%The day, month and year are displayed as two-digits and the separators are |
| 1219 |
%as for the \style{default} style. The options that modify the |
| 1220 |
%\style{default} style similarly modify this style. |
| 1221 |
% |
| 1222 |
%\item[\style{mmddyyyy}] This is like the \style{ddmmyyyy} style |
| 1223 |
%except the day and month numbers are reversed. The separator between |
| 1224 |
%the month and day is still given by the \pkgopt{monthdaysep} or |
| 1225 |
%\pkgopt{datesep} options. The separator between the day and year is given by |
| 1226 |
%the \pkgopt{dayyearsep} or \pkgopt{datesep} options. |
| 1227 |
% |
| 1228 |
%\item[\style{mmddyy}] This is like the \style{ddmmyy} style |
| 1229 |
%except the day and month numbers are reversed. The separator between |
| 1230 |
%the month and day is still given by the \pkgopt{monthdaysep} or |
| 1231 |
%\pkgopt{datesep} options. The separator between the day and year is given by |
| 1232 |
%the \pkgopt{dayyearsep} or \pkgopt{datesep} options. |
| 1233 |
% |
| 1234 |
%\item[\style{mdyyyy}] This is like the \style{mmddyyyy} style except |
| 1235 |
%that it doesn't force the day and month into a~two-digit format. |
| 1236 |
% |
| 1237 |
%\item[\style{mdyy}] This is like the \style{mdyyyy} style except |
| 1238 |
%that the year only has the final two digits displayed. |
| 1239 |
% |
| 1240 |
%\item[\style{pdf}] This formats the date, time and zone so that the |
| 1241 |
%full style is in the form required by the date settings in |
| 1242 |
%\ics{pdfinfo}. The date format is |
| 1243 |
%\begin{display} |
| 1244 |
%D:\meta{YYYY}\meta{MM}\meta{DD} |
| 1245 |
%\end{display} |
| 1246 |
%where the month and day numbers are displayed as two digits. |
| 1247 |
% |
| 1248 |
%The time format is |
| 1249 |
%\begin{display} |
| 1250 |
%\meta{hh}\meta{mm}\meta{ss} |
| 1251 |
%\end{display} |
| 1252 |
%where the numbers are displayed as two digits. |
| 1253 |
% |
| 1254 |
%The zone format is |
| 1255 |
%\begin{display} |
| 1256 |
%\meta{hh}'\meta{mm}' |
| 1257 |
%\end{display} |
| 1258 |
%or Z for zero time offset if the option \pkgopt{showisoZ} is |
| 1259 |
%used. (The \pkgopt{showisoZ} option is the only option that modifies |
| 1260 |
%the \style{pdf} style.) The hour and minutes are displayed as two |
| 1261 |
%digits where the hour has the sign present (either \texttt{+} or |
| 1262 |
%\texttt{-}). |
| 1263 |
% |
| 1264 |
%The full style is a concatenation of the date, time and zone. |
| 1265 |
%\begin{display} |
| 1266 |
%D:\meta{YYYY}\meta{MM}\meta{DD}\meta{hh}\meta{mm}\meta{ss}\meta{hh}'\meta{mm}' |
| 1267 |
%\end{display} |
| 1268 |
% |
| 1269 |
%\end{description} |
| 1270 |
% |
| 1271 |
%\subsection{Time Styles} |
| 1272 |
%\label{sec:predefinedtime} |
| 1273 |
% |
| 1274 |
%There's only one predefined time (partial) style provided |
| 1275 |
%by the base \styfmt{datetime2} package. This style can be used to |
| 1276 |
%override the time format part of full styles. For example, to use |
| 1277 |
%the \style{default} full style with the \style{hmmss} time style: |
| 1278 |
%\begin{verbatim} |
| 1279 |
%\DTMsetstyle{default}\DTMsettimestyle{hmmss} |
| 1280 |
%\end{verbatim} |
| 1281 |
% |
| 1282 |
%\begin{description} |
| 1283 |
%\item[\style{hmmss}] The \style{hmmss} style is like the time style |
| 1284 |
%provided by the full \style{default} style except that the hour |
| 1285 |
%isn't forced into two digits. |
| 1286 |
% |
| 1287 |
%\end{description} |
| 1288 |
% |
| 1289 |
%\subsection{Zone Styles} |
| 1290 |
%\label{sec:predefinedzone} |
| 1291 |
% |
| 1292 |
%The following are predefined zone (partial) styles that are provided |
| 1293 |
%by the base \styfmt{datetime2} package. These styles can be used to |
| 1294 |
%override the zone format part of full styles. For example, to use |
| 1295 |
%the \style{default} full style with the \style{map} zone style: |
| 1296 |
%\begin{verbatim} |
| 1297 |
%\DTMsetstyle{default}\DTMsetzonestyle{map} |
| 1298 |
%\end{verbatim} |
| 1299 |
% |
| 1300 |
%\begin{description} |
| 1301 |
%\item[\style{map}] The \style{map} style uses |
| 1302 |
%\cs{DTMusezonemapordefault} to display the mapping, if one exists, |
| 1303 |
%or use the default style, if a mapping doesn't exist. For example: |
| 1304 |
%\begin{verbatim} |
| 1305 |
%\DTMNatoZoneMaps |
| 1306 |
%\DTMsetzonestyle{map} |
| 1307 |
%\end{verbatim} |
| 1308 |
%This first defines the NATO mappings and then switches to the |
| 1309 |
%\style{map} style. |
| 1310 |
% |
| 1311 |
%\item[\style{hhmm}] The \style{hhmm} style displays the time zone in |
| 1312 |
%the form |
| 1313 |
%\begin{display} |
| 1314 |
%\meta{TZh}\meta{HMsep}\meta{TZm} |
| 1315 |
%\end{display} |
| 1316 |
%where \meta{HMsep} is given by the \pkgopt{hourminsep} option. |
| 1317 |
%This style honours the \pkgopt{showzoneminutes} option |
| 1318 |
%but ignores the \pkgopt{showisoZ} option. The hour is always |
| 1319 |
%prefixed by the sign. |
| 1320 |
% |
| 1321 |
%\end{description} |
| 1322 |
% |
| 1323 |
%\section{Defining New Styles} |
| 1324 |
%\label{sec:newstyle} |
| 1325 |
% |
| 1326 |
%A new \term{date style} can be defined using: |
| 1327 |
%\begin{definition}[\DescribeMacro\DTMnewdatestyle] |
| 1328 |
%\cs{DTMnewdatestyle}\marg{name}\marg{definition} |
| 1329 |
%\end{definition} |
| 1330 |
%This defines a \term{partial style} that should only modify |
| 1331 |
%\cs{DTMdisplaydate} and \cs{DTMDisplaydate}. The redefinition of |
| 1332 |
%these commands should be placed in \meta{definition}. If the date |
| 1333 |
%should end with a period (full stop) use: |
| 1334 |
%\begin{definition}[\DescribeMacro\DTMfinaldot] |
| 1335 |
%\cs{DTMfinaldot} |
| 1336 |
%\end{definition} |
| 1337 |
%at the end of the definitions of \cs{DTMdisplaydate} and |
| 1338 |
%\cs{DTMDisplaydate}. |
| 1339 |
% |
| 1340 |
%This command is simply defined as ``\texttt{.}'' but it's locally |
| 1341 |
%redefined to do nothing by the starred versions of \cs{DTMdate} and |
| 1342 |
%\cs{DTMDate} allowing the dot to be discarded. |
| 1343 |
% |
| 1344 |
%A new \term{time style} can be defined using: |
| 1345 |
%\begin{definition}[\DescribeMacro\DTMnewtimestyle] |
| 1346 |
%\cs{DTMnewtimestyle}\marg{name}\marg{definition} |
| 1347 |
%\end{definition} |
| 1348 |
%This defines a \term{partial style} that should only modify |
| 1349 |
%\cs{DTMdisplaytime}. The redefinition should be placed in |
| 1350 |
%\meta{definition}. |
| 1351 |
% |
| 1352 |
%A new \term{zone style} can be defined using: |
| 1353 |
%\begin{definition}[\DescribeMacro\DTMnewzonestyle] |
| 1354 |
%\cs{DTMnewzonestyle}\marg{name}\marg{definition} |
| 1355 |
%\end{definition} |
| 1356 |
%This defines a \term{partial style} that should only modify |
| 1357 |
%\cs{DTMdisplayzone}. The redefinition should be placed in |
| 1358 |
%\meta{definition}. |
| 1359 |
% |
| 1360 |
%A new \term{full style} can be defined using: |
| 1361 |
%\begin{definition}[\DescribeMacro\DTMnewstyle] |
| 1362 |
%\cs{DTMnewstyle}\marg{name}\marg{date style definition}\marg{time |
| 1363 |
%style definition}\marg{zone style definition}\marg{full style definition} |
| 1364 |
%\end{definition} |
| 1365 |
%This does |
| 1366 |
%\begin{display} |
| 1367 |
%\cs{DTMnewdatestyle}\marg{name}\marg{date style definition}\newline |
| 1368 |
%\cs{DTMnewtimestyle}\marg{name}\marg{time style definition}\newline |
| 1369 |
%\cs{DTMnewzonestyle}\marg{name}\marg{zone style definition}\newline |
| 1370 |
%\end{display} |
| 1371 |
%and finally \meta{full style definition} should redefine |
| 1372 |
%\cs{DTMdisplay} and \cs{DTMDisplay}. |
| 1373 |
% |
| 1374 |
%\begin{important} |
| 1375 |
%Remember to use a double-hash to reference the parameters (\verb|##1|, |
| 1376 |
%\verb|##2| etc) within \meta{definition} in all the above. |
| 1377 |
%In each case \meta{name} is the label identifying the style |
| 1378 |
%and shouldn't contain active characters. |
| 1379 |
%\end{important} |
| 1380 |
% |
| 1381 |
%As from version 1.2, you can redefine existing styles with the following |
| 1382 |
%commands. |
| 1383 |
% |
| 1384 |
%\begin{definition}[\DescribeMacro\DTMrenewdatestyle] |
| 1385 |
%\cs{DTMrenewdatestyle}\marg{name}\marg{definition} |
| 1386 |
%\end{definition} |
| 1387 |
%This redefines the named date style. The original may be either a |
| 1388 |
%partial or a full style. |
| 1389 |
% |
| 1390 |
%\begin{definition}[\DescribeMacro\DTMrenewtimestyle] |
| 1391 |
%\cs{DTMrenewtimestyle}\marg{name}\marg{definition} |
| 1392 |
%\end{definition} |
| 1393 |
%This redefines the named time style. The original may be either a |
| 1394 |
%partial or a full style. |
| 1395 |
% |
| 1396 |
%\begin{definition}[\DescribeMacro\DTMrenewzonestyle] |
| 1397 |
%\cs{DTMrenewzonestyle}\marg{name}\marg{definition} |
| 1398 |
%\end{definition} |
| 1399 |
%This redefines the named time zone style. The original may be either a |
| 1400 |
%partial or a full style. |
| 1401 |
% |
| 1402 |
%\begin{definition}[\DescribeMacro\DTMrenewstyle] |
| 1403 |
%\cs{DTMrenewstyle}\marg{name}\marg{definition} |
| 1404 |
%\end{definition} |
| 1405 |
%This redefines the named full style. The original style must also |
| 1406 |
%be a full style. |
| 1407 |
% |
| 1408 |
%There are also commands analogous to \cs{providecommand} that will |
| 1409 |
%define styles that don't already exist. |
| 1410 |
% |
| 1411 |
%\begin{definition}[\DescribeMacro\DTMprovidedatestyle] |
| 1412 |
%\cs{DTMprovidedatestyle}\marg{name}\marg{definition} |
| 1413 |
%\end{definition} |
| 1414 |
%This defines the named date style. This won't do anything if either |
| 1415 |
%a partial date style or a full style with the given name already |
| 1416 |
%exists. |
| 1417 |
% |
| 1418 |
%\begin{definition}[\DescribeMacro\DTMprovidetimestyle] |
| 1419 |
%\cs{DTMprovidetimestyle}\marg{name}\marg{definition} |
| 1420 |
%\end{definition} |
| 1421 |
%This defines the named time style. This won't do anything if either |
| 1422 |
%a partial time style or a full style with the given name already |
| 1423 |
%exists. |
| 1424 |
% |
| 1425 |
%\begin{definition}[\DescribeMacro\DTMprovidezonestyle] |
| 1426 |
%\cs{DTMprovidezonestyle}\marg{name}\marg{definition} |
| 1427 |
%\end{definition} |
| 1428 |
%This defines the named zone style. This won't do anything if either |
| 1429 |
%a partial zone style or a full style with the given name already |
| 1430 |
%exists. |
| 1431 |
% |
| 1432 |
%\begin{definition}[\DescribeMacro\DTMprovidestyle] |
| 1433 |
%\cs{DTMprovidestyle}\marg{name}\marg{definition} |
| 1434 |
%\end{definition} |
| 1435 |
%This defines the named full style if the named full style doesn't |
| 1436 |
%already exist. This internally uses the previous |
| 1437 |
%three commands for the partial elements of the full style, so it a |
| 1438 |
%partial style with this name already exists, it won't be changed. |
| 1439 |
% |
| 1440 |
%As from v1.5.2, you can determine if a style exists using: |
| 1441 |
% |
| 1442 |
%\begin{definition}[\DescribeMacro\DTMifhasstyle] |
| 1443 |
%\cs{DTMifhasstyle}\marg{name}\marg{true}\marg{false} |
| 1444 |
%\end{definition} |
| 1445 |
%If the (full) style given by \meta{name} exists, this |
| 1446 |
%does \meta{true} otherwise it does \meta{false}. |
| 1447 |
% |
| 1448 |
%Similarly for a partial date style |
| 1449 |
%\begin{definition}[\DescribeMacro\DTMifhasdatestyle] |
| 1450 |
%\cs{DTMifhasdatestyle}\marg{name}\marg{true}\marg{false} |
| 1451 |
%\end{definition} |
| 1452 |
%partial time style |
| 1453 |
%\begin{definition}[\DescribeMacro\DTMifhastimestyle] |
| 1454 |
%\cs{DTMifhastimestyle}\marg{name}\marg{true}\marg{false} |
| 1455 |
%\end{definition} |
| 1456 |
%and partial time zone style |
| 1457 |
%\begin{definition}[\DescribeMacro\DTMifhaszonestyle] |
| 1458 |
%\cs{DTMifhaszonestyle}\marg{name}\marg{true}\marg{false} |
| 1459 |
%\end{definition} |
| 1460 |
% |
| 1461 |
%There are some helper commands provided that you might want to use |
| 1462 |
%in the style definitions. |
| 1463 |
% |
| 1464 |
%\begin{definition}[\DescribeMacro\DTMtwodigits] |
| 1465 |
%\cs{DTMtwodigits}\marg{number} |
| 1466 |
%\end{definition} |
| 1467 |
%This displays \meta{number} so that it has \emph{exactly} two digits. |
| 1468 |
%Unlike \LaTeX's \cs{two@digits} this will check for a negative |
| 1469 |
%number and will trim a number whose absolute value is greater than |
| 1470 |
%or equal to 100. This command is expandable. |
| 1471 |
% |
| 1472 |
%\begin{definition}[\DescribeMacro\DTMcentury] |
| 1473 |
%\cs{DTMcentury}\marg{year} |
| 1474 |
%\end{definition} |
| 1475 |
%This converts \meta{year} to the century. If \meta{year} is negative it does: |
| 1476 |
%\begin{display} |
| 1477 |
%\texttt{-\cs{DTMcentury}\{-\meta{year}\}} |
| 1478 |
%\end{display} |
| 1479 |
%Example: |
| 1480 |
%\begin{verbatim} |
| 1481 |
%\DTMcentury{1945} |
| 1482 |
%\end{verbatim} |
| 1483 |
%expands to \DTMcentury{1945} (not 19). Note that |
| 1484 |
%\begin{verbatim} |
| 1485 |
%\DTMcentury{1900} |
| 1486 |
%\end{verbatim} |
| 1487 |
%expands to \DTMcentury{1900}. |
| 1488 |
% |
| 1489 |
%\begin{definition}[\DescribeMacro\DTMdivhundred] |
| 1490 |
%\cs{DTMdivhundred}\marg{number} |
| 1491 |
%\end{definition} |
| 1492 |
%This expands to $\lfloor\meta{number}/100\rfloor$ (integer division |
| 1493 |
%by 100 rounded down). For example: |
| 1494 |
%\begin{verbatim} |
| 1495 |
%\DTMdivhundred{1945} |
| 1496 |
%\end{verbatim} |
| 1497 |
%expands to \DTMdivhundred{1945} and |
| 1498 |
%\begin{verbatim} |
| 1499 |
%\DTMdivhundred{1900} |
| 1500 |
%\end{verbatim} |
| 1501 |
%expands to \DTMdivhundred{1900}. |
| 1502 |
% |
| 1503 |
%\begin{definition}[\DescribeMacro\DTMtexorpdfstring] |
| 1504 |
%\cs{DTMtexorpdfstring}\marg{\TeX}\marg{PDF} |
| 1505 |
%\end{definition} |
| 1506 |
%If \sty{hyperref} is loaded, this is equivalent to |
| 1507 |
%\cs{texorpdfstring} otherwise it just does the first argument and |
| 1508 |
%ignores the second. (The check for \sty{hyperref} is deferred until |
| 1509 |
%the start of the \env{document} environment, so it doesn't matter if |
| 1510 |
%\sty{hyperref} is loaded after \styfmt{datetime2}.) This command may |
| 1511 |
%be used to provide alternative text to use if the date\slash |
| 1512 |
%time\slash zone is displayed in the PDF bookmarks. |
| 1513 |
% |
| 1514 |
%\begin{definition}[\DescribeMacro\DTMsep] |
| 1515 |
%\cs{DTMsep}\marg{tag} |
| 1516 |
%\end{definition} |
| 1517 |
%This accesses the value of the \meta{tag}\texttt{sep} base package |
| 1518 |
%option. (Not the language module options.) |
| 1519 |
%For example |
| 1520 |
%\begin{verbatim} |
| 1521 |
%\DTMsep{yearmonth} |
| 1522 |
%\end{verbatim} |
| 1523 |
%expands to the value supplied by the \pkgopt{yearmonthsep} package option. |
| 1524 |
% |
| 1525 |
%\begin{definition}[\DescribeMacro\DTMusezonemap] |
| 1526 |
%\cs{DTMusezonemap}\marg{TZh}\marg{TZm} |
| 1527 |
%\end{definition} |
| 1528 |
%This expands to the time zone abbreviation or \cs{relax} if no |
| 1529 |
%mapping has been set for the given time zone. |
| 1530 |
% |
| 1531 |
%You can define a time zone mapping using |
| 1532 |
%\begin{definition}[\DescribeMacro\DTMdefzonemap] |
| 1533 |
%\cs{DTMdefzonemap}\marg{TZh}\marg{TZm}\marg{abbr} |
| 1534 |
%\end{definition} |
| 1535 |
%For example |
| 1536 |
%\begin{verbatim} |
| 1537 |
%\DTMdefzonemap{00}{00}{GMT} |
| 1538 |
%\DTMdefzonemap{01}{00}{BST} |
| 1539 |
%\end{verbatim} |
| 1540 |
%Note that \styfmt{datetime2} doesn't know anything about daylight |
| 1541 |
%saving, so this is only really designed for dates and times |
| 1542 |
%in a~specific location. This overwrites any previous mapping |
| 1543 |
%for this time zone. |
| 1544 |
% |
| 1545 |
%The base \styfmt{datetime2} package provides |
| 1546 |
%\begin{definition}[\DescribeMacro\DTMNatoZoneMaps] |
| 1547 |
%\cs{DTMNatoZoneMaps} |
| 1548 |
%\end{definition} |
| 1549 |
%This defines the military\slash NATO mappings from A (Alpha time) to |
| 1550 |
%Z (Zulu time). You can use this command if you want these time zones |
| 1551 |
%(but remember to set an appropriate time zone style that uses |
| 1552 |
%the zone mappings). |
| 1553 |
% |
| 1554 |
%The language modules may provide mappings that are enabled |
| 1555 |
%when you switch to that style. For example, the \module[english]{en-GB} |
| 1556 |
%language module provides the \pkgopt{mapzone} option which, if set |
| 1557 |
%to \texttt{true}, will map +00:00 to GMT and +01:00 to BST. See the |
| 1558 |
%documentation for the language module for further details. |
| 1559 |
% |
| 1560 |
%\begin{definition}[\DescribeMacro\DTMclearmap] |
| 1561 |
%\cs{DTMclearmap}\marg{TZh}\marg{TZm} |
| 1562 |
%\end{definition} |
| 1563 |
%Clears the time zone mapping. The regional time zone styles should |
| 1564 |
%use |
| 1565 |
%\begin{definition}[\DescribeMacro\DTMresetzones] |
| 1566 |
%\cs{DTMresetzones} |
| 1567 |
%\end{definition} |
| 1568 |
%before applying any regional mappings. This defaults to nothing |
| 1569 |
%which means that any mappings previously defined by other styles |
| 1570 |
%won't be cleared. You can redefine this command if you want to clear |
| 1571 |
%any mappings that aren't relevant for other regions. |
| 1572 |
% |
| 1573 |
%You can test if a~mapping is defined using |
| 1574 |
%\begin{definition}[\DescribeMacro\DTMhaszonemap] |
| 1575 |
%\cs{DTMhaszonemap}\marg{TZh}\marg{TZm}\marg{true}\marg{false} |
| 1576 |
%\end{definition} |
| 1577 |
%This will do \meta{true} if there is a mapping defined for that time |
| 1578 |
%zone or \meta{false} otherwise. |
| 1579 |
% |
| 1580 |
%\begin{definition}[\DescribeMacro\DTMusezonemapordefault] |
| 1581 |
%\cs{DTMusezonemapordefault}\marg{TZh}\marg{TZm} |
| 1582 |
%\end{definition} |
| 1583 |
%This will use the mapping if its defined otherwise it |
| 1584 |
%will expand to the format |
| 1585 |
%\meta{TZh}\meta{HMsep}\meta{TZm} |
| 1586 |
%where \meta{HMsep}\meta{TZm} is omitted if the option |
| 1587 |
%\pkgopt{showzoneminutes} is set to \texttt{false}. The separator |
| 1588 |
%\meta{HMsep} is as given by the \pkgopt{hourminsep} option. (The |
| 1589 |
%\pkgopt{showisoZ} option isn't used here so UTC+00:00 will be |
| 1590 |
%displayed as +00:00 or +00 if there's no mapping.) |
| 1591 |
% |
| 1592 |
%Here's an example of a simple date style that just displays the year |
| 1593 |
%and month as two digits but uses the \pkgopt{yearmonthsep} option: |
| 1594 |
%\begin{verbatim} |
| 1595 |
%\newdatestyle |
| 1596 |
% {mmyy}% label |
| 1597 |
% {% definitions |
| 1598 |
% \renewcommand*{\DTMdisplaydate}[4]{% |
| 1599 |
% \DTMtwodigits{##2}\DTMsep{yearmonth}\DTMtwodigits{##1}}% |
| 1600 |
% \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 1601 |
% } |
| 1602 |
%\end{verbatim} |
| 1603 |
% |
| 1604 |
%If you want to distribute your new styles, just put the definitions |
| 1605 |
%in a package and upload it to CTAN. For example (replace |
| 1606 |
%\texttt{mystylename} with something more appropriate, and also |
| 1607 |
%change the date in the \cs{ProvidesPackage} line): |
| 1608 |
%\begin{verbatim} |
| 1609 |
% \NeedsTeXFormat{LaTeX2e} |
| 1610 |
% \ProvidesPackage{mystylename}[2014/03/24 v1.0] |
| 1611 |
% \RequirePackage{datetime2} |
| 1612 |
% |
| 1613 |
% % style definitions here |
| 1614 |
% |
| 1615 |
% \endinput |
| 1616 |
%\end{verbatim} |
| 1617 |
%Save the file as \texttt{mystylename.sty}, add some documentation |
| 1618 |
%about the style (or styles) provided and read the instructions at |
| 1619 |
%\url{http://www.ctan.org/upload} and |
| 1620 |
%\url{http://www.ctan.org/file/help/ctan/CTAN-upload-addendum}. The upload location |
| 1621 |
%for additions to the \styfmt{datetime2} package (either for |
| 1622 |
%packages defining new styles or for language modules) should be |
| 1623 |
%\texttt{/macros\slash latex\slash contrib\slash datetime2-contrib\slash mystylename} (remember to |
| 1624 |
%replace \texttt{mystylename} as appropriate). |
| 1625 |
% |
| 1626 |
%\chapter{Multi-Lingual Support} |
| 1627 |
%\label{sec:lang} |
| 1628 |
% |
| 1629 |
%If you want to use \styfmt{datetime2} with \sty{babel} or |
| 1630 |
%\sty{polyglossia}, make sure you load |
| 1631 |
%\sty{babel}\slash\sty{polyglossia} \emph{before} you load |
| 1632 |
%\styfmt{datetime2} otherwise their \cs{date}\meta{language} will |
| 1633 |
%overwrite \cs{datetime}'s definition of \cs{today}. |
| 1634 |
%\emph{Additionally} you need to make sure you install the relevant |
| 1635 |
%\styfmt{datetime2} language modules. These modules are automatically |
| 1636 |
%loaded, if required, by \styfmt{datetime2} but only if they are |
| 1637 |
%already installed. Remember that if you use \XeLaTeX\ you won't have |
| 1638 |
%the seconds or time zone available for the current date and time |
| 1639 |
%(unless you first load \sty{texosquery} and have the shell escape |
| 1640 |
%enabled). |
| 1641 |
% |
| 1642 |
%\begin{important} |
| 1643 |
%If the required language modules aren't installed or |
| 1644 |
%\styfmt{datetime2} is loaded before |
| 1645 |
%\sty{babel}\slash\sty{polyglossia} then \styfmt{datetime2}'s |
| 1646 |
%definition of \cs{today} will be overridden and may no longer match |
| 1647 |
%the currently selected date style. |
| 1648 |
%\end{important} |
| 1649 |
% |
| 1650 |
%The document languages are detected using \sty{tracklang}'s |
| 1651 |
%interface. This has limitations. In particular, it can't detect the |
| 1652 |
%region with \sty{polyglossia} nor can it detect languages specified |
| 1653 |
%after \sty{tracklang} has been loaded, and it can't pick up \sty{babel}'s new |
| 1654 |
%\cs{babelprovide} command. See the \sty{tracklang} documentation for |
| 1655 |
%further details. Please check that you have an up-to-date version of |
| 1656 |
%\sty{tracklang}. |
| 1657 |
% |
| 1658 |
%Each language module defines a textual style (where the month is |
| 1659 |
%displayed as a word) for that language or region |
| 1660 |
%which can be used in the argument of \cs{DTMsetstyle}, |
| 1661 |
%\cs{DTMsetdatestyle}, \cs{DTMsettimestyle} or \cs{DTMsetzonestyle}. |
| 1662 |
%The language module may also define a numeric style. In the |
| 1663 |
%ambiguous cases where the language name alone doesn't indicate the |
| 1664 |
%region (for example, \texttt{english} instead of \texttt{UKenglish} or |
| 1665 |
%\texttt{USenglish}) the module should use the \style{default} numeric |
| 1666 |
%style (see \sectionref{sec:predefinedfull}). |
| 1667 |
% |
| 1668 |
%The textual style provided by the module will automatically be |
| 1669 |
%set using \cs{DTMsetstyle} \emph{if the \pkgopt{useregional} |
| 1670 |
%option is set to \texttt{text}}. By default \pkgopt{useregional} is |
| 1671 |
%\texttt{false}, unless the language\slash region is passed via the |
| 1672 |
%\styfmt{datetime2} package option list. (The \pkgopt{useregional} |
| 1673 |
%option is unaffected if the setting is passed through the document |
| 1674 |
%class option list.) The numeric style provided by the module will |
| 1675 |
%automatically be set if the \pkgopt{useregional} option is set to |
| 1676 |
%\texttt{numeric}. See the descriptions for the \pkgopt{useregional} |
| 1677 |
%and \pkgopt{style} options in \sectionref{sec:pkgopt}. |
| 1678 |
% |
| 1679 |
%\begin{important} |
| 1680 |
%Be careful not to mix the language\slash region options between the document |
| 1681 |
%class option list and the \sty{babel}\slash\sty{polyglossia} |
| 1682 |
%interface. For example, don't do: |
| 1683 |
%\begin{verbatim} |
| 1684 |
%\documentclass[en-GB]{article} |
| 1685 |
%\usepackage[canadien,british]{babel} |
| 1686 |
%\end{verbatim} |
| 1687 |
%\end{important} |
| 1688 |
%The above example will prevent the \sty{tracklang} package from picking up the |
| 1689 |
%\sty{babel} setting and it will only detect the \texttt{en-GB} |
| 1690 |
%option. Use only the document class options or only the \sty{babel} |
| 1691 |
%package option list or duplicate \emph{all} the \sty{babel} package options with |
| 1692 |
%analogous \sty{tracklang} options in the document class. For example |
| 1693 |
%\begin{verbatim} |
| 1694 |
%\documentclass[canadien,british]{article} |
| 1695 |
%\usepackage{babel} |
| 1696 |
%\end{verbatim} |
| 1697 |
%or |
| 1698 |
%\begin{verbatim} |
| 1699 |
%\documentclass{article} |
| 1700 |
%\usepackage[canadien,british]{babel} |
| 1701 |
%\end{verbatim} |
| 1702 |
%or |
| 1703 |
%\begin{verbatim} |
| 1704 |
%\documentclass[fr-CA,en-GB]{article} |
| 1705 |
%\usepackage[canadien,british]{babel} |
| 1706 |
%\end{verbatim} |
| 1707 |
% |
| 1708 |
%Language modules may be used without \sty{babel} or \sty{polyglossia}. |
| 1709 |
%For example: |
| 1710 |
%\begin{verbatim} |
| 1711 |
%\documentclass{article} |
| 1712 |
%\usepackage[en-GB]{datetime2} |
| 1713 |
%\begin{document} |
| 1714 |
%\today |
| 1715 |
%\end{document} |
| 1716 |
%\end{verbatim} |
| 1717 |
%If you have more than one language or region you will need to switch |
| 1718 |
%styles using \cs{DTMsetstyle} etc if you aren't using \sty{babel} or |
| 1719 |
%\sty{polyglossia}: |
| 1720 |
%\begin{verbatim} |
| 1721 |
%\documentclass{article} |
| 1722 |
%\usepackage[en-GB,en-CA]{datetime2} |
| 1723 |
%\begin{document} |
| 1724 |
%\DTMsetstyle{en-GB}\today. |
| 1725 |
%\DTMsetstyle{en-CA}\today. |
| 1726 |
%\end{document} |
| 1727 |
%\end{verbatim} |
| 1728 |
% |
| 1729 |
%If you want to change the number separators for the \emph{regional} |
| 1730 |
%numeric styles, you need to use \cs{DTMlangsetup}. If you want to |
| 1731 |
%change the number separators for the base \styfmt{datetime2} |
| 1732 |
%predefined numeric styles (see \sectionref{sec:predefinedstyles}) |
| 1733 |
%then you need to use \cs{DTMsetup} or the package options. You |
| 1734 |
%therefore need to use \cs{DTMsetup} for the ambiguous regionless |
| 1735 |
%language numeric settings since they just use the \style{default} |
| 1736 |
%style. Check the module documentation to find out if the |
| 1737 |
%\style{default} style is used. |
| 1738 |
% |
| 1739 |
%Examples of use: |
| 1740 |
%\begin{enumerate} |
| 1741 |
%\item Language option specified through the document class and |
| 1742 |
%picked up by \sty{tracklang} (which is loaded by \styfmt{datetime2}). |
| 1743 |
%This setting is also picked up by \sty{babel} which is loaded before |
| 1744 |
%\styfmt{datetime2}. |
| 1745 |
%\begin{verbatim} |
| 1746 |
%\documentclass[british]{article} |
| 1747 |
% |
| 1748 |
%\usepackage{babel} |
| 1749 |
%\usepackage{datetime2} |
| 1750 |
% |
| 1751 |
%\begin{document} |
| 1752 |
%\today |
| 1753 |
%\end{document} |
| 1754 |
%\end{verbatim} |
| 1755 |
%The date is displayed in the default format 2015-03-01. |
| 1756 |
% |
| 1757 |
%In this case, the \texttt{en-GB} language module is loaded which |
| 1758 |
%defines the text style \style{en-GB} and the numeric style |
| 1759 |
%\style{en-GB-numeric}. Since \pkgopt{useregional} hasn't been set, |
| 1760 |
%\cs{today} uses \styfmt{datetime2}'s \style{default} numerical format. |
| 1761 |
%If \sty{babel} was loaded after \styfmt{datetime2}, the |
| 1762 |
%\sty{babel}'s hook management system would overwrite |
| 1763 |
%\styfmt{datetime2}'s definition of \cs{today} so that it no longer used |
| 1764 |
%\ics{DTMdisplaydate}. A similar result is obtained if in the above |
| 1765 |
%example \sty{babel} is replaced with \sty{polyglossia} (where the |
| 1766 |
%language is set in the document class option). |
| 1767 |
% |
| 1768 |
%You can change the \pkgopt{useregional} setting either through |
| 1769 |
%\styfmt{datetime2}'s package options or using \ics{DTMsetup} however |
| 1770 |
%it will only have an effect during the module loading (when the |
| 1771 |
%value is changed via the package option) and when |
| 1772 |
%\cs{date}\meta{language} is used. An alternative is to use |
| 1773 |
%\cs{DTMsetregional} which will also do \cs{date}\meta{language} if |
| 1774 |
%it is available |
| 1775 |
%(where \meta{language} is the current value of \cs{languagename}) |
| 1776 |
%otherwise it will iterate through the list of known |
| 1777 |
%dialects and try to set each one in turn. |
| 1778 |
% |
| 1779 |
%\begin{important} |
| 1780 |
%This means that using \cs{DTMsetregional} may cause |
| 1781 |
%the style to change to a different region if you have multiple |
| 1782 |
%regions defined. |
| 1783 |
%\end{important} |
| 1784 |
% |
| 1785 |
%For example, in the document below, the date is displayed using the |
| 1786 |
%\style{default} numeric format because \pkgopt{useregional} has been |
| 1787 |
%changed \emph{after} \sty{babel} uses \cs{datebritish} to set the |
| 1788 |
%language at the start of the document. |
| 1789 |
%\begin{verbatim} |
| 1790 |
%\documentclass[british]{article} |
| 1791 |
% |
| 1792 |
%\usepackage{babel} |
| 1793 |
%\usepackage{datetime2} |
| 1794 |
% |
| 1795 |
%\begin{document} |
| 1796 |
%\DTMsetup{useregional} |
| 1797 |
%\today |
| 1798 |
%\end{document} |
| 1799 |
%\end{verbatim} |
| 1800 |
%So here \cs{today} again displays the date in the form 2015-03-01. |
| 1801 |
% |
| 1802 |
%If the setting is moved to the preamble: |
| 1803 |
%\begin{verbatim} |
| 1804 |
%\documentclass[british]{article} |
| 1805 |
% |
| 1806 |
%\usepackage{babel} |
| 1807 |
%\usepackage{datetime2} |
| 1808 |
% |
| 1809 |
%\DTMsetup{useregional} |
| 1810 |
%\begin{document} |
| 1811 |
%\today |
| 1812 |
%\end{document} |
| 1813 |
%\end{verbatim} |
| 1814 |
%then the \pkgopt{useregional} setting is checked at the beginning of |
| 1815 |
%the document when \sty{babel} uses \cs{datebritish}. So in this case |
| 1816 |
%\cs{today} will display the date in the form 1st March 2015. |
| 1817 |
% |
| 1818 |
%\item Language setting specified through \sty{babel}'s package |
| 1819 |
%option list: |
| 1820 |
%\begin{verbatim} |
| 1821 |
%\documentclass{article} |
| 1822 |
% |
| 1823 |
%\usepackage[british]{babel} |
| 1824 |
%\usepackage{datetime2} |
| 1825 |
% |
| 1826 |
%\begin{document} |
| 1827 |
%\today |
| 1828 |
%\end{document} |
| 1829 |
%\end{verbatim} |
| 1830 |
%This has the same result as placing \texttt{british} in the document |
| 1831 |
%class option list, so the date is again displayed in the default |
| 1832 |
%format 2015-03-01 but, as in the previous example, the \style{en-GB} |
| 1833 |
%and \style{en-GB-numeric} styles are both defined if required. |
| 1834 |
% |
| 1835 |
%However a problem occurs if \sty{babel} is replaced by |
| 1836 |
%\sty{polyglossia}: |
| 1837 |
%\begin{verbatim} |
| 1838 |
%\documentclass{article} |
| 1839 |
% |
| 1840 |
%\usepackage{fontspec} |
| 1841 |
%\usepackage{polyglossia} |
| 1842 |
%\setdefaultlanguage[variant=uk]{english} |
| 1843 |
% |
| 1844 |
%\usepackage{datetime2} |
| 1845 |
% |
| 1846 |
%\begin{document} |
| 1847 |
%\today |
| 1848 |
%\end{document} |
| 1849 |
%\end{verbatim} |
| 1850 |
%In this case \sty{tracklang} is unable to pick up the variant and |
| 1851 |
%can only detect the root language, so it will load the generic |
| 1852 |
%\module{english} module instead of the \texttt{en-GB} module. This |
| 1853 |
%means that the \style{en-GB} and \style{en-GB-numeric} styles are no longer |
| 1854 |
%available. However, since \pkgopt{useregional} is \texttt{false} the |
| 1855 |
%date is still displayed using the \texttt{default} numeric style |
| 1856 |
%in the form 2015-03-01. |
| 1857 |
% |
| 1858 |
%\item As mentioned above neither \sty{babel} nor \sty{polyglossia} are required in |
| 1859 |
%order to use the \styfmt{datetime2} language modules. You can simply |
| 1860 |
%supply the language setting in the package option list: |
| 1861 |
%\begin{verbatim} |
| 1862 |
%\documentclass{article} |
| 1863 |
% |
| 1864 |
%\usepackage[british]{datetime2} |
| 1865 |
% |
| 1866 |
%\begin{document} |
| 1867 |
%\today |
| 1868 |
%\end{document} |
| 1869 |
%\end{verbatim} |
| 1870 |
%This additionally sets \pkgopt[true]{useregional} (since the |
| 1871 |
%language is in the package option list not the document class option |
| 1872 |
%list) so the date produced by \cs{today} now uses the \texttt{en-GB} |
| 1873 |
%date style in the form 1st March 2015. |
| 1874 |
% |
| 1875 |
%\item The regional numeric format can be used instead if |
| 1876 |
%\pkgopt{useregional} is set to \texttt{numeric}: |
| 1877 |
%\begin{verbatim} |
| 1878 |
%\documentclass{article} |
| 1879 |
% |
| 1880 |
%\usepackage[british,useregional=numeric]{datetime2} |
| 1881 |
% |
| 1882 |
%\begin{document} |
| 1883 |
%\today |
| 1884 |
%\end{document} |
| 1885 |
%\end{verbatim} |
| 1886 |
%This now displays the date in the form 1/3/2015. |
| 1887 |
%\end{enumerate} |
| 1888 |
% |
| 1889 |
%Many of the language options have synonyms. In addition to the |
| 1890 |
%\sty{babel} synonyms (such as \pkgopt{british} or |
| 1891 |
%\pkgopt{UKenglish}) the \sty{tracklang} package provides options in |
| 1892 |
%ISO form, such as \pkgopt{en-GB}. Note that the style name provided |
| 1893 |
%by each language module is independent of the package option used |
| 1894 |
%to select that style. So regardless of whether you use |
| 1895 |
%\pkgopt{british}, \pkgopt{UKenglish} or \pkgopt{en-GB}, the text style |
| 1896 |
%name is \style{en-GB} and the numeric style name is |
| 1897 |
%\style{en-GB-numeric}. If just \pkgopt{english} is used, the text |
| 1898 |
%style name is \style{english} but the numeric style is |
| 1899 |
%\style{default}. |
| 1900 |
% |
| 1901 |
%Languages where the region is automatically implied, such |
| 1902 |
%as \pkgopt{scottish}, provide a text style with the root language |
| 1903 |
%name (\style{scottish} in this instance) and a numeric style in the |
| 1904 |
%form \meta{language}\texttt{-numeric} (such as \style{scottish-numeric}). |
| 1905 |
%Note that the \module{irish} module has regionless styles \texttt{irish} and |
| 1906 |
%\texttt{irish-numeric} but also has regional styles |
| 1907 |
%\texttt{ga-IE} and \texttt{ga-IE-numeric} (for the Republic of |
| 1908 |
%Ireland) and \texttt{ga-GB} and \texttt{ga-GB-numeric} (for Northern |
| 1909 |
%Ireland). In this case the regionless style has a numeric style |
| 1910 |
%instead of using the \style{default} style since both |
| 1911 |
%\texttt{ga-IE-numeric} and \texttt{ga-GB-numeric} are the same so |
| 1912 |
%there's no ambiguity. The only difference in the three modules |
| 1913 |
%\texttt{datetime2-irish}, \texttt{datetime2-ga-IE} and |
| 1914 |
%\texttt{datetime2-ga-GB} is the time zone mappings. |
| 1915 |
% |
| 1916 |
%The language or regional modules may provide additional settings that can be |
| 1917 |
%applied using |
| 1918 |
%\begin{definition}[\DescribeMacro\DTMlangsetup] |
| 1919 |
%\cs{DTMlangsetup}\oarg{module-name list}\marg{options} |
| 1920 |
%\end{definition} |
| 1921 |
%where \meta{module-name list} is a comma-separated list of |
| 1922 |
%modules that have previously been loaded (such as \texttt{en-GB,en-US}) |
| 1923 |
%and \meta{options} is a \meta{key}=\meta{value} list of options. |
| 1924 |
% |
| 1925 |
%\begin{important} |
| 1926 |
%Note that the names in the \meta{module-name list} are |
| 1927 |
%the identifying names of the module (such as \module[english]{en-GB} or |
| 1928 |
%\module{english}) |
| 1929 |
%which aren't necessarily the same as the language name supplied |
| 1930 |
%to whatever language package you are using (such as \sty{babel} or |
| 1931 |
%\sty{polyglossia}). The code for each module should be in the file |
| 1932 |
%\texttt{datetime2-\meta{module-name}.ldf}, which should be in TeX's |
| 1933 |
%path. |
| 1934 |
%\end{important} |
| 1935 |
% |
| 1936 |
%If \meta{module-name list} is omitted, then the list of all loaded |
| 1937 |
%modules is assumed. There is also a starred version |
| 1938 |
%of this command (as from v1.3) which suppresses the warning |
| 1939 |
%if the given \meta{options} aren't available for any of |
| 1940 |
%the modules named in \meta{module-name list}. You may prefer |
| 1941 |
%to use the starred version if you omit \meta{module-name list} |
| 1942 |
%to skip the warnings from the base modules that don't support the |
| 1943 |
%given options. |
| 1944 |
% |
| 1945 |
%The modules may also provided |
| 1946 |
%user commands to further customise the style. These settings should |
| 1947 |
%all be described in the module's documentation, which should be |
| 1948 |
%accessible via \texttt{texdoc datetime2-\meta{language}} where |
| 1949 |
%\meta{language} is the root language name in lower case |
| 1950 |
%(such as \texttt{english}). |
| 1951 |
% |
| 1952 |
%Note that although I~maintain the \styfmt{datetime2} English |
| 1953 |
%language module, I~don't maintain the other modules. If you have an |
| 1954 |
%issue with one of the other modules, please contact the module |
| 1955 |
%maintainer. If there is no maintainer, feel free to volunteer to |
| 1956 |
%take over the maintenance (\href{http://www.dickimaw-books.com/contact.html}{send me a |
| 1957 |
%message}). If there's no module for your language |
| 1958 |
%you can create your own module and upload it to CTAN in the |
| 1959 |
%\texttt{/macros\slash latex\slash contrib\slash datetime2-contrib\slash |
| 1960 |
%datetime2-\meta{language}} directory. |
| 1961 |
% |
| 1962 |
%You can use the English or Irish modules as a template for a |
| 1963 |
%language with multiple regions. Just download the English source |
| 1964 |
%files |
| 1965 |
%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-english/datetime2-english.dtx}{\texttt{datetime2-english.dtx}} and |
| 1966 |
%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-english/datetime2-english.ins}{\texttt{datetime2-english.ins}} or the Irish source files |
| 1967 |
%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-irish/datetime2-irish.dtx}{\texttt{datetime2-irish.dtx}} |
| 1968 |
%and |
| 1969 |
%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-irish/datetime2-irish.ins}{\texttt{datetime2-irish.ins}} from |
| 1970 |
%CTAN and make the appropriate modifications. Alternatively you can |
| 1971 |
%use the Scottish module as a template for a single-region language. |
| 1972 |
%Just download the Scottish source files |
| 1973 |
%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-scottish/datetime2-scottish.dtx}{\texttt{datetime2-scottish.dtx}} and |
| 1974 |
%\href{http://mirror.ctan.org/macros/latex/contrib/datetime2-contrib/datetime2-scottish/datetime2-scottish.ins}{\texttt{datetime2-scottish.ins}} from CTAN and make the appropriate |
| 1975 |
%modifications. (Don't forget to provide a README file.) |
| 1976 |
% |
| 1977 |
%Each language module should be in a file named |
| 1978 |
%\texttt{datetime2-\meta{lang}.ldf} where \meta{lang} is either the language |
| 1979 |
%name or in the form \meta{language ISO code}\texttt{-}\meta{country ISO code}. (See the |
| 1980 |
%\sty{tracklang} documentation for further details of the naming |
| 1981 |
%scheme.) |
| 1982 |
% |
| 1983 |
%A regional module may load a base module for the same language using |
| 1984 |
%\begin{definition}[\DescribeMacro\RequireDateTimeModule] |
| 1985 |
%\cs{RequireDateTimeModule}\marg{name} |
| 1986 |
%\end{definition} |
| 1987 |
%This will input the file \texttt{datetime2-\meta{name}.ldf}. This command |
| 1988 |
%should not be used outside the \styfmt{datetime2} language module files. |
| 1989 |
%If you are creating a package that explicitly needs to load one of these files, |
| 1990 |
%then you can use: |
| 1991 |
%\begin{definition}[\DescribeMacro\DTMusemodule] |
| 1992 |
%\cs{DTMusemodule}\marg{language}\marg{name} |
| 1993 |
%\end{definition} |
| 1994 |
%where \meta{language} is the \sty{babel} or \sty{polyglossia} language or |
| 1995 |
%dialect name that identifies the relevant \cs{date\meta{language}} |
| 1996 |
%macro (for example, \texttt{english}) and \meta{name} is the same as |
| 1997 |
%above (for example, \texttt{en-GB}). |
| 1998 |
% |
| 1999 |
%Note that \cs{RequireDateTimeModule} (which is also internally used |
| 2000 |
%by \cs{DTMusemodule}) stores a mapping from the language name |
| 2001 |
%and the module name. You can determine what module was loaded |
| 2002 |
%for a given dialect name using |
| 2003 |
%\begin{definition}[\DescribeMacro\DTMdialecttomodulemap] |
| 2004 |
%\cs{DTMdialecttomodulemap}\marg{dialect} |
| 2005 |
%\end{definition} |
| 2006 |
%This expands to the required module name or \cs{relax} if the |
| 2007 |
%given dialect name wasn't used to load a module. |
| 2008 |
%For example: |
| 2009 |
%\begin{verbatim} |
| 2010 |
%\documentclass{article} |
| 2011 |
%\usepackage[british]{datetime2} |
| 2012 |
% |
| 2013 |
%\begin{document} |
| 2014 |
% |
| 2015 |
%british map: \DTMdialecttomodulemap{british}. |
| 2016 |
%english map: \DTMdialecttomodulemap{english}. |
| 2017 |
% |
| 2018 |
%\end{document} |
| 2019 |
%\end{verbatim} |
| 2020 |
%This produces: |
| 2021 |
%\begin{quote} |
| 2022 |
%british map: en-GB. |
| 2023 |
%english map: . |
| 2024 |
%\end{quote} |
| 2025 |
%In the above, the second instance expands to \cs{relax}. |
| 2026 |
% |
| 2027 |
%\begin{important} |
| 2028 |
%If you want to provide a language module don't assume all users want |
| 2029 |
%to use the same input encoding or \sty{babel} shorthands as you. Use \LaTeX\ |
| 2030 |
%commands for non-ASCII characters (and remember to use \cs{protect} |
| 2031 |
%where necessary). |
| 2032 |
%\end{important} |
| 2033 |
% |
| 2034 |
%As an addendum to the above warning, Lua\TeX\ and \XeTeX\ support |
| 2035 |
%UTF-8 characters without the need to make them active, so |
| 2036 |
%I~recommend you provide two files: one with the \LaTeX\ commands, |
| 2037 |
%such as \cs{c}, for (PDF)\LaTeX\ users, and one with UTF-8 characters |
| 2038 |
%for Lua\LaTeX\ and \XeLaTeX\ users. For example, the \texttt{fr-FR} module |
| 2039 |
%could start with: |
| 2040 |
%\begin{verbatim} |
| 2041 |
%\ProvidesDateTimeModule{fr-FR} |
| 2042 |
% |
| 2043 |
%\RequirePackage{ifxetex,ifluatex} |
| 2044 |
% |
| 2045 |
%\ifxetex |
| 2046 |
% \RequireDateTimeModule{french-utf8} |
| 2047 |
%\else |
| 2048 |
% \ifluatex |
| 2049 |
% \RequireDateTimeModule{french-utf8} |
| 2050 |
% \else |
| 2051 |
% \RequireDateTimeModule{french-ascii} |
| 2052 |
% \fi |
| 2053 |
%\fi |
| 2054 |
%\end{verbatim} |
| 2055 |
% |
| 2056 |
%This helps provide fully expandable dates for Lua\LaTeX\ and |
| 2057 |
%\XeLaTeX\ users. (See the Scottish or Irish modules for examples.) |
| 2058 |
% |
| 2059 |
%\chapter{Standalone Month or Weekday Names} |
| 2060 |
%\label{sec:names} |
| 2061 |
% |
| 2062 |
%\begin{important} |
| 2063 |
%If you want the month name or weekday name to appear in a section |
| 2064 |
%or chapter heading, it's best to use the expandable commands |
| 2065 |
%provided by the language modules rather than the robust commands |
| 2066 |
%provided by \styfmt{datetime2-calc}. Remember that you can't use robust |
| 2067 |
%commands in PDF bookmarks and such commands may prevent case-changing in |
| 2068 |
%headers for page styles that use \cs{MakeUppercase}. |
| 2069 |
%\end{important} |
| 2070 |
% |
| 2071 |
%The language or regional modules described in |
| 2072 |
%\sectionref{sec:lang} typically provide an expandable command |
| 2073 |
%\begin{definition} |
| 2074 |
%\cs{DTM\meta{root-language}monthname}\marg{n} |
| 2075 |
%\end{definition} |
| 2076 |
%which takes a numerical argument that indicates the month number. |
| 2077 |
%This command is used in the date style which ensures that even if |
| 2078 |
%the document language has switched but not the date style, then |
| 2079 |
%the month name will be in the correct language for that style. |
| 2080 |
%(Otherwise you could end up with a mix of style from one dialect |
| 2081 |
%using names from another language, which was one of the problems |
| 2082 |
%with the original \styfmt{datetime} package.) |
| 2083 |
% |
| 2084 |
%For example, if the \module{english} module is loaded (which is |
| 2085 |
%automatically loaded by the English dialect modules, such as |
| 2086 |
%\module[english]{en-GB}) then the command \cs{DTMenglishmonthname} is |
| 2087 |
%defined. So if you're writing in English and you want to display |
| 2088 |
%just the |
| 2089 |
%month name, then you can do: |
| 2090 |
%\begin{verbatim} |
| 2091 |
%\DTMenglishmonthname{1} |
| 2092 |
%\end{verbatim} |
| 2093 |
%Some language modules, where month names aren't automatically |
| 2094 |
%capitalised, may additionally define a version that |
| 2095 |
%has the first letter in upper case. For example, the \module{french} |
| 2096 |
%module defines \cs{DTMfrenchMonthname} in addition to |
| 2097 |
%\cs{DTMfrenchmonthname}. |
| 2098 |
% |
| 2099 |
%Some of the modules may have other alternatives. For example, |
| 2100 |
%the \module{serbian} module provides Cyrillic |
| 2101 |
%(\cs{DTMserbiancyrmonthname}) and Latin |
| 2102 |
%(\cs{DTMserbianlatinmonthname}) |
| 2103 |
%month names. It also provides \cs{DTMserbianmonthname}, which |
| 2104 |
%defaults to \cs{DTMserbiancyrmonthname} but can be redefined |
| 2105 |
%using \cs{DTMlangsetup}. |
| 2106 |
% |
| 2107 |
%To find out the available commands for the module you are using, |
| 2108 |
%see that module's documentation. |
| 2109 |
% |
| 2110 |
%If you are writing a document that uses multiple languages |
| 2111 |
%and you simply want to display the month name in the currently |
| 2112 |
%selected language, then you can use the robust command |
| 2113 |
%\begin{definition} |
| 2114 |
%\ics{DTMmonthname}\marg{n} |
| 2115 |
%\end{definition} |
| 2116 |
%provided by the \styfmt{datetime2-calc} package, |
| 2117 |
%described in \sectionref{sec:calc}. Remember that the |
| 2118 |
%\styfmt{datetime2-calc} package also loads the \sty{pgfcalendar} |
| 2119 |
%package, which provides the expandable command |
| 2120 |
%\cs{pgfcalendarmonthname}. (The \sty{pgfcalendar} package provides |
| 2121 |
%multilingual support via the \sty{translator} package.) |
| 2122 |
% |
| 2123 |
%Some of the language modules additionally provide a command |
| 2124 |
%that displays the first letter in upper case. This isn't provided |
| 2125 |
%for languages where the month name is always displayed with |
| 2126 |
%a capital first letter, such as in English. For example, |
| 2127 |
%the \module{serbian} module also defines |
| 2128 |
%\cs{DTMserbiancyrMonthname} and \cs{DTMserbianlatinMonthname}, |
| 2129 |
%with \cs{DTMserbianMonthname} initially defined to use |
| 2130 |
%the Cyrillic version. |
| 2131 |
% |
| 2132 |
%So, if you specifically want to display the Serbian Cyrillic |
| 2133 |
%month name with the first letter in upper case, you need to |
| 2134 |
%make sure the \module{serbian} module is loaded |
| 2135 |
%and then use the provided \cs{DTMserbiancyrMonthname} command. |
| 2136 |
% |
| 2137 |
%If you want the month name to vary according to the current language |
| 2138 |
%setting in the document, you can use the robust command |
| 2139 |
%\begin{definition} |
| 2140 |
%\cs{DTMMonthname}\marg{n} |
| 2141 |
%\end{definition} |
| 2142 |
%provided by \styfmt{datetime2-calc}, which will first |
| 2143 |
%attempt \cs{DTM\meta{language}Monthname} and then |
| 2144 |
%\cs{DTM\meta{language}monthname} before falling back on the |
| 2145 |
%\cs{pgfcalendarmonthname}, see \sectionref{sec:calc} for further |
| 2146 |
%details. |
| 2147 |
% |
| 2148 |
%Some, but not all, language modules provide a command (or commands) |
| 2149 |
%for month name abbreviations. It's up to the maintainer of the |
| 2150 |
%module to add these if they currently aren't provided. You will |
| 2151 |
%need to check the module documentation to find out if abbreviations |
| 2152 |
%are supported. If they are supported, they should be in |
| 2153 |
%the form |
| 2154 |
%\begin{definition} |
| 2155 |
%\cs{DTM\meta{root-language}shortmonthname}\marg{n} |
| 2156 |
%\end{definition} |
| 2157 |
%Again there may be variations, such as new and old styles or alternative |
| 2158 |
%alphabets. For example, the \module{english} module |
| 2159 |
%provides \cs{DTMenglishshortmonthname}. |
| 2160 |
% |
| 2161 |
%As with the full form, if you want to display the abbreviation |
| 2162 |
%in a specific language (or variation), then use the command |
| 2163 |
%provided by the relevant language module. If you want the |
| 2164 |
%abbreviation to pick up the current language, then you can |
| 2165 |
%use the robust command |
| 2166 |
%\begin{definition} |
| 2167 |
%\cs{DTMshortmonthname}\marg{n} |
| 2168 |
%\end{definition} |
| 2169 |
%provided by the \styfmt{datetime2-calc} package. This will fall back on |
| 2170 |
%\cs{pgfcalendarmonthshortname} if |
| 2171 |
%\cs{DTM\meta{language}shortmonthname} isn't defined. See |
| 2172 |
%\sectionref{sec:calc} for further details. |
| 2173 |
% |
| 2174 |
%Modules may additionally provide a version of the abbreviated |
| 2175 |
%form that starts with a capital letter. This should typically |
| 2176 |
%be in the form |
| 2177 |
%\begin{definition} |
| 2178 |
%\cs{DTM\meta{root-language}shortMonthname}\marg{n} |
| 2179 |
%\end{definition} |
| 2180 |
%Check the module documentation to see if this is provided. |
| 2181 |
%Again, the \styfmt{datetime2-calc} package provides a robust command |
| 2182 |
%\begin{definition} |
| 2183 |
%\cs{DTMshortMonthname}\marg{n} |
| 2184 |
%\end{definition} |
| 2185 |
%that attempts to determine the relevant |
| 2186 |
%module command from the language name. |
| 2187 |
% |
| 2188 |
%Language modules may or may not provide a command that displays |
| 2189 |
%the weekday name. As with the month name, there may or may not |
| 2190 |
%be an abbreviated version or capital first letter version |
| 2191 |
%or variations such as new\slash old styles. |
| 2192 |
%Check the module documentation for further details. If |
| 2193 |
%the module doesn't provide a weekday name macro, then the |
| 2194 |
%provided styles won't support the \pkgopt{showdow} option. |
| 2195 |
% |
| 2196 |
%\emph{If} the module provides weekday name support, then |
| 2197 |
%the name will typically be provided by a macro in the form |
| 2198 |
%\begin{definition} |
| 2199 |
%\cs{DTM\meta{root-language}weekdayname}\marg{n} |
| 2200 |
%\end{definition} |
| 2201 |
%where \meta{n} is an integer from 0 (Monday) to 6 (Sunday). |
| 2202 |
%For example, the \module{english} module provides |
| 2203 |
%\cs{DTMenglishweekdayname}. |
| 2204 |
% |
| 2205 |
%Again, the \styfmt{datetime2-calc} package provides \emph{robust} |
| 2206 |
%commands that attempt to find the relevant module-provided |
| 2207 |
%command based on the current language. If not found, |
| 2208 |
%the fallback commands are those provided by the \sty{pgfcalendar} |
| 2209 |
%package. See \sectionref{sec:calc} for further details. |
| 2210 |
% |
| 2211 |
%\chapter{Package Options} |
| 2212 |
%\label{sec:pkgopt} |
| 2213 |
% |
| 2214 |
%The following package options are provided. Most of these are |
| 2215 |
%\meta{key}=\meta{value} options, unless stated otherwise. |
| 2216 |
% |
| 2217 |
%Settings that govern the predefined numerical styles (not including |
| 2218 |
%the fixed styles \style{iso} and \style{pdf}): |
| 2219 |
%\begin{description} |
| 2220 |
%\item[\pkgopt{yearmonthsep}] This sets the separator between the |
| 2221 |
%year and month for the big-endian and little-endian styles. |
| 2222 |
%Default: \texttt{-} (hyphen). |
| 2223 |
%Note that if you want a space as a separator you need to use \cs{space}. |
| 2224 |
%If you simply use a space character (for example, \verb|yearmonthsep={ }|) |
| 2225 |
%then the separator will be discarded. The same applies for the other separators described below. |
| 2226 |
% |
| 2227 |
%\item[\pkgopt{monthdaysep}] This sets the separator between the |
| 2228 |
%month and day. |
| 2229 |
%Default: \texttt{-} (hyphen). |
| 2230 |
% |
| 2231 |
%\item[\pkgopt{dayyearsep}] This sets the separator between the |
| 2232 |
%day and year for the middle-endian styles. |
| 2233 |
%Default: \texttt{-} (hyphen). |
| 2234 |
% |
| 2235 |
%\item[\pkgopt{datesep}] This sets the separators between the day and |
| 2236 |
%month, the month and year, and the day and year. Example: |
| 2237 |
%\begin{verbatim} |
| 2238 |
%\usepackage[datesep=/]{datetime2} |
| 2239 |
%\end{verbatim} |
| 2240 |
%This is equivalent to: |
| 2241 |
%\begin{verbatim} |
| 2242 |
%\usepackage[yearmonthsep=/,monthdaysep=/,dayyearsep=/]{datetime2} |
| 2243 |
%\end{verbatim} |
| 2244 |
% |
| 2245 |
%\item[\pkgopt{hourminsep}] This sets the separator between the hour |
| 2246 |
%and minute. (Both for the time and for the zone.) |
| 2247 |
%Default: \texttt{:} (colon). |
| 2248 |
% |
| 2249 |
%\item[\pkgopt{minsecsep}] This sets the separator between the minute |
| 2250 |
%and seconds. |
| 2251 |
%Default: \texttt{:} (colon). |
| 2252 |
% |
| 2253 |
%\item[\pkgopt{timesep}] This sets the separators between the hour |
| 2254 |
%and minute and between the minute and seconds. |
| 2255 |
%Example: |
| 2256 |
%\begin{verbatim} |
| 2257 |
%\usepackage[timesep=:]{datetime2} |
| 2258 |
%\end{verbatim} |
| 2259 |
%This is equivalent to: |
| 2260 |
%\begin{verbatim} |
| 2261 |
%\usepackage[hourminsep=:,minsecsep=:]{datetime2} |
| 2262 |
%\end{verbatim} |
| 2263 |
%\end{description} |
| 2264 |
% |
| 2265 |
%The following settings are used by the predefined numerical styles when |
| 2266 |
%displaying the full date, time and zone (excluding the fixed styles \style{iso} |
| 2267 |
%and \style{pdf}) with commands that use \cs{DTMdisplay} or |
| 2268 |
%\cs{DTMDisplay}. |
| 2269 |
%\begin{description} |
| 2270 |
%\item[\pkgopt{datetimesep}] Sets the separator between the date and |
| 2271 |
%time. |
| 2272 |
%Default: \cs{space}. |
| 2273 |
% |
| 2274 |
%\item[\pkgopt{timezonesep}] Sets the separator between the time and |
| 2275 |
%zone. |
| 2276 |
%Default: empty. |
| 2277 |
% |
| 2278 |
%\end{description} |
| 2279 |
% |
| 2280 |
%The following settings are used by the predefined styles and may |
| 2281 |
%also be used by the language modules. |
| 2282 |
%\begin{description} |
| 2283 |
%\item[\pkgopt{showseconds}] Boolean key to determine whether or not |
| 2284 |
%to show the seconds when the time is displayed. The \style{iso} |
| 2285 |
%style honours this setting but the \style{pdf} style ignores it. |
| 2286 |
%Default: \texttt{true} unless \XeTeX\ is used (and \sty{texosquery} |
| 2287 |
%hasn't first been loaded with shell escape enabled). |
| 2288 |
% |
| 2289 |
%\item[\pkgopt{showdate}] Boolean key to determine whether or not to |
| 2290 |
%show the date with commands that use \cs{DTMdisplay} or |
| 2291 |
%\cs{DTMDisplay}. (Some styles may ignore this.) The \style{iso} |
| 2292 |
%style honours this setting but the \style{pdf} style ignores it. |
| 2293 |
%Default: \texttt{true}. |
| 2294 |
% |
| 2295 |
%\item[\pkgopt{showzone}] Boolean key to determine whether or not to |
| 2296 |
%show the time zone with commands that use |
| 2297 |
%\cs{DTMdisplay} or \cs{DTMDisplay}. (Some styles may ignore this.) The \style{iso} style honours this setting but the |
| 2298 |
%\style{pdf} style ignores it. |
| 2299 |
%Default: \texttt{true} unless \XeTeX\ is used (and \sty{texosquery} |
| 2300 |
%hasn't first been loaded with shell escape enabled). |
| 2301 |
% |
| 2302 |
%\item[\pkgopt{showzoneminutes}] Boolean key to determine whether or |
| 2303 |
%not to show the zone offset minutes. The \style{iso} style honours |
| 2304 |
%this setting but the \style{pdf} style ignores it. This setting is |
| 2305 |
%ignored if \pkgopt{showzone} is \texttt{false}. |
| 2306 |
%Default: \texttt{true}. |
| 2307 |
% |
| 2308 |
%\item[\pkgopt{showisoZ}] Boolean key to determine whether or not to |
| 2309 |
%show UTC+00:00 as \texttt{Z} instead of numerically. This option |
| 2310 |
%may be ignored by zone styles that use the zone mappings. If you |
| 2311 |
%want all the time zones in military form, you can use |
| 2312 |
%\cs{DTMNatoZoneMaps} to set up the time zone abbreviations and then |
| 2313 |
%use a zone style that uses the mappings. |
| 2314 |
%Default: \texttt{true}. |
| 2315 |
% |
| 2316 |
%\end{description} |
| 2317 |
% |
| 2318 |
%General settings: |
| 2319 |
%\begin{description} |
| 2320 |
%\item[\pkgopt{useregional}] Allowed values: \texttt{false}, |
| 2321 |
%\texttt{text} or \texttt{numeric}. You may also use \texttt{num} as |
| 2322 |
%an abbreviation for \texttt{numeric}. If no value is supplied |
| 2323 |
%\texttt{text} is assumed. |
| 2324 |
% |
| 2325 |
%\begin{important} |
| 2326 |
%If you haven't loaded \sty{babel} or \sty{polyglossia}, this |
| 2327 |
%key only has an effect when used as a package option. Consider |
| 2328 |
%instead using \cs{DTMsetregional}. |
| 2329 |
%\end{important} |
| 2330 |
% |
| 2331 |
%This key determines whether or not to \emph{use} the loaded regional |
| 2332 |
%settings and, if the regional setting should be used, it determines |
| 2333 |
%whether the text style (months as words) or numeric style should be |
| 2334 |
%used. If you have loaded one of those packages, the change comes |
| 2335 |
%into effect at module load time and whenever |
| 2336 |
%\cs{date}\meta{language} is used (which includes at the beginning of |
| 2337 |
%the \env{document} environment). If you want to switch the style at |
| 2338 |
%any other time, you need to use \cs{DTMsetstyle} but unless |
| 2339 |
%\pkgopt[false]{useregional} the next instance of |
| 2340 |
%\cs{date}\meta{language} will change the style. |
| 2341 |
% |
| 2342 |
%Note that setting this option to \texttt{false} doesn't prevent the modules |
| 2343 |
%from being loaded. It just prevents them from automatically setting the style |
| 2344 |
%and prevents \cs{date}\meta{language} from changing the style if you |
| 2345 |
%are using \sty{babel} or \sty{polyglossia}. |
| 2346 |
% |
| 2347 |
%The default value is \texttt{false} unless the language or region is |
| 2348 |
%passed to the \styfmt{datetime2} package option list. However, using \pkgopt{style} |
| 2349 |
%will set \pkgopt{useregional} to \texttt{false}. |
| 2350 |
% |
| 2351 |
%If you want to change this value after the language modules have |
| 2352 |
%been loaded, instead of using \cs{DTMsetup}, you can use |
| 2353 |
%\begin{definition}[\DescribeMacro\DTMsetregional] |
| 2354 |
%\cs{DTMsetregional}\oarg{value} |
| 2355 |
%\end{definition} |
| 2356 |
%This will do \texttt{\cs{DTMsetup}\{userregional=\meta{value}\}}. |
| 2357 |
%Then if \meta{value} is \texttt{false}, it will set the |
| 2358 |
%\texttt{default} style otherwise it will use \cs{date}\meta{lang} if |
| 2359 |
%it's defined (where \meta{lang} is given by \cs{languagename}). If |
| 2360 |
%\cs{date}\meta{lang} isn't defined, it will iterate over the list of |
| 2361 |
%dialects associated with the document and use \cs{DTMtryregional} |
| 2362 |
%for each dialect. If \meta{value} is omitted, \texttt{text} is |
| 2363 |
%assumed. |
| 2364 |
% |
| 2365 |
%Examples: |
| 2366 |
%\begin{verbatim} |
| 2367 |
%\documentclass[british]{article} |
| 2368 |
%\usepackage{babel} |
| 2369 |
%\usepackage{datetime2} |
| 2370 |
%\end{verbatim} |
| 2371 |
%In the above \pkgopt{useregional} is \texttt{false}. |
| 2372 |
% |
| 2373 |
%\begin{verbatim} |
| 2374 |
%\documentclass{article} |
| 2375 |
%\usepackage[british]{datetime2} |
| 2376 |
%\end{verbatim} |
| 2377 |
%In the above \pkgopt{useregional} is \texttt{text}. |
| 2378 |
% |
| 2379 |
%\begin{verbatim} |
| 2380 |
%\documentclass{article} |
| 2381 |
%\usepackage[british,style=iso]{datetime2} |
| 2382 |
%\end{verbatim} |
| 2383 |
%In the above \pkgopt{useregional} is \texttt{false}. (The |
| 2384 |
%\pkgopt{british} option implements \pkgopt[text]{usenumerical} |
| 2385 |
%but the \pkgopt{style} option then implements |
| 2386 |
%\pkgopt[false]{usenumerical}.) |
| 2387 |
% |
| 2388 |
%\begin{verbatim} |
| 2389 |
%\documentclass{article} |
| 2390 |
%\usepackage[style=iso,british]{datetime2} |
| 2391 |
%\end{verbatim} |
| 2392 |
%In the above \pkgopt{useregional} is \texttt{text}. (The |
| 2393 |
%\pkgopt{style} option implements \pkgopt[false]{usenumerical} |
| 2394 |
%but the \pkgopt{british} option then implements |
| 2395 |
%\pkgopt[text]{usenumerical}.) |
| 2396 |
% |
| 2397 |
%\item[\pkgopt{style}] Sets the current style using \cs{DTMsetstyle} |
| 2398 |
%when the \styfmt{datetime2} package has finished loading. This also sets |
| 2399 |
%\pkgopt[false]{useregional} but that setting can be overridden later |
| 2400 |
%in the option list. |
| 2401 |
% |
| 2402 |
%Default value: empty (use the default style or the regional style, |
| 2403 |
%according to the value of \pkgopt{useregional}). |
| 2404 |
% |
| 2405 |
%This key isn't available in \cs{DTMsetup}. Use \cs{DTMsetstyle} instead. |
| 2406 |
% |
| 2407 |
%\item[\pkgopt{calc}] Load the \styfmt{datetime2-calc} package. This |
| 2408 |
%will allow the day of week to be computed and allow you to use the |
| 2409 |
%\sty{pgfcalendar} offset style date formats in commands like |
| 2410 |
%\cs{DTMdate} as well as defining the commands described in |
| 2411 |
%\sectionref{sec:calc}. This option doesn't take a value. It can't be switched |
| 2412 |
%off. This option can't be used in \cs{DTMsetkeys}. The default is to |
| 2413 |
%not load \styfmt{datetime2-calc}. |
| 2414 |
% |
| 2415 |
%\item[\pkgopt{showdow}] This is a boolean key that determines |
| 2416 |
%whether or not to show the day of week in styles that support this. |
| 2417 |
%Note that \pkgopt[true]{showdow} will automatically load |
| 2418 |
%\styfmt{datetime2-calc} so |
| 2419 |
%\begin{verbatim} |
| 2420 |
%\usepackage[showdow]{datetime2} |
| 2421 |
%\end{verbatim} |
| 2422 |
%is equivalent to |
| 2423 |
%\begin{verbatim} |
| 2424 |
%\usepackage[showdow,calc]{datetime2} |
| 2425 |
%\end{verbatim} |
| 2426 |
% |
| 2427 |
%This option may be used in \cs{DTMsetup}, but if you attempt to |
| 2428 |
%switch it on in the \env{document} environment you'll get an error |
| 2429 |
%if the \styfmt{datetime2-calc} package hasn't been loaded. |
| 2430 |
%\textbf{Not all styles support this setting.} |
| 2431 |
%Default: \texttt{false}. |
| 2432 |
% |
| 2433 |
%This option is actually a language-dependent option and isn't used |
| 2434 |
%by the base package, but it's implemented as a package option as the |
| 2435 |
%\styfmt{datetime2-calc} package is also needed if the day of the week |
| 2436 |
%should be displayed. As a package option, \pkgopt{showdow} can |
| 2437 |
%automatically load the required package. |
| 2438 |
% |
| 2439 |
%\begin{important} |
| 2440 |
%You need to check the documentation to find out which styles check |
| 2441 |
%the \pkgopt{showdow} setting as not all of them do. |
| 2442 |
%\end{important} |
| 2443 |
% |
| 2444 |
%\item[\pkgopt{warn}] This is a boolean key. If true (default) |
| 2445 |
%\styfmt{datetime2} warnings will be displayed. If false, the warnings |
| 2446 |
%will be suppressed. |
| 2447 |
%Default: \texttt{true}. |
| 2448 |
% |
| 2449 |
%\end{description} |
| 2450 |
% |
| 2451 |
%Any additional option passed to the \styfmt{datetime2} package (not |
| 2452 |
%through \cs{DTMsetup}) will be considered a \sty{tracklang} option |
| 2453 |
%and will be passed to \cs{TrackPredefinedDialect}. (See the |
| 2454 |
%\sty{tracklang} documentation for further details of that command.) |
| 2455 |
% |
| 2456 |
%Apart from \pkgopt{calc}, \pkgopt{style} and the regional options, all the above |
| 2457 |
%options can also be set using: |
| 2458 |
%\begin{definition}[\DescribeMacro\DTMsetup] |
| 2459 |
%\cs{DTMsetup}\marg{option list} |
| 2460 |
%\end{definition} |
| 2461 |
% |
| 2462 |
%The language modules may additionally provide options which can be |
| 2463 |
%set using: |
| 2464 |
%\begin{definition}[\DescribeMacro\DTMlangsetup] |
| 2465 |
%\cs{DTMlangsetup}\oarg{module-name list}\marg{option list} |
| 2466 |
%\end{definition} |
| 2467 |
% |
| 2468 |
%This will set the \meta{option list} for each module listed in |
| 2469 |
%\meta{module-name list}. Unknown options will generate a~warning rather |
| 2470 |
%than an error message. The default value of \meta{module-name list} is |
| 2471 |
%the list of all loaded modules. |
| 2472 |
% |
| 2473 |
%Example: |
| 2474 |
%\begin{verbatim} |
| 2475 |
%\documentclass{article} |
| 2476 |
%\usepackage[british]{datetime2} |
| 2477 |
%\DTMlangsetup{mapzone} |
| 2478 |
%\end{verbatim} |
| 2479 |
%The module list here is \texttt{english-base},\texttt{en-GB} and |
| 2480 |
%since the \texttt{english-base} doesn't have a \texttt{mapzone} |
| 2481 |
%option, this will result in a warning: |
| 2482 |
%\begin{verbatim} |
| 2483 |
%Package datetime2 Warning: Region `english-base' has ignored |
| 2484 |
%(datetime2) the following settings: |
| 2485 |
%(datetime2) mapzone |
| 2486 |
%\end{verbatim} |
| 2487 |
%You can either ignore the warning or use the optional argument to |
| 2488 |
%exclude the \texttt{english-base} module: |
| 2489 |
%\begin{verbatim} |
| 2490 |
%\documentclass{article} |
| 2491 |
%\usepackage[british]{datetime2} |
| 2492 |
%\DTMlangsetup[en-GB]{mapzone} |
| 2493 |
%\end{verbatim} |
| 2494 |
%Alternatively you can use the starred version: |
| 2495 |
%\begin{verbatim} |
| 2496 |
%\documentclass{article} |
| 2497 |
%\usepackage[british]{datetime2} |
| 2498 |
%\DTMlangsetup*{mapzone} |
| 2499 |
%\end{verbatim} |
| 2500 |
% |
| 2501 |
%Note that some modules may have options with the same name as the |
| 2502 |
%above listed package options, but the keys are defined in different |
| 2503 |
%families (see \sty{xkeyval} documentation) so you need to take care |
| 2504 |
%to use \cs{DTMsetup} for package-wide settings and \cs{DTMlangsetup} |
| 2505 |
%for the module-specific settings. |
| 2506 |
% |
| 2507 |
%For example, the \pkgopt{datesep} package option described above is |
| 2508 |
%used by the predefined numerical styles but regional modules that |
| 2509 |
%provide their own numerical styles may use a different date |
| 2510 |
%separator that matches their region so they may also provide a |
| 2511 |
%\texttt{datesep} option independent of the base \pkgopt{datesep} |
| 2512 |
%option. |
| 2513 |
% |
| 2514 |
%Examples: |
| 2515 |
%\begin{verbatim} |
| 2516 |
%\documentclass[british]{article} |
| 2517 |
%\usepackage[datesep=.]{datetime2} |
| 2518 |
%\begin{document} |
| 2519 |
%\today |
| 2520 |
%\end{document} |
| 2521 |
%\end{verbatim} |
| 2522 |
%The above displays the date in the form |
| 2523 |
%{\DTMsetup{datesep=.}\DTMsetdatestyle{default}\today} |
| 2524 |
%since the default style is in use and \pkgopt{datesep} is used as a |
| 2525 |
%package option. |
| 2526 |
% |
| 2527 |
%\begin{verbatim} |
| 2528 |
%\documentclass[british]{article} |
| 2529 |
%\usepackage{datetime2} |
| 2530 |
%\DTMsetup{datesep=.} |
| 2531 |
%\begin{document} |
| 2532 |
%\today |
| 2533 |
%\end{document} |
| 2534 |
%\end{verbatim} |
| 2535 |
%The above displays the date in the form |
| 2536 |
%{\DTMsetup{datesep=.}\DTMsetdatestyle{default}\today} |
| 2537 |
%since the default style is in use and \pkgopt{datesep} is used in |
| 2538 |
%\cs{DTMsetup}. |
| 2539 |
% |
| 2540 |
%\begin{verbatim} |
| 2541 |
%\documentclass[british]{article} |
| 2542 |
%\usepackage{datetime2} |
| 2543 |
%\DTMlangsetup{datesep=.} |
| 2544 |
%\begin{document} |
| 2545 |
%\today |
| 2546 |
%\end{document} |
| 2547 |
%\end{verbatim} |
| 2548 |
%The above displays the date in the form |
| 2549 |
%{\DTMlangsetup[en-GB]{datesep=.}\DTMsetdatestyle{default}\today} |
| 2550 |
%since the default style is in use but \pkgopt{datesep} is used in |
| 2551 |
%\cs{DTMlangsetup}, which only influences the \style{en-GB-numeric} |
| 2552 |
%style, which isn't the current style. |
| 2553 |
% |
| 2554 |
%\begin{verbatim} |
| 2555 |
%\documentclass[british]{article} |
| 2556 |
%\usepackage[useregional=numeric]{datetime2} |
| 2557 |
%\DTMlangsetup{datesep=.} |
| 2558 |
%\begin{document} |
| 2559 |
%\today |
| 2560 |
%\end{document} |
| 2561 |
%\end{verbatim} |
| 2562 |
%The above displays the date in the form |
| 2563 |
%{\DTMlangsetup[en-GB]{datesep=.}\DTMsetdatestyle{en-GB-numeric}\today} |
| 2564 |
%since the \style{en-GB-numeric} style is in use and \pkgopt{datesep} |
| 2565 |
%is used in \cs{DTMlangsetup}. |
| 2566 |
% |
| 2567 |
%\begin{verbatim} |
| 2568 |
%\documentclass[british]{article} |
| 2569 |
%\usepackage[useregional]{datetime2} |
| 2570 |
%\DTMlangsetup{datesep=.} |
| 2571 |
%\begin{document} |
| 2572 |
%\today |
| 2573 |
%\end{document} |
| 2574 |
%\end{verbatim} |
| 2575 |
%The above displays the date in the form |
| 2576 |
%{\DTMlangsetup[en-GB]{datesep=.}\DTMsetdatestyle{en-GB}\today} |
| 2577 |
%since the \style{en-GB} style is in use and \pkgopt{datesep} is used |
| 2578 |
%in \cs{DTMlangsetup}, which only influences the |
| 2579 |
%\style{en-GB-numeric} style. |
| 2580 |
% |
| 2581 |
%\begin{verbatim} |
| 2582 |
%\documentclass[british]{article} |
| 2583 |
%\usepackage[useregional=numeric]{datetime2} |
| 2584 |
%\DTMsetup{datesep=.} |
| 2585 |
%\begin{document} |
| 2586 |
%\today |
| 2587 |
%\end{document} |
| 2588 |
%\end{verbatim} |
| 2589 |
%The above displays the date in the form |
| 2590 |
%{\DTMsetup{datesep=.}\DTMsetdatestyle{en-GB-numeric}\today} |
| 2591 |
%since the \style{en-GB-numeric} style is in use but \pkgopt{datesep} |
| 2592 |
%is used in \cs{DTMsetup} which influences the base predefined |
| 2593 |
%numeric styles not the regional styles. |
| 2594 |
% |
| 2595 |
%\chapter{The \styfmt{datetime2-calc} Package} |
| 2596 |
%\label{sec:calc} |
| 2597 |
% |
| 2598 |
%The \styfmt{datetime2-calc} package can be loaded after \styfmt{datetime2} in the |
| 2599 |
%usual way: |
| 2600 |
%\begin{verbatim} |
| 2601 |
%\usepackage{datetime2} |
| 2602 |
%\usepackage{datetime2-calc} |
| 2603 |
%\end{verbatim} |
| 2604 |
%or using the \pkgopt{calc} package option to \styfmt{datetime2}: |
| 2605 |
%\begin{verbatim} |
| 2606 |
%\usepackage[calc]{datetime2} |
| 2607 |
%\end{verbatim} |
| 2608 |
%or by using \pkgopt[true]{showdow}: |
| 2609 |
%\begin{verbatim} |
| 2610 |
%\usepackage[showdow]{datetime2} |
| 2611 |
%\end{verbatim} |
| 2612 |
% |
| 2613 |
%This package loads the \sty{pgfcalendar} package which provides a |
| 2614 |
%way of computing the day of week from a given date. Once |
| 2615 |
%\styfmt{datetime2-calc} has been loaded, you can enable or disable the |
| 2616 |
%weekday in dates where the style supports this, but note that \emph{not |
| 2617 |
%all styles support this}, even if the \styfmt{datetime2-calc} package |
| 2618 |
%has been loaded. |
| 2619 |
% |
| 2620 |
%As with the commands in \sectionref{sec:store}, the commands |
| 2621 |
%described below that save date\slash time information will |
| 2622 |
%\emph{overwrite} any previously defined date\slash time data with |
| 2623 |
%the same identifying \meta{name}. However, they may only overwrite |
| 2624 |
%specific elements of the data (for example, just the year, month, |
| 2625 |
%day and day of week elements) and leave the other elements |
| 2626 |
%unchanged. Where the remaining elements are undefined they'll be set to |
| 2627 |
%zero, except for the day of week element, which will be set to |
| 2628 |
%\texttt{-1}. |
| 2629 |
% |
| 2630 |
%In addition to enabling the weekday calculations, the \styfmt{datetime2-calc} |
| 2631 |
%package also provides the following commands: |
| 2632 |
%\begin{definition}[\DescribeMacro\DTMsavejulianday] |
| 2633 |
%\cs{DTMsavejulianday}\marg{name}\marg{number} |
| 2634 |
%\end{definition} |
| 2635 |
%This uses \cs{pgfcalendarjuliantodate} to obtain the year, month and |
| 2636 |
%day from the given Julian day number and uses |
| 2637 |
%\cs{pgfcalendarjuliantoweekday} to obtain the day of week and then |
| 2638 |
%saves it. The date can later be used with commands such as |
| 2639 |
%\cs{DTMuse}\marg{name} described in \sectionref{sec:store}. |
| 2640 |
%Example: |
| 2641 |
%\begin{verbatim} |
| 2642 |
%\DTMsavejulianday{mydate}{2457023} |
| 2643 |
%\end{verbatim} |
| 2644 |
% |
| 2645 |
%\begin{definition}[\DescribeMacro\DTMsaveddatetojuliandate] |
| 2646 |
%\cs{DTMsaveddatetojulianday}\marg{name}\marg{register} |
| 2647 |
%\end{definition} |
| 2648 |
%This uses \cs{pgfcalendardatetojulian} to convert a previously saved |
| 2649 |
%date (identified by \meta{name}) to a Julian day. The result is |
| 2650 |
%stored in \meta{register} which should be a count register (not a |
| 2651 |
%\LaTeX\ counter name). |
| 2652 |
%Example: |
| 2653 |
%\begin{verbatim} |
| 2654 |
%\newcount\myct |
| 2655 |
%\DTMsaveddatetojulianday{mydate}{\myct} |
| 2656 |
%\end{verbatim} |
| 2657 |
% |
| 2658 |
%\begin{definition}[\DescribeMacro\DTMsaveddateoffsettojulianday] |
| 2659 |
%\cs{DTMsaveddateoffsettojulianday}\marg{name}\marg{offset}\marg{register} |
| 2660 |
%\end{definition} |
| 2661 |
%This is like the previous command but converts the date obtained by |
| 2662 |
%incrementing the saved date with \meta{offset}. The result is stored |
| 2663 |
%in \meta{register}. This is equivalent to |
| 2664 |
%\begin{quote}\ttfamily |
| 2665 |
%\cs{pgfcalendardatetojulian}\{\meta{y}-\meta{m}-\meta{d}+\meta{offset}\}\marg{register} |
| 2666 |
%\end{quote} |
| 2667 |
%where \meta{y}, \meta{m} and \meta{d} are the year, month and day |
| 2668 |
%fetched from the saved date. A negative \meta{offset} indicates an earlier |
| 2669 |
%date. |
| 2670 |
%Example: |
| 2671 |
%\begin{verbatim} |
| 2672 |
%\DTMsaveddateoffsettojulianday{mydate}{2}{\myct} |
| 2673 |
%\end{verbatim} |
| 2674 |
%or |
| 2675 |
%\begin{verbatim} |
| 2676 |
%\DTMsaveddateoffsettojulianday{mydate}{-7}{\myct} |
| 2677 |
%\end{verbatim} |
| 2678 |
% |
| 2679 |
%\begin{definition}[\DescribeMacro\DTMifdate] |
| 2680 |
%\cs{DTMifdate}\marg{name}\marg{test}\marg{true}\marg{false} |
| 2681 |
%\end{definition} |
| 2682 |
%This is just a convenient interface to \cs{pgfcalendarifdate} |
| 2683 |
%for a saved date (identified by \meta{name}). The remaining |
| 2684 |
%arguments are the same as the final three arguments of |
| 2685 |
%\cs{pgfcalendarifdate}. Note that the |
| 2686 |
%\texttt{equals}, \texttt{at least}, \texttt{at most} and |
| 2687 |
%\texttt{between} keywords available in \meta{test} need to be in the |
| 2688 |
%format specified by the \styfmt{pgf} manual, but remember that you can |
| 2689 |
%use commands like \cs{DTMfetchyear}. |
| 2690 |
%Example: |
| 2691 |
%\begin{verbatim} |
| 2692 |
%Is \texttt{mydate2} (\DTMusedate{mydate2}) before |
| 2693 |
%\texttt{mydate} (\DTMusedate{mydate})? |
| 2694 |
%\DTMifdate |
| 2695 |
% {mydate2} |
| 2696 |
% {at most= |
| 2697 |
% \DTMfetchyear{mydate}-\DTMfetchmonth{mydate}-\DTMfetchday{mydate}} |
| 2698 |
% {yes}{no}. |
| 2699 |
%\end{verbatim} |
| 2700 |
% |
| 2701 |
%\begin{definition}[\DescribeMacro\DTMsaveddatediff] |
| 2702 |
%\cs{DTMsavedatediff}\marg{name1}\marg{name2}\marg{register} |
| 2703 |
%\end{definition} |
| 2704 |
%Computes the difference (in days) between two saved dates and stores |
| 2705 |
%the result in the given count register. The first date is identified |
| 2706 |
%by \meta{name1} and the second date is identified by \meta{name2}. |
| 2707 |
%The dates are converted to their respective Julian day numbers |
| 2708 |
%\meta{J1} and \meta{J2} and the result is given by |
| 2709 |
%\meta{J1}$-$\meta{J2}. |
| 2710 |
% |
| 2711 |
%\begin{important} |
| 2712 |
%Note that the time and zone are not taken into account, even if they |
| 2713 |
%were provided when the dates were stored. |
| 2714 |
%\end{important} |
| 2715 |
%Example: |
| 2716 |
%\begin{verbatim} |
| 2717 |
%\DTMsaveddatediff{mydate}{mydate2}{\myct} |
| 2718 |
% |
| 2719 |
%\DTMusedate{mydate} is |
| 2720 |
%\ifnum\myct=0 |
| 2721 |
% the same day as |
| 2722 |
%\else |
| 2723 |
% \ifnum\myct<0 |
| 2724 |
% \number-\myct\space day\ifnum\myct<-1s\fi\space before |
| 2725 |
% \else |
| 2726 |
% \number\myct\space day\ifnum\myct>1s\fi\space after |
| 2727 |
% \fi |
| 2728 |
%\fi |
| 2729 |
%\DTMusedate{mydate2}. |
| 2730 |
%\end{verbatim} |
| 2731 |
% |
| 2732 |
%The \styfmt{datetime2-calc} package also provides commands that convert |
| 2733 |
%a datetime instance into Zulu\footnote{That's Zulu as in the NATO |
| 2734 |
%alphabet representation of the letter Z.}\ time (UTC+00:00). |
| 2735 |
% |
| 2736 |
%\begin{definition}[\DescribeMacro\DTMsaveaszulutime] |
| 2737 |
%\cs{DTMsaveaszulutime}\marg{name}\marg{YYYY}\marg{MM}\marg{DD}\marg{hh}\marg{mm}\newline\marg{ss}\marg{TZh}\marg{TZm} |
| 2738 |
%\end{definition} |
| 2739 |
%This converts the given datetime instance into UTC+00:00 and saves |
| 2740 |
%the result. You can then use the date with commands like \cs{DTMuse} |
| 2741 |
%described in \sectionref{sec:store}. The \meta{name} argument is the |
| 2742 |
%label identifying the saved data. The other arguments are all |
| 2743 |
%numbers. |
| 2744 |
%Example: |
| 2745 |
%\begin{verbatim} |
| 2746 |
%\DTMsaveaszulutime{mydate}{2014}{6}{3}{20}{45}{0}{6}{0} |
| 2747 |
%\end{verbatim} |
| 2748 |
% |
| 2749 |
%\begin{definition}[\DescribeMacro\DTMtozulu] |
| 2750 |
%\cs{DTMtozulu}\marg{name1}\marg{name2} |
| 2751 |
%\end{definition} |
| 2752 |
%Uses \cs{DTMsaveaszulutime} to convert the datetime stored in |
| 2753 |
%\meta{name1} and saves it to \meta{name2}. |
| 2754 |
%Example: |
| 2755 |
%\begin{verbatim} |
| 2756 |
%\DTMsavetimestamp{mydate}{2014-05-01T03:55:00 -06:00} |
| 2757 |
%Original date: \DTMuse{mydate}. |
| 2758 |
% |
| 2759 |
%\DTMtozulu{mydate}{mydate2} |
| 2760 |
%UTC+00:00: \DTMuse{mydate2}. |
| 2761 |
%\end{verbatim} |
| 2762 |
%The above produces (using the \style{default} format): |
| 2763 |
%\DTMsetstyle{default}% |
| 2764 |
%\begin{quote} |
| 2765 |
%\DTMsavetimestamp{mydate}{2014-05-01T03:55:00 -06:00} |
| 2766 |
%Original date: \DTMuse{mydate}. |
| 2767 |
% |
| 2768 |
%\DTMtozulu{mydate}{mydate2} |
| 2769 |
%UTC+00:00: \DTMuse{mydate2}. |
| 2770 |
%\end{quote} |
| 2771 |
% |
| 2772 |
%The \sty{pgfcalendar} package also provides a variety of useful |
| 2773 |
%date-related commands. See the documentation (part of the |
| 2774 |
%\styfmt{pgf} manual) for further details. Note that the language |
| 2775 |
%modules don't use \sty{pgfcalendar} month and weekday names as the |
| 2776 |
%\sty{pgfcalendar} package isn't loaded by default and the styles |
| 2777 |
%need to match the language with the syntax. However, since the |
| 2778 |
%\styfmt{datetime2-calc} package automatically loads the |
| 2779 |
%\sty{pgfcalendar} package, as from v1.3 the \styfmt{datetime2-calc} |
| 2780 |
%provides robust month name and weekday name commands that may be |
| 2781 |
%used outside of date styles, which fallback on the commands provided |
| 2782 |
%by \sty{pgfcalendar}. |
| 2783 |
% |
| 2784 |
%\begin{important} |
| 2785 |
%The following commands, which are all robust, should not be used in date |
| 2786 |
%styles, since each language style must use the name macro for that specific |
| 2787 |
%language to match the style. Make sure you have the relevant |
| 2788 |
%language module installed and loaded to allow these commands to work |
| 2789 |
%correctly. See also \sectionref{sec:names}. Remember that instead of |
| 2790 |
%these robust commands, you can simply just use the commands provided |
| 2791 |
%by the \sty{pgfcalendar} package. (See the \styfmt{pgf} manual for |
| 2792 |
%further details.) |
| 2793 |
%\end{important} |
| 2794 |
% |
| 2795 |
%\begin{definition}[\DescribeMacro\DTMmonthname] |
| 2796 |
%\cs{DTMmonthname}\marg{n} |
| 2797 |
%\end{definition} |
| 2798 |
%This checks if \cs{DTM\meta{lang}monthname} exists where \meta{lang} |
| 2799 |
%is given by \cs{languagename}. If so, that macro is used. For example: |
| 2800 |
%\begin{verbatim} |
| 2801 |
%\documentclass{article} |
| 2802 |
%\usepackage[english]{babel} |
| 2803 |
%\usepackage[calc]{datetime2} |
| 2804 |
%\begin{document} |
| 2805 |
%\DTMmonthname{12} |
| 2806 |
%\end{document} |
| 2807 |
%\end{verbatim} |
| 2808 |
%Here \cs{languagename} is \texttt{english}, so this |
| 2809 |
%uses \cs{DTMenglishmonthname} which is defined by the |
| 2810 |
%\module{english} module. |
| 2811 |
% |
| 2812 |
%If the test with \cs{languagename} didn't work, \cs{DTMmonthname} |
| 2813 |
%then tries with \meta{lang} set to |
| 2814 |
%\begin{verbatim} |
| 2815 |
%\TrackedLanguageFromDialect{\languagename} |
| 2816 |
%\end{verbatim} |
| 2817 |
%(\cs{TrackedLanguageFromDialect} is provided by the \sty{tracklang} |
| 2818 |
%package.) If \cs{DTM\meta{lang}monthname} exists, then this command is used. |
| 2819 |
%For example: |
| 2820 |
%\begin{verbatim} |
| 2821 |
%\documentclass{article} |
| 2822 |
%\usepackage[british]{babel} |
| 2823 |
%\usepackage[calc]{datetime2} |
| 2824 |
%\begin{document} |
| 2825 |
%\DTMmonthname{12} |
| 2826 |
%\end{document} |
| 2827 |
%\end{verbatim} |
| 2828 |
%Here \cs{languagename} is \texttt{british}, so this again uses |
| 2829 |
%\cs{DTMenglishmonthname} as the root language is obtained from the |
| 2830 |
%dialect to language mapping. |
| 2831 |
% |
| 2832 |
%\begin{important} |
| 2833 |
%Note that this won't work if you confuse \sty{tracklang} by using an |
| 2834 |
%alternative dialect name in the class option or by directly loading |
| 2835 |
%\sty{tracklang} with different dialect labels. |
| 2836 |
%\end{important} |
| 2837 |
% |
| 2838 |
%In the event that neither of those commands exist, |
| 2839 |
%\cs{DTMmonthname} will fallback on \cs{pgfcalendarmonthname} |
| 2840 |
%(provided by the \sty{pgfcalendar} package). This will also issue a |
| 2841 |
%warning. For example: |
| 2842 |
%\begin{verbatim} |
| 2843 |
%\documentclass{article} |
| 2844 |
%\usepackage[calc]{datetime2} |
| 2845 |
%\begin{document} |
| 2846 |
%\DTMmonthname{12} |
| 2847 |
%\end{document} |
| 2848 |
%\end{verbatim} |
| 2849 |
%This produces the warning message: |
| 2850 |
%\begin{verbatim} |
| 2851 |
%Can't find underlying language macro for |
| 2852 |
%\DTMmonthname (language: english); |
| 2853 |
%using pgfcalendar macro instead |
| 2854 |
%\end{verbatim} |
| 2855 |
%and uses \cs{pgfcalendarmonthname} instead of |
| 2856 |
%\cs{DTMenglishmonthname} (which hasn't been defined because the |
| 2857 |
%\module{english} module \emph{hasn't been loaded}). |
| 2858 |
% |
| 2859 |
%You can switch off the warning by setting the \pkgopt{warn} option |
| 2860 |
%to false or by redefining \cs{dtmnamewarning} to ignore its |
| 2861 |
%argument. |
| 2862 |
% |
| 2863 |
%\begin{definition}[\DescribeMacro\DTMMonthname] |
| 2864 |
%\cs{DTMMonthname}\marg{n} |
| 2865 |
%\end{definition} |
| 2866 |
%This checks if \cs{DTM\meta{lang}Monthname} exists. First where |
| 2867 |
%\meta{lang} is given by \cs{languagename} and then where \meta{lang} |
| 2868 |
%is given by |
| 2869 |
%\begin{verbatim} |
| 2870 |
%\TrackedLanguageFromDialect{\languagename} |
| 2871 |
%\end{verbatim} |
| 2872 |
%If neither of those values of \meta{lang} match a defined command, |
| 2873 |
%\cs{DTMMonthname} then tests for non-case-changing versions |
| 2874 |
%\cs{DTM\meta{lang}monthname}. |
| 2875 |
%This is because not all language modules provide a macro for use at the |
| 2876 |
%start of a sentence since some languages always start month names |
| 2877 |
%with a capital letter. For example, the |
| 2878 |
%\module{english} module provides \cs{DTMenglishmonthname} but |
| 2879 |
%doesn't provide an upper case alternative, since English month names |
| 2880 |
%always start with a capital. Therefore: |
| 2881 |
%\begin{verbatim} |
| 2882 |
%\documentclass{article} |
| 2883 |
%\usepackage[english]{babel} |
| 2884 |
%\usepackage[calc]{datetime2} |
| 2885 |
%\begin{document} |
| 2886 |
%\DTMMonthname{12} |
| 2887 |
%\end{document} |
| 2888 |
%\end{verbatim} |
| 2889 |
%just uses \cs{DTMenglishmonthname}. |
| 2890 |
% |
| 2891 |
%As before, if the relevant command can't be detected for any case |
| 2892 |
%of \meta{lang} for either \cs{DTM\meta{lang}Monthname} or |
| 2893 |
%\cs{DTM\meta{lang}monthname} (for example, the required language module hasn't |
| 2894 |
%been loaded) then \cs{DTMMonthname} will use |
| 2895 |
%\cs{pgfcalendarmonthname} and attempt to convert the first letter to |
| 2896 |
%upper case. |
| 2897 |
% |
| 2898 |
%Since some \emph{but not all} language modules also provide month |
| 2899 |
%name abbreviations, the \styfmt{datetime2-calc} package also provides: |
| 2900 |
%\begin{definition}[\DescribeMacro\DTMshortmonthname] |
| 2901 |
%\cs{DTMshortmonthname}\marg{n} |
| 2902 |
%\end{definition} |
| 2903 |
%This behaves in a similar way to \cs{DTMmonthname} but tries to |
| 2904 |
%determine if \cs{DTM\meta{lang}shortmonthname} exists (where |
| 2905 |
%\meta{lang} is either \cs{languagename} or obtained from |
| 2906 |
%\cs{languagename} using \sty{tracklang}'s dialect to language |
| 2907 |
%mapping). If no command can be found, the fallback uses |
| 2908 |
%\cs{pgfcalendarmonthshortname} provided by the \sty{pgfcalendar} |
| 2909 |
%package. For example, if the language module hasn't been loaded or |
| 2910 |
%if the language module doesn't provide an abbreviated version. |
| 2911 |
% |
| 2912 |
%Similarly there is a version for the start of a sentence for |
| 2913 |
%languages that normally use lower case month names: |
| 2914 |
%\begin{definition}[\DescribeMacro\DTMshortMonthname] |
| 2915 |
%\cs{DTMshortMonthname}\marg{n} |
| 2916 |
%\end{definition} |
| 2917 |
% |
| 2918 |
%There are also analogous commands for the weekday names, where |
| 2919 |
%\meta{n} is an integer from 0 (Monday) to 6 (Sunday). This index can |
| 2920 |
%be computed using: |
| 2921 |
%\begin{definition}[\DescribeMacro\DTMcomputedayofweekindex] |
| 2922 |
%\cs{DTMcomputedayofweekindex}\marg{date}\marg{cs} |
| 2923 |
%\end{definition} |
| 2924 |
%where \meta{date} is in the form \meta{YYYY}-\meta{MM}-\meta{DD} and |
| 2925 |
%\meta{cs} is a control sequence in which to store the result. |
| 2926 |
%Remember that date styles automatically access the day of week index |
| 2927 |
%from the fourth argument of \cs{DTMdisplaydate}, so this command |
| 2928 |
%shouldn't be used within a date style. |
| 2929 |
% |
| 2930 |
%\begin{definition}[\DescribeMacro\DTMweekdayname] |
| 2931 |
%\cs{DTMweekdayname}\marg{n} |
| 2932 |
%\end{definition} |
| 2933 |
%This checks if \cs{DTM\meta{lang}weekdayname} exists where |
| 2934 |
%\meta{lang} is given by \cs{languagename}. |
| 2935 |
%If it does, that macro is used. For example: |
| 2936 |
%\begin{verbatim} |
| 2937 |
%\documentclass{article} |
| 2938 |
%\usepackage[english]{babel} |
| 2939 |
%\usepackage[calc]{datetime2} |
| 2940 |
%\begin{document} |
| 2941 |
%\DTMweekdayname{6} |
| 2942 |
%\end{document} |
| 2943 |
%\end{verbatim} |
| 2944 |
%This uses \cs{DTMenglishweekdayname}, which is provided by the |
| 2945 |
%\module{english} module. |
| 2946 |
% |
| 2947 |
%If \cs{DTM\meta{lang}weekdayname} doesn't exist with \meta{lang} set |
| 2948 |
%to \cs{languagename}, \cs{DTMweekdayname} then tests with |
| 2949 |
%\meta{lang} set to: |
| 2950 |
%\begin{verbatim} |
| 2951 |
%\TrackedLanguageFromDialect{\languagename} |
| 2952 |
%\end{verbatim} |
| 2953 |
%If the command \cs{DTM\meta{lang}weekdayname} exists in this case, that |
| 2954 |
%command is used. For example: |
| 2955 |
%\begin{verbatim} |
| 2956 |
%\documentclass{article} |
| 2957 |
%\usepackage[british]{babel} |
| 2958 |
%\usepackage[calc]{datetime2} |
| 2959 |
%\begin{document} |
| 2960 |
%\DTMweekdayname{6} |
| 2961 |
%\end{document} |
| 2962 |
%\end{verbatim} |
| 2963 |
%This uses \cs{DTMenglishweekdayname} as it can determine (through |
| 2964 |
%\sty{tracklang}) that \texttt{british} has been defined as a dialect |
| 2965 |
%of \texttt{english}. |
| 2966 |
% |
| 2967 |
%If this second test fails, then \cs{DTMweekdayname} will issue a |
| 2968 |
%warning and fallback on \cs{pgfcalendarweekdayname}, provided by the |
| 2969 |
%\sty{pgfcalendar} package. For example: |
| 2970 |
%\begin{verbatim} |
| 2971 |
%\documentclass{article} |
| 2972 |
%\usepackage[calc]{datetime2} |
| 2973 |
%\begin{document} |
| 2974 |
%\DTMweekdayname{6} |
| 2975 |
%\end{document} |
| 2976 |
%\end{verbatim} |
| 2977 |
%This produces the warning message: |
| 2978 |
%\begin{verbatim} |
| 2979 |
%Can't find underlying language macro for |
| 2980 |
%\DTMweekdayname (language: english); |
| 2981 |
%using pgfcalendar macro instead |
| 2982 |
%\end{verbatim} |
| 2983 |
%As before, this warning is produced with \cs{dtmnamewarning}. |
| 2984 |
% |
| 2985 |
%The first letter upper case version is: |
| 2986 |
%\begin{definition}[\DescribeMacro\DTMWeekdayname] |
| 2987 |
%\cs{DTMWeekdayname}\marg{n} |
| 2988 |
%\end{definition} |
| 2989 |
%As with \cs{DTMMonthname}, if no upper case version can be found in |
| 2990 |
%the relevant language module this will use the non-case-changing |
| 2991 |
%version. The fallback \sty{pgfcalendar} macro is again |
| 2992 |
%\cs{pgfcalendarweekdayname} with an attempt to convert the first |
| 2993 |
%letter to upper case. |
| 2994 |
% |
| 2995 |
%Again, abbreviations may or may not be supported by language |
| 2996 |
%modules. If they're not supported, the fallback is |
| 2997 |
%\cs{pgfcalendarweekdayshortname}. |
| 2998 |
% |
| 2999 |
%\begin{definition}[\DescribeMacro\DTMshortweekdayname] |
| 3000 |
%\cs{DTMshortweekdayname}\marg{n} |
| 3001 |
%\end{definition} |
| 3002 |
%which will attempt to use \cs{DTM\meta{lang}shortweekdayname} and |
| 3003 |
%\begin{definition}[\DescribeMacro\DTMshortWeekdayname] |
| 3004 |
%\cs{DTMshortWeekdayname}\marg{n} |
| 3005 |
%\end{definition} |
| 3006 |
%which will attempt to use \cs{DTM\meta{lang}shortWeekdayname} or |
| 3007 |
%\cs{DTM\meta{lang}shortweekdayname}. |
| 3008 |
% |
| 3009 |
%For completeness, there's also a language-sensitive date ordinal command: |
| 3010 |
%\begin{definition}[\DescribeMacro\DTMordinal] |
| 3011 |
%\cs{DTMordinal}\marg{n} |
| 3012 |
%\end{definition} |
| 3013 |
%where \meta{n} is a number from 1 to 31. Again, this shouldn't be |
| 3014 |
%used in date styles, but only if a standalone date ordinal is required. |
| 3015 |
%For most languages, this only has a suffix for the first day of the |
| 3016 |
%month (that is where \meta{n} is 1) or the suffix may simply be a |
| 3017 |
%full stop (period). It should not be confused with \sty{fmtcount}'s |
| 3018 |
%\cs{ordinalnum} command, which is for general ordinals rather than |
| 3019 |
%date-specific ordinals. |
| 3020 |
% |
| 3021 |
%\chapter{Migrating from \styfmt{datetime}} |
| 3022 |
%\label{sec:migrate} |
| 3023 |
% |
| 3024 |
%This section is for users who want to switch over from the old |
| 3025 |
%\styfmt{datetime} package. |
| 3026 |
% |
| 3027 |
%Note that \styfmt{datetime2} is modularised for improved efficiency both in |
| 3028 |
%terms of package overheads and spreading the maintenance load. This |
| 3029 |
%means that you only need to install \styfmt{datetime2} if you only want |
| 3030 |
%the base numeric styles, but it you want multilingual or regional |
| 3031 |
%support, you need to additionally load the required language module |
| 3032 |
%or modules. |
| 3033 |
% |
| 3034 |
%For example, consider the following document that uses |
| 3035 |
%\styfmt{datetime}: |
| 3036 |
%\begin{verbatim} |
| 3037 |
%\documentclass{article} |
| 3038 |
%\usepackage[T1]{fontenc} |
| 3039 |
%\usepackage[utf8]{inputenc} |
| 3040 |
%\usepackage[french]{babel} |
| 3041 |
%\usepackage{datetime} |
| 3042 |
%\begin{document} |
| 3043 |
%\today. |
| 3044 |
%\end{document} |
| 3045 |
%\end{verbatim} |
| 3046 |
%This just needs to have the \styfmt{datetime} package installed, which |
| 3047 |
%includes the necessary file \texttt{dt-french.def}. |
| 3048 |
% |
| 3049 |
%This example can be adjusted for \styfmt{datetime2}: |
| 3050 |
%\begin{verbatim} |
| 3051 |
%\documentclass{article} |
| 3052 |
%\usepackage[T1]{fontenc} |
| 3053 |
%\usepackage[utf8]{inputenc} |
| 3054 |
%\usepackage[french]{babel} |
| 3055 |
%\usepackage[useregional]{datetime2} |
| 3056 |
%\begin{document} |
| 3057 |
%\today. |
| 3058 |
%\end{document} |
| 3059 |
%\end{verbatim} |
| 3060 |
%This requires both \styfmt{datetime2} and the \module{french} module, |
| 3061 |
%so you need to ensure that both have been installed. |
| 3062 |
% |
| 3063 |
%The above example also draws attention to another change from |
| 3064 |
%\styfmt{datetime} and that concerns the default package behaviour. The |
| 3065 |
%\styfmt{datetime} package defaults to a British date style, unless |
| 3066 |
%\sty{babel} has been loaded first, whereas the \styfmt{datetime2} |
| 3067 |
%package defaults to an ISO numeric style, unless language or |
| 3068 |
%regional settings are provided in the class option. As illustrated |
| 3069 |
%in the above, you need the \pkgopt{useregional} option if you want |
| 3070 |
%\cs{datefrench} (or equivalent) to switch the date style. |
| 3071 |
% |
| 3072 |
%\section{\styfmt{datetime} package options} |
| 3073 |
% |
| 3074 |
%The \styfmt{datetime} package provides the following options, which can |
| 3075 |
%be emulated with \styfmt{datetime2} or through one of its dependent |
| 3076 |
%modules or packages: |
| 3077 |
% |
| 3078 |
%\begin{description} |
| 3079 |
%\item[\pkgoptfmt{long}] This option was designed for full British |
| 3080 |
%dates, and is the default if \sty{babel} isn't loaded. Example: |
| 3081 |
%\begin{verbatim} |
| 3082 |
%\documentclass{article} |
| 3083 |
%\usepackage[long]{datetime} |
| 3084 |
%\begin{document} |
| 3085 |
%\today |
| 3086 |
%\end{document} |
| 3087 |
%\end{verbatim} |
| 3088 |
%This produces the date in the form: |
| 3089 |
%Wednesday 20\textsuperscript{th} January, 2016. |
| 3090 |
% |
| 3091 |
%This can be achieved with \styfmt{datetime2} and the \module{english} |
| 3092 |
%module as follows: |
| 3093 |
%\begin{verbatim} |
| 3094 |
%\documentclass{article} |
| 3095 |
%\usepackage[en-GB,showdow]{datetime2} |
| 3096 |
%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}} |
| 3097 |
%\begin{document} |
| 3098 |
%\today |
| 3099 |
%\end{document} |
| 3100 |
%\end{verbatim} |
| 3101 |
% |
| 3102 |
%\item[\pkgoptfmt{short}] This option was designed for abbreviated |
| 3103 |
%British dates. For example: |
| 3104 |
%\begin{verbatim} |
| 3105 |
%\documentclass{article} |
| 3106 |
%\usepackage[short]{datetime} |
| 3107 |
%\begin{document} |
| 3108 |
%\today |
| 3109 |
%\end{document} |
| 3110 |
%\end{verbatim} |
| 3111 |
%This produces the date in the form: |
| 3112 |
%Wed 20\textsuperscript{th} Jan, 2016 |
| 3113 |
% |
| 3114 |
%This can be achieved with \styfmt{datetime2} and the \module{english} |
| 3115 |
%module as follows: |
| 3116 |
%\begin{verbatim} |
| 3117 |
%\documentclass{article} |
| 3118 |
%\usepackage[en-GB,showdow]{datetime2} |
| 3119 |
%\DTMlangsetup[en-GB]{abbr,ord=raise,monthyearsep={,\space}} |
| 3120 |
%\begin{document} |
| 3121 |
%\today |
| 3122 |
%\end{document} |
| 3123 |
%\end{verbatim} |
| 3124 |
% |
| 3125 |
%\item[\pkgoptfmt{iso}] This option was designed for |
| 3126 |
%\meta{YYYY}-\meta{MM}-\meta{DD} dates. For example: |
| 3127 |
%\begin{verbatim} |
| 3128 |
%\documentclass{article} |
| 3129 |
%\usepackage[iso]{datetime} |
| 3130 |
%\begin{document} |
| 3131 |
%\today |
| 3132 |
%\end{document} |
| 3133 |
%\end{verbatim} |
| 3134 |
%This produces the date in the form: 2016-01-20. This is default for |
| 3135 |
%\styfmt{datetime2}: |
| 3136 |
%\begin{verbatim} |
| 3137 |
%\documentclass{article} |
| 3138 |
%\usepackage{datetime2} |
| 3139 |
%\begin{document} |
| 3140 |
%\today |
| 3141 |
%\end{document} |
| 3142 |
%\end{verbatim} |
| 3143 |
%If you don't want the style to depend on the separator settings, you |
| 3144 |
%can use the \style{iso} style: |
| 3145 |
%\begin{verbatim} |
| 3146 |
%\documentclass{article} |
| 3147 |
%\usepackage[style=iso]{datetime2} |
| 3148 |
%\begin{document} |
| 3149 |
%\today |
| 3150 |
%\end{document} |
| 3151 |
%\end{verbatim} |
| 3152 |
% |
| 3153 |
%\item[\pkgoptfmt{yyyymmdd}] This option was designed for |
| 3154 |
%\meta{YYYY}\slash\meta{MM}\slash\meta{DD} dates. For example: |
| 3155 |
%\begin{verbatim} |
| 3156 |
%\documentclass{article} |
| 3157 |
%\usepackage[yyyymmdd]{datetime} |
| 3158 |
%\begin{document} |
| 3159 |
%\today |
| 3160 |
%\end{document} |
| 3161 |
%\end{verbatim} |
| 3162 |
%This produces the date in the form: 2016/01/20. This is very nearly |
| 3163 |
%in the same form as the default \styfmt{datetime2} style. All that |
| 3164 |
%needs changing are the separators between the year, month and day: |
| 3165 |
%\begin{verbatim} |
| 3166 |
%\documentclass{article} |
| 3167 |
%\usepackage[datesep=/]{datetime2} |
| 3168 |
%\begin{document} |
| 3169 |
%\today |
| 3170 |
%\end{document} |
| 3171 |
%\end{verbatim} |
| 3172 |
% |
| 3173 |
%\item[\pkgoptfmt{ddmmyyyy}] This option was designed for |
| 3174 |
%\meta{DD}\slash\meta{MM}\slash\meta{YYYY} dates. For example: |
| 3175 |
%\begin{verbatim} |
| 3176 |
%\documentclass{article} |
| 3177 |
%\usepackage[ddmmyyyy]{datetime} |
| 3178 |
%\begin{document} |
| 3179 |
%\today |
| 3180 |
%\end{document} |
| 3181 |
%\end{verbatim} |
| 3182 |
%This produces the date in the form: 20/01/2016. This can be changed |
| 3183 |
%to \styfmt{datetime2} with a couple of package options: |
| 3184 |
%\begin{verbatim} |
| 3185 |
%\documentclass{article} |
| 3186 |
%\usepackage[datesep=/,style=ddmmyyyy]{datetime} |
| 3187 |
%\begin{document} |
| 3188 |
%\today |
| 3189 |
%\end{document} |
| 3190 |
%\end{verbatim} |
| 3191 |
% |
| 3192 |
%\item[\pkgoptfmt{dmyyyy}] This option was designed for |
| 3193 |
%\meta{D}\slash\meta{M}\slash\meta{YYYY} dates. For example: |
| 3194 |
%\begin{verbatim} |
| 3195 |
%\documentclass{article} |
| 3196 |
%\usepackage[ddmmyyyy]{datetime} |
| 3197 |
%\begin{document} |
| 3198 |
%\today |
| 3199 |
%\end{document} |
| 3200 |
%\end{verbatim} |
| 3201 |
%This produces the date in the form: 20/1/2016. This can be changed |
| 3202 |
%to \styfmt{datetime2} with a couple of package options: |
| 3203 |
%\begin{verbatim} |
| 3204 |
%\documentclass{article} |
| 3205 |
%\usepackage[datesep=/,style=dmyyyy]{datetime} |
| 3206 |
%\begin{document} |
| 3207 |
%\today |
| 3208 |
%\end{document} |
| 3209 |
%\end{verbatim} |
| 3210 |
% |
| 3211 |
%\item[\pkgoptfmt{ddmmyy}] This option was designed for |
| 3212 |
%\meta{DD}\slash\meta{MM}\slash\meta{YY} dates. For example: |
| 3213 |
%\begin{verbatim} |
| 3214 |
%\documentclass{article} |
| 3215 |
%\usepackage[ddmmyy]{datetime} |
| 3216 |
%\begin{document} |
| 3217 |
%\today |
| 3218 |
%\end{document} |
| 3219 |
%\end{verbatim} |
| 3220 |
%This produces the date in the form: 20/01/16. This can be changed |
| 3221 |
%to \styfmt{datetime2} with a couple of package options: |
| 3222 |
%\begin{verbatim} |
| 3223 |
%\documentclass{article} |
| 3224 |
%\usepackage[datesep=/,style=ddmmyy]{datetime} |
| 3225 |
%\begin{document} |
| 3226 |
%\today |
| 3227 |
%\end{document} |
| 3228 |
%\end{verbatim} |
| 3229 |
% |
| 3230 |
%\item[\pkgoptfmt{dmyy}] This option was designed for |
| 3231 |
%\meta{D}\slash\meta{M}\slash\meta{YY} dates. For example: |
| 3232 |
%\begin{verbatim} |
| 3233 |
%\documentclass{article} |
| 3234 |
%\usepackage[dmyy]{datetime} |
| 3235 |
%\begin{document} |
| 3236 |
%\today |
| 3237 |
%\end{document} |
| 3238 |
%\end{verbatim} |
| 3239 |
%This produces the date in the form: 20/1/16. This can be changed |
| 3240 |
%to \styfmt{datetime2} with a couple of package options: |
| 3241 |
%\begin{verbatim} |
| 3242 |
%\documentclass{article} |
| 3243 |
%\usepackage[datesep=/,style=dmyy]{datetime} |
| 3244 |
%\begin{document} |
| 3245 |
%\today |
| 3246 |
%\end{document} |
| 3247 |
%\end{verbatim} |
| 3248 |
% |
| 3249 |
%\item[\pkgoptfmt{text}] This option was designed for a full UK textual |
| 3250 |
%date. For example: |
| 3251 |
%\begin{verbatim} |
| 3252 |
%\documentclass{article} |
| 3253 |
%\usepackage[text]{datetime} |
| 3254 |
%\begin{document} |
| 3255 |
%\today |
| 3256 |
%\end{document} |
| 3257 |
%\end{verbatim} |
| 3258 |
%This produces the date in the form: |
| 3259 |
%Wednesday the Twentieth of January, Two Thousand and Sixteen |
| 3260 |
% |
| 3261 |
%This document can be changed to \styfmt{datetime2} through the |
| 3262 |
%\sty{datetime2-en-fulltext} package, which needs to be installed |
| 3263 |
%separately: |
| 3264 |
%\begin{verbatim} |
| 3265 |
%\documentclass{article} |
| 3266 |
%\usepackage{datetime2-en-fulltext} |
| 3267 |
%\DTMsetdatestyle{en-FullText} |
| 3268 |
%\begin{document} |
| 3269 |
%\today |
| 3270 |
%\end{document} |
| 3271 |
%\end{verbatim} |
| 3272 |
% |
| 3273 |
%\item[\pkgoptfmt{us}] This option was designed for the standard US |
| 3274 |
%date. For example: |
| 3275 |
%\begin{verbatim} |
| 3276 |
%\documentclass{article} |
| 3277 |
%\usepackage[us]{datetime} |
| 3278 |
%\begin{document} |
| 3279 |
%\today |
| 3280 |
%\end{document} |
| 3281 |
%\end{verbatim} |
| 3282 |
%This produces the date in the form: |
| 3283 |
%January 20, 2016 |
| 3284 |
% |
| 3285 |
%This can be achieved with \styfmt{datetime2} and the \module{english} |
| 3286 |
%module as follows: |
| 3287 |
%\begin{verbatim} |
| 3288 |
%\documentclass{article} |
| 3289 |
%\usepackage[en-US]{datetime2} |
| 3290 |
%\begin{document} |
| 3291 |
%\today |
| 3292 |
%\end{document} |
| 3293 |
%\end{verbatim} |
| 3294 |
% |
| 3295 |
%\item[\pkgoptfmt{mmddyyyy}] This option was designed for |
| 3296 |
%\meta{MM}\slash\meta{DD}\slash\meta{YYYY} dates. For example: |
| 3297 |
%\begin{verbatim} |
| 3298 |
%\documentclass{article} |
| 3299 |
%\usepackage[mmddyyyy]{datetime} |
| 3300 |
%\begin{document} |
| 3301 |
%\today |
| 3302 |
%\end{document} |
| 3303 |
%\end{verbatim} |
| 3304 |
%This produces the date in the form: 01/20/2016. This can be changed |
| 3305 |
%to \styfmt{datetime2} with a couple of package options: |
| 3306 |
%\begin{verbatim} |
| 3307 |
%\documentclass{article} |
| 3308 |
%\usepackage[datesep=/,style=mmddyyyy]{datetime} |
| 3309 |
%\begin{document} |
| 3310 |
%\today |
| 3311 |
%\end{document} |
| 3312 |
%\end{verbatim} |
| 3313 |
% |
| 3314 |
%\item[\pkgoptfmt{mdyyyy}] This option was designed for |
| 3315 |
%\meta{M}\slash\meta{D}\slash\meta{YYYY} dates. For example: |
| 3316 |
%\begin{verbatim} |
| 3317 |
%\documentclass{article} |
| 3318 |
%\usepackage[mmddyyyy]{datetime} |
| 3319 |
%\begin{document} |
| 3320 |
%\today |
| 3321 |
%\end{document} |
| 3322 |
%\end{verbatim} |
| 3323 |
%This produces the date in the form: 1/20/2016. This can be changed |
| 3324 |
%to \styfmt{datetime2} with a couple of package options: |
| 3325 |
%\begin{verbatim} |
| 3326 |
%\documentclass{article} |
| 3327 |
%\usepackage[datesep=/,style=mdyyyy]{datetime} |
| 3328 |
%\begin{document} |
| 3329 |
%\today |
| 3330 |
%\end{document} |
| 3331 |
%\end{verbatim} |
| 3332 |
% |
| 3333 |
%\item[\pkgoptfmt{mmddyy}] This option was designed for |
| 3334 |
%\meta{MM}\slash\meta{DD}\slash\meta{YY} dates. For example: |
| 3335 |
%\begin{verbatim} |
| 3336 |
%\documentclass{article} |
| 3337 |
%\usepackage[mmddyy]{datetime} |
| 3338 |
%\begin{document} |
| 3339 |
%\today |
| 3340 |
%\end{document} |
| 3341 |
%\end{verbatim} |
| 3342 |
%This produces the date in the form: 01/20/16. This can be changed |
| 3343 |
%to \styfmt{datetime2} with a couple of package options: |
| 3344 |
%\begin{verbatim} |
| 3345 |
%\documentclass{article} |
| 3346 |
%\usepackage[datesep=/,style=mmddyy]{datetime} |
| 3347 |
%\begin{document} |
| 3348 |
%\today |
| 3349 |
%\end{document} |
| 3350 |
%\end{verbatim} |
| 3351 |
% |
| 3352 |
%\item[\pkgoptfmt{mdyy}] This option was designed for |
| 3353 |
%\meta{M}\slash\meta{D}\slash\meta{YY} dates. For example: |
| 3354 |
%\begin{verbatim} |
| 3355 |
%\documentclass{article} |
| 3356 |
%\usepackage[mdyy]{datetime} |
| 3357 |
%\begin{document} |
| 3358 |
%\today |
| 3359 |
%\end{document} |
| 3360 |
%\end{verbatim} |
| 3361 |
%This produces the date in the form: 1/20/16. This can be changed |
| 3362 |
%to \styfmt{datetime2} with a couple of package options: |
| 3363 |
%\begin{verbatim} |
| 3364 |
%\documentclass{article} |
| 3365 |
%\usepackage[datesep=/,style=mdyy]{datetime} |
| 3366 |
%\begin{document} |
| 3367 |
%\today |
| 3368 |
%\end{document} |
| 3369 |
%\end{verbatim} |
| 3370 |
% |
| 3371 |
%\item[\pkgoptfmt{raise}] This option was designed to make the ordinal |
| 3372 |
%st,nd,rd,th appear as a subscript. It was originally just intended for British |
| 3373 |
%dates. This is one of the default settings for \styfmt{datetime}. For example: |
| 3374 |
%\begin{verbatim} |
| 3375 |
%\documentclass{article} |
| 3376 |
%\usepackage[raise]{datetime} |
| 3377 |
% |
| 3378 |
%\begin{document} |
| 3379 |
%\today |
| 3380 |
%\end{document} |
| 3381 |
%\end{verbatim} |
| 3382 |
%This produces the date in the form: |
| 3383 |
%Wednesday 20\textsuperscript{th} January, 2016 |
| 3384 |
% |
| 3385 |
%With \styfmt{datetime2}, this setting \emph{may} be provided by a language |
| 3386 |
%module, where appropriate. For example: |
| 3387 |
%\begin{verbatim} |
| 3388 |
%\documentclass{article} |
| 3389 |
%\usepackage[en-GB,showdow]{datetime2} |
| 3390 |
%\DTMlangsetup[en-GB]{ord=raise} |
| 3391 |
% |
| 3392 |
%\begin{document} |
| 3393 |
%\today |
| 3394 |
%\end{document} |
| 3395 |
%\end{verbatim} |
| 3396 |
% |
| 3397 |
%\item[\pkgoptfmt{level}] This option was designed to make the ordinal |
| 3398 |
%st,nd,rd,th appear level with the rest of the text (to counteract |
| 3399 |
%the previous option). For example: |
| 3400 |
%\begin{verbatim} |
| 3401 |
%\documentclass{article} |
| 3402 |
%\usepackage[level]{datetime} |
| 3403 |
% |
| 3404 |
%\begin{document} |
| 3405 |
%\today |
| 3406 |
%\end{document} |
| 3407 |
%\end{verbatim} |
| 3408 |
%This produces the date in the form: Wednesday 20th January, 2016 |
| 3409 |
% |
| 3410 |
%With \styfmt{datetime2} this setting may be provided by a language |
| 3411 |
%module, where appropriate. This is, in fact, the default setting for |
| 3412 |
%the \style{en-GB} style: |
| 3413 |
%\begin{verbatim} |
| 3414 |
%\documentclass{article} |
| 3415 |
%\usepackage[en-GB,showdow]{datetime2} |
| 3416 |
% |
| 3417 |
%\begin{document} |
| 3418 |
%\today |
| 3419 |
%\end{document} |
| 3420 |
%\end{verbatim} |
| 3421 |
%but can be explicitly set using: |
| 3422 |
%\begin{verbatim} |
| 3423 |
%\DTMlangsetup[en-GB]{ord=level} |
| 3424 |
%\end{verbatim} |
| 3425 |
% |
| 3426 |
%\item[\pkgoptfmt{dayofweek}] This option was designed to show the |
| 3427 |
%weekday name for those styles that supported it. This is one of the |
| 3428 |
%default \styfmt{datetime} settings. For example: |
| 3429 |
%\begin{verbatim} |
| 3430 |
%\documentclass{article} |
| 3431 |
%\usepackage[dayofweek]{datetime} |
| 3432 |
% |
| 3433 |
%\begin{document} |
| 3434 |
%\today |
| 3435 |
%\end{document} |
| 3436 |
%\end{verbatim} |
| 3437 |
%This produces the date in the form: |
| 3438 |
%Wednesday 20\textsuperscript{th} January, 2016 |
| 3439 |
% |
| 3440 |
%With \styfmt{datetime2} this setting \emph{may} be provided by a language |
| 3441 |
%module, where supported. For example: |
| 3442 |
%\begin{verbatim} |
| 3443 |
%\documentclass{article} |
| 3444 |
%\usepackage[en-GB,showdow]{datetime2} |
| 3445 |
% |
| 3446 |
%\begin{document} |
| 3447 |
%\today |
| 3448 |
%\end{document} |
| 3449 |
%\end{verbatim} |
| 3450 |
%Some language modules don't support this option (just as some |
| 3451 |
%language settings with \styfmt{datetime} also don't support the |
| 3452 |
%\pkgoptfmt{dayofweek} option.) |
| 3453 |
% |
| 3454 |
%\item[\pkgoptfmt{nodayofweek}] This option was designed to hide the |
| 3455 |
%weekday name for those styles that supported it (to counteract the |
| 3456 |
%previous option). For example: |
| 3457 |
%\begin{verbatim} |
| 3458 |
%\documentclass{article} |
| 3459 |
%\usepackage[nodayofweek]{datetime} |
| 3460 |
% |
| 3461 |
%\begin{document} |
| 3462 |
%\today |
| 3463 |
%\end{document} |
| 3464 |
%\end{verbatim} |
| 3465 |
%This produces the date in the form: |
| 3466 |
%20\textsuperscript{th} January, 2016 |
| 3467 |
% |
| 3468 |
%This setting is the default for \styfmt{datetime2}. |
| 3469 |
%However, if it \pkgopt{showdow} has been switched on, it can later |
| 3470 |
%be switched off using |
| 3471 |
%\begin{verbatim} |
| 3472 |
%\DTMsetup{showdow=false} |
| 3473 |
%\end{verbatim} |
| 3474 |
% |
| 3475 |
%\item[\pkgoptfmt{hhmmss}] This option was designed for time formats in |
| 3476 |
%the style \meta{HH}:\meta{MM}:\meta{SS}. For example: |
| 3477 |
%\begin{verbatim} |
| 3478 |
%\documentclass{article} |
| 3479 |
%\usepackage[hhmmss]{datetime} |
| 3480 |
% |
| 3481 |
%\begin{document} |
| 3482 |
%\currenttime |
| 3483 |
%\end{document} |
| 3484 |
%\end{verbatim} |
| 3485 |
%This produces the time in the form: 17:28:52. |
| 3486 |
% |
| 3487 |
%This is the default for \styfmt{datetime2}: |
| 3488 |
%\begin{verbatim} |
| 3489 |
%\documentclass{article} |
| 3490 |
%\usepackage{datetime2} |
| 3491 |
% |
| 3492 |
%\begin{document} |
| 3493 |
%\DTMcurrenttime |
| 3494 |
%\end{document} |
| 3495 |
%\end{verbatim} |
| 3496 |
% |
| 3497 |
%\item[\pkgoptfmt{24hr}] This option was designed for 24 hour time formats in |
| 3498 |
%the style \meta{HH}:\meta{MM}. For example: |
| 3499 |
%\begin{verbatim} |
| 3500 |
%\documentclass{article} |
| 3501 |
%\usepackage[24hr]{datetime} |
| 3502 |
% |
| 3503 |
%\begin{document} |
| 3504 |
%\currenttime |
| 3505 |
%\end{document} |
| 3506 |
%\end{verbatim} |
| 3507 |
%This produces the time in the form: 17:28. |
| 3508 |
% |
| 3509 |
%This can be achieved using the default \styfmt{datetime2} time style |
| 3510 |
%with the seconds suppressed: |
| 3511 |
%\begin{verbatim} |
| 3512 |
%\documentclass{article} |
| 3513 |
%\usepackage[showseconds=false]{datetime2} |
| 3514 |
% |
| 3515 |
%\begin{document} |
| 3516 |
%\DTMcurrenttime |
| 3517 |
%\end{document} |
| 3518 |
%\end{verbatim} |
| 3519 |
% |
| 3520 |
%\item[\pkgoptfmt{12hr}] This option was designed for 12 hour time |
| 3521 |
%formats with \qt{am} or \qt{pm} suffixes. For example: |
| 3522 |
%\begin{verbatim} |
| 3523 |
%\documentclass{article} |
| 3524 |
%\usepackage[12hr]{datetime} |
| 3525 |
% |
| 3526 |
%\begin{document} |
| 3527 |
%\currenttime |
| 3528 |
%\end{document} |
| 3529 |
%\end{verbatim} |
| 3530 |
%This produces the time in the form: 5:28pm. |
| 3531 |
% |
| 3532 |
%This can be achieved through a \styfmt{datetime2} language module that |
| 3533 |
%supports this format. For example, the \module{english} module: |
| 3534 |
%\begin{verbatim} |
| 3535 |
%\documentclass{article} |
| 3536 |
%\usepackage[en-GB]{datetime2} |
| 3537 |
% |
| 3538 |
%\begin{document} |
| 3539 |
%\DTMcurrenttime |
| 3540 |
%\end{document} |
| 3541 |
%\end{verbatim} |
| 3542 |
% |
| 3543 |
%\item[\pkgoptfmt{oclock}] This option was designed for a UK-style full text |
| 3544 |
%time. For example: |
| 3545 |
%\begin{verbatim} |
| 3546 |
%\documentclass{article} |
| 3547 |
%\usepackage[oclock]{datetime} |
| 3548 |
% |
| 3549 |
%\begin{document} |
| 3550 |
%\currenttime |
| 3551 |
%\end{document} |
| 3552 |
%\end{verbatim} |
| 3553 |
%This produces the time in the form: |
| 3554 |
%Twenty minutes past Six in the afternoon |
| 3555 |
% |
| 3556 |
%This can be changed to \styfmt{datetime2} through the |
| 3557 |
%\sty{datetime2-en-fulltext} package, which needs to be installed |
| 3558 |
%separately: |
| 3559 |
%\begin{verbatim} |
| 3560 |
%\documentclass{article} |
| 3561 |
%\usepackage{datetime2-en-fulltext} |
| 3562 |
%\DTMsettimestyle{en-FullText} |
| 3563 |
%\begin{document} |
| 3564 |
%\DTMcurrenttime |
| 3565 |
%\end{document} |
| 3566 |
%\end{verbatim} |
| 3567 |
% |
| 3568 |
%\end{description} |
| 3569 |
% |
| 3570 |
%The \styfmt{datetime} package option \pkgoptfmt{nodate} was provided |
| 3571 |
%before multilingual support was added to allow \sty{babel} users to |
| 3572 |
%use the time commands without causing a conflict with the date. Once |
| 3573 |
%support for the \sty{babel} package was added, this option became |
| 3574 |
%superfluous. |
| 3575 |
% |
| 3576 |
%\section{Time and Date Commands} |
| 3577 |
% |
| 3578 |
%\begin{definition} |
| 3579 |
%\ics{today} |
| 3580 |
%\end{definition} |
| 3581 |
%This is a robust command in later versions of \styfmt{datetime}. In |
| 3582 |
%earlier versions is was fragile and had to be protected when used in |
| 3583 |
%moving arguments. With \styfmt{datetime2}, this command is designed to |
| 3584 |
%be expandable and so therefore is not robust and shouldn't need |
| 3585 |
%protecting. (The date styles should take care of any fragile |
| 3586 |
%commands, such as \cs{textsuperscript}, where necessary.) |
| 3587 |
% |
| 3588 |
%The current time is displayed with \styfmt{datetime} using |
| 3589 |
%\begin{definition}[\inpkg{datetime}] |
| 3590 |
%\oldcs{currenttime} |
| 3591 |
%\end{definition} |
| 3592 |
%The \styfmt{datetime2} equivalent is: |
| 3593 |
%\begin{definition}[\inpkg{datetime2}] |
| 3594 |
%\ics{DTMcurrenttime} |
| 3595 |
%\end{definition} |
| 3596 |
%Again, the command provided by \styfmt{datetime} is robust and the |
| 3597 |
%equivalent command provided by \styfmt{datetime2} is designed to be |
| 3598 |
%expandable. |
| 3599 |
% |
| 3600 |
%A specific date is display by \styfmt{datetime}'s |
| 3601 |
%\begin{definition}[\inpkg{datetime}] |
| 3602 |
%\oldcs{formatdate}\marg{DD}\marg{MM}\marg{YYYY} |
| 3603 |
%\end{definition} |
| 3604 |
%command. The arguments are in little-endian (UK) order with the day, |
| 3605 |
%month and year. With \styfmt{datetime2} you can use either: |
| 3606 |
%\begin{definition}[\inpkg{datetime2}] |
| 3607 |
%\ics{DTMdisplay}\marg{YYYY}\marg{MM}\marg{DD}\marg{dow} |
| 3608 |
%\end{definition} |
| 3609 |
%(expandable) or |
| 3610 |
%\begin{definition}[\inpkg{datetime2}] |
| 3611 |
%\ics{DTMdate}\{\meta{YYYY}-\meta{MM}-\meta{DD}\} |
| 3612 |
%\end{definition} |
| 3613 |
%(robust) where \meta{YYYY} is the year, \meta{MM} is the month |
| 3614 |
%number, \meta{DD} is the day of month number and \meta{dow} is the |
| 3615 |
%day of week number (starting from 0 for Monday) or \texttt{-1} to |
| 3616 |
%disregard it. |
| 3617 |
% |
| 3618 |
%A specific time is displayed by \styfmt{datetime}'s |
| 3619 |
%\begin{definition}[\inpkg{datetime}] |
| 3620 |
%\oldcs{formattime}\marg{hh}\marg{mm}\marg{ss} |
| 3621 |
%\end{definition} |
| 3622 |
%command, which has three arguments: the hour (24) the minutes past |
| 3623 |
%the hour and the seconds past the minute. With \styfmt{datetime2} you |
| 3624 |
%can use either: |
| 3625 |
%\begin{definition}[\inpkg{datetime2}] |
| 3626 |
%\ics{DTMdisplaytime}\marg{hh}\marg{mm}\marg{ss} |
| 3627 |
%\end{definition} |
| 3628 |
%(expandable) or |
| 3629 |
%\begin{definition}[\inpkg{datetime2}] |
| 3630 |
%\ics{DTMtime}\{\meta{hh}:\meta{mm}:\meta{ss}\} |
| 3631 |
%\end{definition} |
| 3632 |
%(robust) where \meta{hh} is the hour, \meta{mm} is the minutes and |
| 3633 |
%\meta{ss} is the seconds. |
| 3634 |
% |
| 3635 |
%The date separator used by the predefined \styfmt{datetime} styles is |
| 3636 |
%given by |
| 3637 |
%\begin{definition}[\inpkg{datetime}] |
| 3638 |
%\oldcs{dateseparator} |
| 3639 |
%\end{definition} |
| 3640 |
%which needs to be redefined if |
| 3641 |
%required. With \styfmt{datetime2}, the date separator for the base |
| 3642 |
%numeric styles (except the fixed \style{iso} style) can be changed |
| 3643 |
%through the \pkgopt{datesep} package option. For example: |
| 3644 |
%\begin{verbatim} |
| 3645 |
%\usepackage[datesep={.}]{datetime2} |
| 3646 |
%\end{verbatim} |
| 3647 |
%or |
| 3648 |
%\begin{verbatim} |
| 3649 |
%\DTMsetup{datesep={.}} |
| 3650 |
%\end{verbatim} |
| 3651 |
%Some of the language modules may also provide a similar option. For |
| 3652 |
%example: |
| 3653 |
%\begin{verbatim} |
| 3654 |
%\usepackage[en-GB]{datetime2} |
| 3655 |
%\DTMlangsetup[en-GB]{datesep={.}} |
| 3656 |
%\end{verbatim} |
| 3657 |
% |
| 3658 |
%The time separator for \styfmt{datetime} is given by |
| 3659 |
%\begin{definition}[\inpkg{datetime}] |
| 3660 |
%\oldcs{timeseparator} |
| 3661 |
%\end{definition} |
| 3662 |
%With \styfmt{datetime2}, the time separator for the |
| 3663 |
%basic numeric styles (not including the fixed \style{iso} style) can be |
| 3664 |
%changed through the \pkgopt{timesep} package option. For example: |
| 3665 |
%\begin{verbatim} |
| 3666 |
%\usepackage[timesep={.}]{datetime2} |
| 3667 |
%\end{verbatim} |
| 3668 |
%or |
| 3669 |
%\begin{verbatim} |
| 3670 |
%\usepackage{datetime2} |
| 3671 |
%\DTMsetup{timesep={.}} |
| 3672 |
%\end{verbatim} |
| 3673 |
%Some of the language modules may also provide a similar option. For |
| 3674 |
%example: |
| 3675 |
%\begin{verbatim} |
| 3676 |
%\usepackage[en-GB]{datetime2} |
| 3677 |
%\DTMlangsetup[en-GB]{timesep={.}} |
| 3678 |
%\end{verbatim} |
| 3679 |
% |
| 3680 |
%\begin{definition}[\inpkg{datetime}] |
| 3681 |
%\oldcs{pdfdate} |
| 3682 |
%\end{definition} |
| 3683 |
%The \cs{pdfdate} command provided by \styfmt{datetime} for use within |
| 3684 |
%\ics{pdfinfo} became redundant with the introduction of |
| 3685 |
%\ics{pdfcreationdate} to PDF\TeX\ version 1.30.0. |
| 3686 |
% |
| 3687 |
%Old style (using \styfmt{datetime}): |
| 3688 |
%\begin{verbatim} |
| 3689 |
%\pdfinfo{ |
| 3690 |
% /Author (Me) |
| 3691 |
% /Title (A Sample Document) |
| 3692 |
% /CreationDate (D:20040501215500) |
| 3693 |
% /ModDate (D:\pdfdate) |
| 3694 |
%} |
| 3695 |
%\end{verbatim} |
| 3696 |
%New style (simply using PDF\TeX): |
| 3697 |
%\begin{verbatim} |
| 3698 |
%\pdfinfo{ |
| 3699 |
% /Author (Me) |
| 3700 |
% /Title (A Sample Document) |
| 3701 |
% /CreationDate (D:20040501215500) |
| 3702 |
% /ModDate (\pdfcreationdate) |
| 3703 |
%} |
| 3704 |
%\end{verbatim} |
| 3705 |
%Alternatively you can use the \style{pdf} style: |
| 3706 |
%\begin{verbatim} |
| 3707 |
%\DTMsetstyle{pdf} |
| 3708 |
%\pdfinfo{ |
| 3709 |
% /Author (Me) |
| 3710 |
% /Title (A Sample Document) |
| 3711 |
% /CreationDate (\DTMdisplay{2004}{05}{01}{-1}{21}{55}{00}{00}{00}) |
| 3712 |
% /ModDate (\DTMnow) |
| 3713 |
%} |
| 3714 |
%\end{verbatim} |
| 3715 |
% |
| 3716 |
%The \styfmt{datetime} command to display the month name is |
| 3717 |
%\begin{definition}[\inpkg{datetime}] |
| 3718 |
%\oldcs{monthname}\oarg{n} |
| 3719 |
%\end{definition} |
| 3720 |
%which can't be expanded. With |
| 3721 |
%\styfmt{datetime2}, the month name for a specific language can be |
| 3722 |
%obtained from a command provided by the relevant module. For |
| 3723 |
%example, the \module{english} module provides |
| 3724 |
%\begin{definition}[\inpkg{datetime2-english}] |
| 3725 |
%\ics{DTMenglishmonthname}\marg{n} |
| 3726 |
%\end{definition} |
| 3727 |
%which is expandable. These types of commands are designed for use |
| 3728 |
%within language-dependent date styles. This ensures that the name |
| 3729 |
%matches the style. (One of the failings of \styfmt{datetime} was that |
| 3730 |
%the original date styles provided when the package was originally |
| 3731 |
%only intended for British dates produced weird hybrid styles when |
| 3732 |
%multilingual support was later added and styles such as \pkgoptfmt{long} |
| 3733 |
%were used with another language.) These types of commands provided |
| 3734 |
%by the \styfmt{datetime2} language modules are analogous to the |
| 3735 |
%\cs{monthname\meta{language}} commands provided by \styfmt{datetime}'s |
| 3736 |
%supporting language files (for example, |
| 3737 |
%\begin{definition}[\inpkg{datetime-defaults}] |
| 3738 |
%\oldcs{monthnameenglish}\oarg{n} |
| 3739 |
%\end{definition} |
| 3740 |
%in \styfmt{datetime-defaults} or |
| 3741 |
%\begin{definition}[\inpkg{dt-french.def}] |
| 3742 |
%\oldcs{monthnamefrench}\oarg{n} |
| 3743 |
%\end{definition} |
| 3744 |
%defined in \styfmt{dt-french.def}) except that the \styfmt{datetime} commands have |
| 3745 |
%an optional argument which means they're not expandable. |
| 3746 |
% |
| 3747 |
%If you load the \styfmt{datetime2-calc} package, |
| 3748 |
%either explicitly or through the \pkgopt{calc} or \pkgopt{showdow} |
| 3749 |
%\styfmt{datetime2} package options, then \sty{pgfcalendar} will also be |
| 3750 |
%loaded. In which case you can use |
| 3751 |
%\begin{definition}[\inpkg{pgfcalendar}] |
| 3752 |
%\ics{pgfcalendarmonthname}\marg{n} |
| 3753 |
%\end{definition} |
| 3754 |
%even if none of the \styfmt{datetime2} language modules have been |
| 3755 |
%loaded. This command requires the \sty{translator} package to |
| 3756 |
%provide multilingual support. See the \styfmt{pgf} manual for further |
| 3757 |
%details. |
| 3758 |
% |
| 3759 |
%Another possibility if you want the month name alone using the |
| 3760 |
%current language is to use the robust command |
| 3761 |
%\begin{definition}[\inpkg{datetime2-calc}] |
| 3762 |
%\ics{DTMmonthname}\marg{n} |
| 3763 |
%\end{definition} |
| 3764 |
%defined by \styfmt{datetime2-calc}. This is the closest match to |
| 3765 |
%\styfmt{datetime}'s \oldcs{monthname} command but note that the argument |
| 3766 |
%isn't optional. Remember that you can use \ics{month} for the current |
| 3767 |
%month number, which is the value of \meta{n} when omitted in |
| 3768 |
%\oldcs{monthname}. |
| 3769 |
% |
| 3770 |
%Old style (\styfmt{datetime}): |
| 3771 |
%\begin{verbatim} |
| 3772 |
%\documentclass{article} |
| 3773 |
% |
| 3774 |
%\usepackage[T1]{fontenc} |
| 3775 |
%\usepackage[utf8]{inputenc} |
| 3776 |
%\usepackage[french,english]{babel} |
| 3777 |
% |
| 3778 |
%\usepackage{datetime} |
| 3779 |
% |
| 3780 |
%\begin{document} |
| 3781 |
%\selectlanguage{french} |
| 3782 |
%\monthname |
| 3783 |
% |
| 3784 |
%\selectlanguage{english} |
| 3785 |
%\monthname |
| 3786 |
%\end{document} |
| 3787 |
%\end{verbatim} |
| 3788 |
%New style (\styfmt{datetime2} with the \module{french} and |
| 3789 |
%\module{english} modules): |
| 3790 |
%\begin{verbatim} |
| 3791 |
%\documentclass{article} |
| 3792 |
% |
| 3793 |
%\usepackage[T1]{fontenc} |
| 3794 |
%\usepackage[utf8]{inputenc} |
| 3795 |
%\usepackage[french,english]{babel} |
| 3796 |
% |
| 3797 |
%\usepackage[calc]{datetime2} |
| 3798 |
% |
| 3799 |
%\begin{document} |
| 3800 |
%\selectlanguage{french} |
| 3801 |
%\DTMmonthname{\month} |
| 3802 |
% |
| 3803 |
%\selectlanguage{english} |
| 3804 |
%\DTMmonthname{\month} |
| 3805 |
%\end{document} |
| 3806 |
%\end{verbatim} |
| 3807 |
% |
| 3808 |
%The abbreviated month name is given by |
| 3809 |
%\begin{definition}[\inpkg{datetime}] |
| 3810 |
%\oldcs{shortmonthname}\oarg{n} |
| 3811 |
%\end{definition} |
| 3812 |
%in |
| 3813 |
%\styfmt{datetime}. Similar to above, language modules may provide an |
| 3814 |
%expandable command to produce the abbreviated name in that specific |
| 3815 |
%language. For example, the \module{english} module provides |
| 3816 |
%\begin{definition}[\inpkg{datetime2-english}] |
| 3817 |
%\ics{DTMenglishshortmonthname}\marg{n} |
| 3818 |
%\end{definition} |
| 3819 |
%As with \cs{DTMenglishmonthname}, this is designed for use in |
| 3820 |
%English date styles. |
| 3821 |
% |
| 3822 |
%Again, if \styfmt{datetime2-calc} is loaded, the \sty{pgfcalendar} |
| 3823 |
%command is also available: |
| 3824 |
%\begin{definition}[\inpkg{pgfcalendar}] |
| 3825 |
%\ics{pgfcalendarmonthshortname}\marg{n} |
| 3826 |
%\end{definition} |
| 3827 |
%Alternative you can use the robust command defined by |
| 3828 |
%\styfmt{datetime2-calc}: |
| 3829 |
%\begin{definition}[\inpkg{datetime2-calc}] |
| 3830 |
%\ics{DTMshortmonthname}\marg{n} |
| 3831 |
%\end{definition} |
| 3832 |
% |
| 3833 |
%Old style (\styfmt{datetime}): |
| 3834 |
%\begin{verbatim} |
| 3835 |
%\documentclass{article} |
| 3836 |
% |
| 3837 |
%\usepackage[T1]{fontenc} |
| 3838 |
%\usepackage[utf8]{inputenc} |
| 3839 |
%\usepackage[french,english]{babel} |
| 3840 |
% |
| 3841 |
%\usepackage{datetime} |
| 3842 |
% |
| 3843 |
%\begin{document} |
| 3844 |
%\selectlanguage{french} |
| 3845 |
%\shortmonthname |
| 3846 |
% |
| 3847 |
%\selectlanguage{english} |
| 3848 |
%\shortmonthname |
| 3849 |
%\end{document} |
| 3850 |
%\end{verbatim} |
| 3851 |
%New style (\styfmt{datetime2} with the \module{french} and |
| 3852 |
%\module{english} modules): |
| 3853 |
%\begin{verbatim} |
| 3854 |
%\documentclass{article} |
| 3855 |
% |
| 3856 |
%\usepackage[T1]{fontenc} |
| 3857 |
%\usepackage[utf8]{inputenc} |
| 3858 |
%\usepackage[french,english]{babel} |
| 3859 |
% |
| 3860 |
%\usepackage[calc]{datetime2} |
| 3861 |
% |
| 3862 |
%\begin{document} |
| 3863 |
%\selectlanguage{french} |
| 3864 |
%\DTMshortmonthname{\month} |
| 3865 |
% |
| 3866 |
%\selectlanguage{english} |
| 3867 |
%\DTMshortmonthname{\month} |
| 3868 |
%\end{document} |
| 3869 |
%\end{verbatim} |
| 3870 |
% |
| 3871 |
%See \sectionref{sec:calc} and \sectionref{sec:names} for further |
| 3872 |
%details. |
| 3873 |
% |
| 3874 |
%The weekday names in \styfmt{datetime} are more complicated |
| 3875 |
%and not all the \texttt{dt-\meta{lang}.def} files provide translations. The ones |
| 3876 |
%that do support the weekday provide |
| 3877 |
%\begin{definition}[\inpkg{dt-\meta{lang}.def}] |
| 3878 |
%\oldcs{dayofweeknameid\meta{lang}}\marg{n} |
| 3879 |
%\end{definition} |
| 3880 |
%which takes a single argument that's an integer from 1 (Sunday) to 7 (Saturday). |
| 3881 |
%For example, |
| 3882 |
%\begin{definition}[\inpkg{datetime-defaults}] |
| 3883 |
%\oldcs{dayofweeknameidenglish}\marg{n} |
| 3884 |
%\end{definition} |
| 3885 |
%or |
| 3886 |
%\begin{definition}[\inpkg{dt-french.def}] |
| 3887 |
%\oldcs{dayofweeknameidfrench}\marg{n} |
| 3888 |
%\end{definition} |
| 3889 |
% |
| 3890 |
%The \styfmt{datetime2} language modules that support the weekday name |
| 3891 |
%provide |
| 3892 |
%\begin{definition}[\inpkg{datetime2-\meta{lang}}] |
| 3893 |
%\cs{DTM\meta{lang}weekdayname}\marg{dow} |
| 3894 |
%\end{definition} |
| 3895 |
%which takes a single argument that's an integer from 0 (Monday) to 6 |
| 3896 |
%(Sunday). As with \styfmt{datetime}, not all of the \styfmt{datetime2} |
| 3897 |
%language modules support the weekday. |
| 3898 |
% |
| 3899 |
%Old style (\styfmt{datetime}): |
| 3900 |
%\begin{verbatim} |
| 3901 |
%\documentclass{article} |
| 3902 |
%\usepackage[T1]{fontenc} |
| 3903 |
%\usepackage[utf8]{inputenc} |
| 3904 |
%\usepackage[french,english]{babel} |
| 3905 |
%\usepackage{datetime} |
| 3906 |
% |
| 3907 |
%\begin{document} |
| 3908 |
%\dayofweeknameidfrench{1} |
| 3909 |
% |
| 3910 |
%\dayofweeknameidenglish{1} |
| 3911 |
%\end{document} |
| 3912 |
%\end{verbatim} |
| 3913 |
%New style (\styfmt{datetime2} with the \module{english} and |
| 3914 |
%\module{french} modules): |
| 3915 |
%\begin{verbatim} |
| 3916 |
%\documentclass{article} |
| 3917 |
%\usepackage[T1]{fontenc} |
| 3918 |
%\usepackage[utf8]{inputenc} |
| 3919 |
%\usepackage[french,english]{babel} |
| 3920 |
%\usepackage{datetime2} |
| 3921 |
% |
| 3922 |
%\begin{document} |
| 3923 |
%\DTMfrenchweekdayname{6} |
| 3924 |
% |
| 3925 |
%\DTMenglishweekdayname{6} |
| 3926 |
%\end{document} |
| 3927 |
%\end{verbatim} |
| 3928 |
% |
| 3929 |
%As with the month name, date styles should explicitly use the |
| 3930 |
%weekday macro (if provided) for the specific language to display |
| 3931 |
%the weekday name rather than using a macro that varies according to |
| 3932 |
%the current language. |
| 3933 |
% |
| 3934 |
%The \styfmt{datetime} package provides |
| 3935 |
%\begin{definition}[\inpkg{datetime}] |
| 3936 |
%\oldcs{dayofweeknameid}\marg{n} |
| 3937 |
%\end{definition} |
| 3938 |
%to provide the weekday name for the current language. If the current language |
| 3939 |
%doesn't provide a translation for the weekday names, then the |
| 3940 |
%English names are used. This command basically attempts to use |
| 3941 |
%\cs{dayofweeknameid\meta{lang}} (where \meta{lang} is given |
| 3942 |
%by \cs{languagename}) if it exists otherwise it uses |
| 3943 |
%\oldcs{dayofweeknameidenglish}. This language-sensitive macro is a fragile |
| 3944 |
%command that requires protection in moving arguments. |
| 3945 |
% |
| 3946 |
%As before, if the \styfmt{datetime2-calc} package is loaded, the |
| 3947 |
%\sty{pgfcalendar} package's commands are also available including |
| 3948 |
%\begin{definition}[\inpkg{pgfcalendar}] |
| 3949 |
%\ics{pgfcalendarweekdayname}\marg{dow} |
| 3950 |
%\end{definition} |
| 3951 |
%where the argument \meta{dow} is an integer from 0 (Monday) to 6 |
| 3952 |
%(Sunday). Multilingual support is provided through the |
| 3953 |
%\sty{translator} package. |
| 3954 |
% |
| 3955 |
%The \styfmt{datetime2-calc} package also provides a robust |
| 3956 |
%language-sensitive command: |
| 3957 |
%\begin{definition}[\inpkg{datetime2-calc}] |
| 3958 |
%\ics{DTMweekdayname}\marg{dow} |
| 3959 |
%\end{definition} |
| 3960 |
%This attempts to use \cs{DTM\meta{lang}weekdayname} if it exists, |
| 3961 |
%where \meta{lang} is either \cs{languagename} or obtained from the |
| 3962 |
%dialect-to-language mapping provided by \sty{tracklang}. If both |
| 3963 |
%attempts fail, \cs{DTMweekdayname} will fallback on |
| 3964 |
%\cs{pgfcalendarweekdayname} (with a warning through |
| 3965 |
%\ics{dtmnamewarning}). |
| 3966 |
% |
| 3967 |
%Old style (\styfmt{datetime}): |
| 3968 |
%\begin{verbatim} |
| 3969 |
%\documentclass{article} |
| 3970 |
%\usepackage[T1]{fontenc} |
| 3971 |
%\usepackage[utf8]{inputenc} |
| 3972 |
%\usepackage[french,english]{babel} |
| 3973 |
% |
| 3974 |
%\usepackage{datetime} |
| 3975 |
% |
| 3976 |
%\begin{document} |
| 3977 |
% |
| 3978 |
%\selectlanguage{french} |
| 3979 |
%\dayofweeknameid{1} |
| 3980 |
% |
| 3981 |
%\selectlanguage{english} |
| 3982 |
%\dayofweeknameid{1} |
| 3983 |
%\end{document} |
| 3984 |
%\end{verbatim} |
| 3985 |
%New style (\styfmt{datetime2} with the \module{english} and |
| 3986 |
%\module{french} modules): |
| 3987 |
%\begin{verbatim} |
| 3988 |
%\documentclass{article} |
| 3989 |
%\usepackage[T1]{fontenc} |
| 3990 |
%\usepackage[utf8]{inputenc} |
| 3991 |
%\usepackage[french,english]{babel} |
| 3992 |
% |
| 3993 |
%\usepackage[calc]{datetime2} |
| 3994 |
% |
| 3995 |
%\begin{document} |
| 3996 |
% |
| 3997 |
%\selectlanguage{french} |
| 3998 |
%\DTMweekdayname{6} |
| 3999 |
% |
| 4000 |
%\selectlanguage{english} |
| 4001 |
%\DTMweekdayname{6} |
| 4002 |
%\end{document} |
| 4003 |
%\end{verbatim} |
| 4004 |
% |
| 4005 |
%The \styfmt{datetime} package also provides the command |
| 4006 |
%\begin{definition}[\inpkg{datetime}] |
| 4007 |
%\oldcs{dayofweekname}\marg{DD}\marg{MM}\marg{YYYY} |
| 4008 |
%\end{definition} |
| 4009 |
%that has three arguments: the day of the month, |
| 4010 |
%the month number and the year. This calculates the day of week |
| 4011 |
%index \meta{n}, an integer from 1 (Sunday) to 7 (Saturday), and then uses the |
| 4012 |
%result in the argument of \oldcs{dayofweeknameid}\marg{n}. The |
| 4013 |
%\cs{dayofweekname} command was provided by \styfmt{datetime} as a |
| 4014 |
%convenient shortcut for use in date styles. (Similarly for |
| 4015 |
%\oldcs{shortdayofweekname}.) With the \styfmt{datetime2} date styles, the |
| 4016 |
%day-of-week index is automatically available through the fourth |
| 4017 |
%argument of \ics{DTMdisplaydate} (and \ics{DTMDisplaydate}), so there |
| 4018 |
%is little use for an equivalent command. Additionally, if a date has |
| 4019 |
%already been saved with \styfmt{datetime2}, the weekday can be |
| 4020 |
%extracted from the saved data through \ics{DTMfetchdow}, which can be |
| 4021 |
%used in the argument of commands like \ics{DTMweekdayname} or |
| 4022 |
%\ics{DTMenglishweekdayname}. |
| 4023 |
% |
| 4024 |
%However, if a calculation is required for some reason, it can be |
| 4025 |
%obtained using the \sty{pgfcalendar} commands |
| 4026 |
%\ics{pgfcalendardatetojulian} and \ics{pgfcalendarjuliantoweekday}, |
| 4027 |
%which are described in the \styfmt{pgf} manual. |
| 4028 |
% |
| 4029 |
%The \styfmt{datetime} package provides the conditional |
| 4030 |
%\begin{definition}[\inpkg{datetime}] |
| 4031 |
%\oldcs{ifshowdow} |
| 4032 |
%\end{definition} |
| 4033 |
%which can be used to determine whether or not styles should display |
| 4034 |
%the weekday name (if supported). The \styfmt{datetime2} package has the |
| 4035 |
%analogous conditional |
| 4036 |
%\begin{definition}[\inpkg{datetime2}] |
| 4037 |
%\ics{ifDTMshowdow} |
| 4038 |
%\end{definition} |
| 4039 |
% |
| 4040 |
%The \styfmt{datetime} package provides the command |
| 4041 |
%\begin{definition}[\inpkg{datetime}] |
| 4042 |
%\oldcs{ordinaldate}\marg{n} |
| 4043 |
%\end{definition} |
| 4044 |
%as a date-type ordinal where the argument should be an integer from 1 |
| 4045 |
%to 31. For English, this just uses \sty{fmtcount}'s |
| 4046 |
%non-expandable \cs{ordinalnum} command. For Breton, Welsh and French |
| 4047 |
%a suffix is only added when the argument is 1. For all other |
| 4048 |
%languages, this command just displays the number. |
| 4049 |
% |
| 4050 |
%With \styfmt{datetime2}, the language modules may or may not provide a |
| 4051 |
%command to display the ordinal but most of them do. For example, the |
| 4052 |
%\module{english} module provides |
| 4053 |
%\begin{definition}[\inpkg{datetime2-english}] |
| 4054 |
%\ics{DTMenglishordinal}\marg{n} |
| 4055 |
%\end{definition} |
| 4056 |
%This displays the suffix using |
| 4057 |
%\begin{definition}[\inpkg{datetime2-english}] |
| 4058 |
%\ics{DTMenglishfmtordsuffix}\marg{suffix} |
| 4059 |
%\end{definition} |
| 4060 |
%The definition of this command is changed by the styles provided by |
| 4061 |
%the English regional modules. For example, the \style{en-US} style |
| 4062 |
%redefines \cs{DTMenglishfmtordsuffix} to ignore its argument. |
| 4063 |
%See the documentation for the \module{english} module for further |
| 4064 |
%details. |
| 4065 |
% |
| 4066 |
%The \module{french} module provides: |
| 4067 |
%\begin{definition}[\inpkg{datetime2-french}] |
| 4068 |
%\ics{DTMfrenchordinal}\marg{n} |
| 4069 |
%\end{definition} |
| 4070 |
%This displays \meta{n} and if \meta{n} is 1, a suffix is appended. |
| 4071 |
%See the \module{french} module documentation for further details. |
| 4072 |
% |
| 4073 |
%The \module{breton} module provides: |
| 4074 |
%\begin{definition}[\inpkg{datetime2-breton}] |
| 4075 |
%\ics{DTMbretonordinal}\marg{n} |
| 4076 |
%\end{definition} |
| 4077 |
%which similarly appends a suffix if \meta{n} is 1 but not for other |
| 4078 |
%values. In this case, the suffix for the first day is formatted using |
| 4079 |
%\begin{definition}[\inpkg{datetime2-breton}] |
| 4080 |
%\ics{DTMbretonfmtordinal}\marg{suffix} |
| 4081 |
%\end{definition} |
| 4082 |
%which is redefined by the \csopt{DTMlangsetup}{ord} option. |
| 4083 |
%See the \module{breton} module documentation for further details. |
| 4084 |
% |
| 4085 |
%The \module{welsh} module similarly provides: |
| 4086 |
%\begin{definition}[\inpkg{datetime2-welsh}] |
| 4087 |
%\ics{DTMwelshordinal}\marg{n} |
| 4088 |
%\end{definition} |
| 4089 |
%and |
| 4090 |
%\begin{definition}[\inpkg{datetime2-welsh}] |
| 4091 |
%\ics{DTMwelshfmtordinal}\marg{suffix} |
| 4092 |
%\end{definition} |
| 4093 |
%See the \module{welsh} module documentation for further details. |
| 4094 |
% |
| 4095 |
%Other modules may simply define \cs{DTM\meta{lang}ordinal} to just |
| 4096 |
%display its argument. For example, the \module{german} module |
| 4097 |
%provides |
| 4098 |
%\begin{definition}[\inpkg{datetime2-german}] |
| 4099 |
%\ics{DTMgermanordinal}\marg{n} |
| 4100 |
%\end{definition} |
| 4101 |
%which just displays \meta{n} (the day of month number). |
| 4102 |
% |
| 4103 |
%Alternatively, modules may define \cs{DTM\meta{lang}ordinal} to |
| 4104 |
%display its argument followed by a full stop (period). For example, |
| 4105 |
%the \module{norsk} module provides |
| 4106 |
%\begin{definition}[\inpkg{datetime2-norsk}] |
| 4107 |
%\ics{DTMnorskordinal}\marg{n} |
| 4108 |
%\end{definition} |
| 4109 |
%which displays \meta{n} followed by a full stop. |
| 4110 |
% |
| 4111 |
%As before, the date styles should explicitly use the ordinal macro |
| 4112 |
%that matches the style. However, if you have some need to display |
| 4113 |
%the day of month independent of any of the styles, you can use |
| 4114 |
%\begin{definition}[\inpkg{datetime2-calc}] |
| 4115 |
%\ics{DTMordinal}\marg{n} |
| 4116 |
%\end{definition} |
| 4117 |
%which is provided by \styfmt{datetime2-calc}. This attempts to use |
| 4118 |
%\cs{DTM\meta{lang}ordinal} if it exists, otherwise it just displays |
| 4119 |
%\meta{n}. |
| 4120 |
% |
| 4121 |
%Old style (\styfmt{datetime}): |
| 4122 |
%\begin{verbatim} |
| 4123 |
%\documentclass{article} |
| 4124 |
%\usepackage[T1]{fontenc} |
| 4125 |
%\usepackage[utf8]{inputenc} |
| 4126 |
%\usepackage[french,english]{babel} |
| 4127 |
% |
| 4128 |
%\usepackage{datetime} |
| 4129 |
% |
| 4130 |
%\begin{document} |
| 4131 |
% |
| 4132 |
%\selectlanguage{french} |
| 4133 |
%\ordinaldate{1} |
| 4134 |
% |
| 4135 |
%\selectlanguage{english} |
| 4136 |
%\ordinaldate{1} |
| 4137 |
%\end{document} |
| 4138 |
%\end{verbatim} |
| 4139 |
%This displays 1\textsuperscript{er} in the first case (through |
| 4140 |
%\cs{ordinaldatefrench}) and |
| 4141 |
%1\textsuperscript{st} in the second case (through \sty{fmtcount}'s |
| 4142 |
%\cs{ordinalnum}). |
| 4143 |
% |
| 4144 |
%New style (\styfmt{datetime2} with the \module{english} and |
| 4145 |
%\module{french} modules): |
| 4146 |
%\begin{verbatim} |
| 4147 |
%\documentclass{article} |
| 4148 |
%\usepackage[T1]{fontenc} |
| 4149 |
%\usepackage[utf8]{inputenc} |
| 4150 |
%\usepackage[french,english]{babel} |
| 4151 |
% |
| 4152 |
%\usepackage[calc]{datetime2} |
| 4153 |
% |
| 4154 |
%\begin{document} |
| 4155 |
% |
| 4156 |
%\selectlanguage{french} |
| 4157 |
%\DTMordinal{1} |
| 4158 |
% |
| 4159 |
%\selectlanguage{english} |
| 4160 |
%\DTMordinal{1} |
| 4161 |
%\end{document} |
| 4162 |
%\end{verbatim} |
| 4163 |
%This displays 1\textsuperscript{er} in the first case and |
| 4164 |
%just 1 in the second case, because the regionless \module{english} |
| 4165 |
%module doesn't use a suffix. |
| 4166 |
% |
| 4167 |
%To achieve the same result as the \styfmt{datetime} example, a few |
| 4168 |
%modifications are needed: |
| 4169 |
%\begin{verbatim} |
| 4170 |
%\documentclass{article} |
| 4171 |
%\usepackage[T1]{fontenc} |
| 4172 |
%\usepackage[utf8]{inputenc} |
| 4173 |
%\usepackage[french,british]{babel} |
| 4174 |
% |
| 4175 |
%\usepackage[calc,useregional]{datetime2} |
| 4176 |
%\DTMlangsetup[en-GB]{ord=raise} |
| 4177 |
% |
| 4178 |
%\begin{document} |
| 4179 |
% |
| 4180 |
%\selectlanguage{french} |
| 4181 |
%\DTMordinal{1} |
| 4182 |
% |
| 4183 |
%\selectlanguage{british} |
| 4184 |
%\DTMordinal{1} |
| 4185 |
%\end{document} |
| 4186 |
%\end{verbatim} |
| 4187 |
% |
| 4188 |
%The \styfmt{datetime} package provides the command |
| 4189 |
%\begin{definition}[\inpkg{datetime}] |
| 4190 |
%\oldcs{twodigit}\marg{n} |
| 4191 |
%\end{definition} |
| 4192 |
%for use in date styles that require two-digit |
| 4193 |
%numbers. The \styfmt{datetime2} package provides |
| 4194 |
%\begin{definition}[\inpkg{datetime2}] |
| 4195 |
%\ics{DTMtwodigits}\marg{n} |
| 4196 |
%\end{definition} |
| 4197 |
% |
| 4198 |
%\section{Saving Dates} |
| 4199 |
% |
| 4200 |
%The \styfmt{datetime} package provides some commands for saving a date |
| 4201 |
%for later use. (There are no equivalent commands for saving a time |
| 4202 |
%in \styfmt{datetime}.) |
| 4203 |
%With \styfmt{datetime}, a date is saved using |
| 4204 |
%\begin{definition}[\inpkg{datetime}] |
| 4205 |
%\oldcs{newdate}\marg{name}\marg{DD}\marg{MM}\marg{YYYY} |
| 4206 |
%\end{definition} |
| 4207 |
%With \styfmt{datetime2}, a date can be saved using |
| 4208 |
%\begin{definition}[\inpkg{datetime2}] |
| 4209 |
%\ics{DTMsavedate}\marg{name}\marg{date} |
| 4210 |
%\end{definition} |
| 4211 |
%where \meta{date} is in the form |
| 4212 |
%\texttt{\meta{YYYY}-\meta{MM}-\meta{DD}}. |
| 4213 |
% |
| 4214 |
%A previously saved date can be displayed with \styfmt{datetime} using: |
| 4215 |
%\begin{definition}[\inpkg{datetime}] |
| 4216 |
%\oldcs{displaydate}\marg{name} |
| 4217 |
%\end{definition} |
| 4218 |
%With \styfmt{datetime2}, the saved date can be displayed using: |
| 4219 |
%\begin{definition}[\inpkg{datetime2}] |
| 4220 |
%\ics{DTMusedate}\marg{name} |
| 4221 |
%\end{definition} |
| 4222 |
% |
| 4223 |
%Old style (\styfmt{datetime}): |
| 4224 |
%\begin{verbatim} |
| 4225 |
%\documentclass{article} |
| 4226 |
%\usepackage{datetime} |
| 4227 |
% |
| 4228 |
%\begin{document} |
| 4229 |
% |
| 4230 |
%\newdate{mydate}{20}{1}{2016} |
| 4231 |
%\displaydate{mydate} |
| 4232 |
% |
| 4233 |
%\end{document} |
| 4234 |
%\end{verbatim} |
| 4235 |
%New style (\styfmt{datetime2}): |
| 4236 |
%\begin{verbatim} |
| 4237 |
%\documentclass{article} |
| 4238 |
%\usepackage[en-GB,showdow]{datetime2} |
| 4239 |
% |
| 4240 |
%\begin{document} |
| 4241 |
% |
| 4242 |
%\DTMsavedate{mydate}{2016-01-20} |
| 4243 |
%\DTMusedate{mydate} |
| 4244 |
% |
| 4245 |
%\end{document} |
| 4246 |
%\end{verbatim} |
| 4247 |
% |
| 4248 |
%Individual elements of the date can be extracted with the |
| 4249 |
%\styfmt{datetime} commands: |
| 4250 |
%\begin{definition}[\inpkg{datetime}] |
| 4251 |
%\oldcs{getdateday}\marg{name} |
| 4252 |
%\end{definition} |
| 4253 |
%for the day of the month, |
| 4254 |
%\begin{definition}[\inpkg{datetime}] |
| 4255 |
%\oldcs{getdatemonth}\marg{name} |
| 4256 |
%\end{definition} |
| 4257 |
%for the month number, and |
| 4258 |
%\begin{definition}[\inpkg{datetime}] |
| 4259 |
%\oldcs{getdateyear}\marg{name} |
| 4260 |
%\end{definition} |
| 4261 |
%for the year. |
| 4262 |
% |
| 4263 |
%These elements can be fetched in \styfmt{datetime2} using: |
| 4264 |
%\begin{definition}[\inpkg{datetime2}] |
| 4265 |
%\ics{DTMfetchday}\marg{name} |
| 4266 |
%\end{definition} |
| 4267 |
%for the day of the month, |
| 4268 |
%\begin{definition}[\inpkg{datetime2}] |
| 4269 |
%\ics{DTMfetchmonth}\marg{name} |
| 4270 |
%\end{definition} |
| 4271 |
%for the month number, and |
| 4272 |
%\begin{definition}[\inpkg{datetime2}] |
| 4273 |
%\ics{DTMfetchyear}\marg{name} |
| 4274 |
%\end{definition} |
| 4275 |
%for the year. Additionally you can fetch the day of week index if it |
| 4276 |
%has been computed: |
| 4277 |
%\begin{definition}[\inpkg{datetime2}] |
| 4278 |
%\ics{DTMfetchdow}\marg{name} |
| 4279 |
%\end{definition} |
| 4280 |
% |
| 4281 |
%Old style (\styfmt{datetime}): |
| 4282 |
%\begin{verbatim} |
| 4283 |
%\documentclass{article} |
| 4284 |
% |
| 4285 |
%\usepackage{datetime} |
| 4286 |
% |
| 4287 |
%\begin{document} |
| 4288 |
% |
| 4289 |
%\newdate{mydate}{20}{1}{2016} |
| 4290 |
% |
| 4291 |
%Year: \getdateyear{mydate}. |
| 4292 |
%Month: \getdatemonth{mydate}. |
| 4293 |
%Day: \getdateday{mydate}. |
| 4294 |
% |
| 4295 |
%\end{document} |
| 4296 |
%\end{verbatim} |
| 4297 |
%New style (\styfmt{datetime2}): |
| 4298 |
%\begin{verbatim} |
| 4299 |
%\documentclass{article} |
| 4300 |
% |
| 4301 |
%\usepackage{datetime2} |
| 4302 |
% |
| 4303 |
%\begin{document} |
| 4304 |
% |
| 4305 |
%\DTMsavedate{mydate}{2016-01-20} |
| 4306 |
% |
| 4307 |
%Year: \DTMfetchyear{mydate}. |
| 4308 |
%Month: \DTMfetchmonth{mydate}. |
| 4309 |
%Day: \DTMfetchday{mydate}. |
| 4310 |
% |
| 4311 |
%\end{document} |
| 4312 |
%\end{verbatim} |
| 4313 |
% |
| 4314 |
%With \styfmt{datetime2}, you can also save the current time (as in the |
| 4315 |
%time of the document build) with |
| 4316 |
%\begin{definition}[\inpkg{datetime2}] |
| 4317 |
%\ics{DTMsavenow}\marg{name} |
| 4318 |
%\end{definition} |
| 4319 |
%and then access each field of the date, time and zone. |
| 4320 |
% |
| 4321 |
%Old style (\styfmt{datetime}): |
| 4322 |
%\begin{verbatim} |
| 4323 |
%\documentclass{article} |
| 4324 |
% |
| 4325 |
%\usepackage{datetime} |
| 4326 |
% |
| 4327 |
%\begin{document} |
| 4328 |
% |
| 4329 |
%Year: \number\year. |
| 4330 |
%Month: \number\month. |
| 4331 |
%Day: \number\day. |
| 4332 |
%DOW: \computedayofweek{\day}{\month}{\year}\number\dayofweek. |
| 4333 |
% |
| 4334 |
%Hour: \number\currenthour. |
| 4335 |
%Minute: \number\currentminute. |
| 4336 |
%Second: \number\currentsecond. |
| 4337 |
% |
| 4338 |
%\end{document} |
| 4339 |
%\end{verbatim} |
| 4340 |
%New style (\styfmt{datetime2}): |
| 4341 |
%\begin{verbatim} |
| 4342 |
%\documentclass{article} |
| 4343 |
% |
| 4344 |
%\usepackage[calc]{datetime2} |
| 4345 |
% |
| 4346 |
%\begin{document} |
| 4347 |
%\DTMsavenow{now} |
| 4348 |
% |
| 4349 |
%Year: \DTMfetchyear{now}. |
| 4350 |
%Month: \DTMfetchmonth{now}. |
| 4351 |
%Day: \DTMfetchday{now}. |
| 4352 |
%DOW: \DTMfetchdow{now}. |
| 4353 |
% |
| 4354 |
%Hour: \DTMfetchhour{now}. |
| 4355 |
%Minute: \DTMfetchminute{now}. |
| 4356 |
%Second: \DTMfetchsecond{now}. |
| 4357 |
% |
| 4358 |
%Time Zone Hour: \DTMfetchTZhour{now}. |
| 4359 |
%Time Zone Minute: \DTMfetchTZminute{now}. |
| 4360 |
% |
| 4361 |
%\end{document} |
| 4362 |
%\end{verbatim} |
| 4363 |
%(Note that the day of week index is different as \styfmt{datetime2} |
| 4364 |
%uses the same indexing system as \sty{pgfcalendar}.) |
| 4365 |
% |
| 4366 |
%\section{Multilingual Support} |
| 4367 |
% |
| 4368 |
%The \styfmt{datetime} package comes with the following files (in |
| 4369 |
%addition to \texttt{datetime.sty} and |
| 4370 |
%\texttt{datetime-defaults.sty}): |
| 4371 |
% |
| 4372 |
%\begin{center} |
| 4373 |
%\begin{tabular}{llll} |
| 4374 |
%\texttt{dt-american.def} & \texttt{dt-dutch.def} & \texttt{dt-lsorbian.def} & \texttt{dt-slovak.def}\\ |
| 4375 |
%\texttt{dt-australian.def} & \texttt{dt-esperanto.def} & \texttt{dt-magyar.def} & \texttt{dt-slovene.def}\\ |
| 4376 |
%\texttt{dt-austrian.def} & \texttt{dt-estonian.def} & \texttt{dt-naustrian.def} & \texttt{dt-spanish.def}\\ |
| 4377 |
%\texttt{dt-bahasa.def} & \texttt{dt-finnish.def} & \texttt{dt-newzealand.def} & \texttt{dt-swedish.def}\\ |
| 4378 |
%\texttt{dt-basque.def} & \texttt{dt-french.def} & \texttt{dt-ngerman.def} & \texttt{dt-turkish.def}\\ |
| 4379 |
%\texttt{dt-breton.def} & \texttt{dt-galician.def} & \texttt{dt-norsk.def} & \texttt{dt-UKenglish.def}\\ |
| 4380 |
%\texttt{dt-british.def} & \texttt{dt-german.def} & \texttt{dt-polish.def} & \texttt{dt-ukraineb.def}\\ |
| 4381 |
%\texttt{dt-bulgarian.def} & \texttt{dt-greek.def} & \texttt{dt-portuges.def} & \texttt{dt-USenglish.def}\\ |
| 4382 |
%\texttt{dt-canadian.def} & \texttt{dt-hebrew.def} & \texttt{dt-romanian.def} & \texttt{dt-usorbian.def}\\ |
| 4383 |
%\texttt{dt-catalan.def} & \texttt{dt-icelandic.def} & \texttt{dt-russian.def} & \texttt{dt-welsh.def}\\ |
| 4384 |
%\texttt{dt-croatian.def} & \texttt{dt-irish.def} & \texttt{dt-samin.def}\\ |
| 4385 |
%\texttt{dt-czech.def} & \texttt{dt-italian.def} & \texttt{dt-scottish.def}\\ |
| 4386 |
%\texttt{dt-danish.def} & \texttt{dt-latin.def} & \texttt{dt-serbian.def} |
| 4387 |
%\end{tabular} |
| 4388 |
%\end{center} |
| 4389 |
% |
| 4390 |
%These \texttt{dt-\meta{lang}.def} files provide the code to integrate |
| 4391 |
%\styfmt{datetime} with \sty{babel} for each language given by \meta{lang}. |
| 4392 |
%This means that if you have \styfmt{datetime} installed and there's a |
| 4393 |
%\texttt{.def} file that matches the language you are using with |
| 4394 |
%\sty{babel}, then all you need to do is load \sty{babel} before |
| 4395 |
%\styfmt{datetime}. |
| 4396 |
% |
| 4397 |
%With \styfmt{datetime2}, language support is provided in separate |
| 4398 |
%independently-maintained modules. The actual \styfmt{datetime2} package |
| 4399 |
%itself just comes with two files: \texttt{datetime2.sty} and |
| 4400 |
%\texttt{datetime2-calc.sty}. This means that if you only want to use |
| 4401 |
%the basic numeric styles and aren't using \sty{babel} or |
| 4402 |
%\sty{polyglossia}, then that's all you need. (Although you'll |
| 4403 |
%obviously need to install dependent packages, such as \styfmt{pgf} |
| 4404 |
%which provides the \sty{pgfcalendar} package used by |
| 4405 |
%\styfmt{datetime2-calc}. However \sty{fmtcount}, which is required by |
| 4406 |
%\styfmt{datetime}, isn't required by \styfmt{datetime2}.) |
| 4407 |
% |
| 4408 |
%If you want to use \styfmt{datetime2} with language support, then you |
| 4409 |
%only need to install the modules for the required language. For |
| 4410 |
%example, if you only use English, you can just install the |
| 4411 |
%\module{english} module and if you only use French, you can just |
| 4412 |
%install the \module{french} module. |
| 4413 |
% |
| 4414 |
%At the time of writing, the following modules are available on CTAN: |
| 4415 |
%\begin{center} |
| 4416 |
%\begin{tabular}{lll} |
| 4417 |
%\module[bahasai]{datetime2-bahasai} & \module[galician]{datetime2-galician} & \module[russian]{datetime2-russian} \\ |
| 4418 |
%\module[basque]{datetime2-basque} & \module[german]{datetime2-german} & \module[samin]{datetime2-samin} \\ |
| 4419 |
%\module[breton]{datetime2-breton} & \module[greek]{datetime2-greek} & \module[scottish]{datetime2-scottish} \\ |
| 4420 |
%\module[bulgarian]{datetime2-bulgarian} & \module[hebrew]{datetime2-hebrew} & \module[serbian]{datetime2-serbian} \\ |
| 4421 |
%\module[catalan]{datetime2-catalan} & \module[icelandic]{datetime2-icelandic} & \module[slovak]{datetime2-slovak} \\ |
| 4422 |
%\module[croatian]{datetime2-croatian} & \module[irish]{datetime2-irish} & \module[slovene]{datetime2-slovene} \\ |
| 4423 |
%\module[czech]{datetime2-czech} & \module[italian]{datetime2-italian} & \module[spanish]{datetime2-spanish} \\ |
| 4424 |
%\module[danish]{datetime2-danish} & \module[latin]{datetime2-latin} & \module[swedish]{datetime2-swedish} \\ |
| 4425 |
%\module[dutch]{datetime2-dutch} & \module[lsorbian]{datetime2-lsorbian} & \module[turkish]{datetime2-turkish} \\ |
| 4426 |
%\module[english]{datetime2-english} & \module[magyar]{datetime2-magyar} & \module[ukrainian]{datetime2-ukrainian} \\ |
| 4427 |
%\module[esperanto]{datetime2-esperanto} & \module[norsk]{datetime2-norsk} & \module[usorbian]{datetime2-usorbian} \\ |
| 4428 |
%\module[estonian]{datetime2-estonian} & \module[polish]{datetime2-polish} & \module[welsh]{datetime2-welsh} \\ |
| 4429 |
%\module[finnish]{datetime2-finnish} & \module[portuges]{datetime2-portuges} \\ |
| 4430 |
%\module[french]{datetime2-french} & \module[romanian]{datetime2-romanian} |
| 4431 |
%\end{tabular} |
| 4432 |
%\end{center} |
| 4433 |
%Some of these only support the root language but some, such as |
| 4434 |
%\module{english}, provide support for different regions. There is |
| 4435 |
%also a supplementary package \sty{datetime2-en-fulltext} that |
| 4436 |
%replicates \styfmt{datetime}'s \texttt{text} and \texttt{oclock} |
| 4437 |
%styles (and requires \sty{fmtcount}). |
| 4438 |
% |
| 4439 |
%Old style (\styfmt{datetime}): |
| 4440 |
%\begin{verbatim} |
| 4441 |
%\documentclass{article} |
| 4442 |
%\usepackage[T1]{fontenc} |
| 4443 |
%\usepackage[utf8]{inputenc} |
| 4444 |
%\usepackage[french,british]{babel} |
| 4445 |
% |
| 4446 |
%\usepackage{datetime} |
| 4447 |
% |
| 4448 |
%\begin{document} |
| 4449 |
%\selectlanguage{french} |
| 4450 |
%\today |
| 4451 |
% |
| 4452 |
%\selectlanguage{british} |
| 4453 |
%\today |
| 4454 |
% |
| 4455 |
%\end{document} |
| 4456 |
%\end{verbatim} |
| 4457 |
%This produces: |
| 4458 |
%\begin{quote} |
| 4459 |
%21 janvier 2016\par |
| 4460 |
%Thursday 21\textsuperscript{st} January, 2016 |
| 4461 |
%\end{quote} |
| 4462 |
% |
| 4463 |
%New style (\styfmt{datetime2}, \sty{datetime2-english} and \sty{datetime2-french}): |
| 4464 |
%\begin{verbatim} |
| 4465 |
%\documentclass{article} |
| 4466 |
%\usepackage[T1]{fontenc} |
| 4467 |
%\usepackage[utf8]{inputenc} |
| 4468 |
%\usepackage[french,british]{babel} |
| 4469 |
% |
| 4470 |
%\usepackage[showdow,useregional]{datetime2} |
| 4471 |
% |
| 4472 |
%\begin{document} |
| 4473 |
%\selectlanguage{french} |
| 4474 |
%\today |
| 4475 |
% |
| 4476 |
%\selectlanguage{british} |
| 4477 |
%\today |
| 4478 |
% |
| 4479 |
%\end{document} |
| 4480 |
%\end{verbatim} |
| 4481 |
%This produces: |
| 4482 |
%\begin{quote} |
| 4483 |
%21 janvier 2016\par |
| 4484 |
%Thursday 21st January 2016 |
| 4485 |
%\end{quote} |
| 4486 |
%There's a slight difference in the appearance of the British date. |
| 4487 |
%An exact reproduction of the \styfmt{datetime} format can be achieved |
| 4488 |
%by modifying the \style{en-GB} options: |
| 4489 |
%\begin{verbatim} |
| 4490 |
%\documentclass{article} |
| 4491 |
%\usepackage[T1]{fontenc} |
| 4492 |
%\usepackage[utf8]{inputenc} |
| 4493 |
%\usepackage[french,british]{babel} |
| 4494 |
% |
| 4495 |
%\usepackage[showdow,useregional]{datetime2} |
| 4496 |
%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}} |
| 4497 |
% |
| 4498 |
%\begin{document} |
| 4499 |
%\selectlanguage{french} |
| 4500 |
%\today |
| 4501 |
% |
| 4502 |
%\selectlanguage{british} |
| 4503 |
%\today |
| 4504 |
% |
| 4505 |
%\end{document} |
| 4506 |
%\end{verbatim} |
| 4507 |
%Note that neither \styfmt{dt-french.def} from \styfmt{datetime} nor |
| 4508 |
%\sty{datetime2-french} support |
| 4509 |
%the show day of week option. |
| 4510 |
% |
| 4511 |
%The \styfmt{datetime} package provides: |
| 4512 |
%\begin{definition}[\inpkg{datetime}] |
| 4513 |
%\oldcs{setdefaultdate}\marg{date declaration} |
| 4514 |
%\end{definition} |
| 4515 |
%to always use the date style given by \meta{date declaration} |
| 4516 |
%instead of letting \sty{babel} switch the date format every time the |
| 4517 |
%language changes. |
| 4518 |
% |
| 4519 |
%In \styfmt{datetime2}, the default is the reverse: the style won't |
| 4520 |
%change when the language changes unless the languages (or regions) |
| 4521 |
%have been listed in the \styfmt{datetime2} package options. If the |
| 4522 |
%regional styles have been enabled, allowing \sty{babel} to change |
| 4523 |
%the date style whenever the language changes, then you can switch |
| 4524 |
%this behaviour off by setting the \pkgopt{useregional} option to |
| 4525 |
%\pkgoptfmt{false}. |
| 4526 |
% |
| 4527 |
%Old style (\styfmt{datetime}): |
| 4528 |
%\begin{verbatim} |
| 4529 |
%\documentclass{article} |
| 4530 |
%\usepackage[T1]{fontenc} |
| 4531 |
%\usepackage[utf8]{inputenc} |
| 4532 |
%\usepackage[french,british]{babel} |
| 4533 |
% |
| 4534 |
%\usepackage{datetime} |
| 4535 |
% |
| 4536 |
%\yyyymmdddate |
| 4537 |
% |
| 4538 |
%\begin{document} |
| 4539 |
%\selectlanguage{french} |
| 4540 |
%\today |
| 4541 |
% |
| 4542 |
%\selectlanguage{british} |
| 4543 |
%\today |
| 4544 |
% |
| 4545 |
%\end{document} |
| 4546 |
%\end{verbatim} |
| 4547 |
%This produces: |
| 4548 |
%\begin{quote} |
| 4549 |
%21 janvier 2016\par |
| 4550 |
%Thursday 21\textsuperscript{st} January, 2016 |
| 4551 |
%\end{quote} |
| 4552 |
%(The numeric date style has been overridden.) |
| 4553 |
%\begin{verbatim} |
| 4554 |
%\documentclass{article} |
| 4555 |
%\usepackage[T1]{fontenc} |
| 4556 |
%\usepackage[utf8]{inputenc} |
| 4557 |
%\usepackage[french,british]{babel} |
| 4558 |
% |
| 4559 |
%\usepackage{datetime2} |
| 4560 |
% |
| 4561 |
%\DTMsetdatestyle{iso} |
| 4562 |
% |
| 4563 |
%\begin{document} |
| 4564 |
%\selectlanguage{french} |
| 4565 |
%\today |
| 4566 |
% |
| 4567 |
%\selectlanguage{british} |
| 4568 |
%\today |
| 4569 |
% |
| 4570 |
%\end{document} |
| 4571 |
%\end{verbatim} |
| 4572 |
%This produces: |
| 4573 |
%\begin{quote} |
| 4574 |
%2016-01-21\par |
| 4575 |
%2016-01-21 |
| 4576 |
%\end{quote} |
| 4577 |
%(The ISO date style overrides the language setting.) |
| 4578 |
% |
| 4579 |
%Compare this to: |
| 4580 |
%\begin{verbatim} |
| 4581 |
%\documentclass{article} |
| 4582 |
%\usepackage[T1]{fontenc} |
| 4583 |
%\usepackage[utf8]{inputenc} |
| 4584 |
%\usepackage[french,british]{babel} |
| 4585 |
% |
| 4586 |
%\usepackage[en-GB,fr-FR]{datetime2} |
| 4587 |
% |
| 4588 |
%\DTMsetdatestyle{iso} |
| 4589 |
% |
| 4590 |
%\begin{document} |
| 4591 |
%\selectlanguage{french} |
| 4592 |
%\today |
| 4593 |
% |
| 4594 |
%\selectlanguage{british} |
| 4595 |
%\today |
| 4596 |
% |
| 4597 |
%\end{document} |
| 4598 |
%\end{verbatim} |
| 4599 |
%This produces: |
| 4600 |
%\begin{quote} |
| 4601 |
%21 janvier 2016\par |
| 4602 |
%21st January 2016 |
| 4603 |
%\end{quote} |
| 4604 |
% |
| 4605 |
%Examples that explicitly suppress the language-sensitive dates |
| 4606 |
%follow. First with \styfmt{datetime}: |
| 4607 |
%\begin{verbatim} |
| 4608 |
%\documentclass{article} |
| 4609 |
%\usepackage[T1]{fontenc} |
| 4610 |
%\usepackage[utf8]{inputenc} |
| 4611 |
%\usepackage[french,british]{babel} |
| 4612 |
% |
| 4613 |
%\usepackage{datetime} |
| 4614 |
% |
| 4615 |
%\setdefaultdate{\yyyymmdddate} |
| 4616 |
% |
| 4617 |
%\begin{document} |
| 4618 |
%\selectlanguage{french} |
| 4619 |
%\today |
| 4620 |
% |
| 4621 |
%\selectlanguage{british} |
| 4622 |
%\today |
| 4623 |
% |
| 4624 |
%\end{document} |
| 4625 |
%\end{verbatim} |
| 4626 |
%This produces: |
| 4627 |
%\begin{quote} |
| 4628 |
%2016/01/21\par |
| 4629 |
%2016/01/21 |
| 4630 |
%\end{quote} |
| 4631 |
% |
| 4632 |
%Now with \styfmt{datetime2}: |
| 4633 |
%\begin{verbatim} |
| 4634 |
%\documentclass{article} |
| 4635 |
%\usepackage[T1]{fontenc} |
| 4636 |
%\usepackage[utf8]{inputenc} |
| 4637 |
%\usepackage[french,british]{babel} |
| 4638 |
% |
| 4639 |
%\usepackage[en-GB,fr-FR,useregional=false]{datetime2} |
| 4640 |
% |
| 4641 |
%\DTMsetdatestyle{iso} |
| 4642 |
% |
| 4643 |
%\begin{document} |
| 4644 |
%\selectlanguage{french} |
| 4645 |
%\today |
| 4646 |
% |
| 4647 |
%\selectlanguage{british} |
| 4648 |
%\today |
| 4649 |
% |
| 4650 |
%\end{document} |
| 4651 |
%\end{verbatim} |
| 4652 |
%This produces: |
| 4653 |
%\begin{quote} |
| 4654 |
%2016-01-21\par |
| 4655 |
%2016-01-21 |
| 4656 |
%\end{quote} |
| 4657 |
% |
| 4658 |
%\section{Predefined Date Formats} |
| 4659 |
% |
| 4660 |
%The \styfmt{datetime} date styles were set with declarations such as |
| 4661 |
%\cs{longdate} (or package options that used the associated |
| 4662 |
%declaration, such as \pkgoptfmt{long}). |
| 4663 |
%With \styfmt{datetime2}, date styles are set using |
| 4664 |
%\begin{definition}[\inpkg{datetime2}] |
| 4665 |
%\ics{DTMsetdatestyle}\marg{style name} |
| 4666 |
%\end{definition} |
| 4667 |
%(which just changes the date style without changing the time style) or |
| 4668 |
%\begin{definition}[\inpkg{datetime2}] |
| 4669 |
%\ics{DTMsetstyle}\marg{style name} |
| 4670 |
%\end{definition} |
| 4671 |
%which sets the full date-time style. |
| 4672 |
% |
| 4673 |
%This section lists the \styfmt{datetime} declarations and how the |
| 4674 |
%same style can be set through \styfmt{datetime2}. |
| 4675 |
% |
| 4676 |
%\begin{definition}[\inpkg{datetime}] |
| 4677 |
%\oldcs{yyyymmdddate} |
| 4678 |
%\end{definition} |
| 4679 |
%By default this style produces a date in the form 2016/01/20. (The |
| 4680 |
%separator is governed by \oldcs{dateseparator}.) This is the default |
| 4681 |
%style for \styfmt{datetime2} with the exception of the separator, |
| 4682 |
%which defaults to a hyphen. To reproduce the \styfmt{datetime} |
| 4683 |
%format, you can set the date style to \style{default} (if it has |
| 4684 |
%been previous changed from the default) and change the separator |
| 4685 |
%with the \pkgopt{datesep} option: |
| 4686 |
%\begin{verbatim} |
| 4687 |
%\DTMsetdatestyle{default} |
| 4688 |
%\DTMsetup{datesep={/}} |
| 4689 |
%\end{verbatim} |
| 4690 |
% |
| 4691 |
%\begin{definition}[\inpkg{datetime}] |
| 4692 |
%\oldcs{longdate} |
| 4693 |
%\end{definition} |
| 4694 |
%This is the default date format for \styfmt{datetime} and this style produces |
| 4695 |
%the date in the form: Wednesday 8\textsuperscript{th} March, 2000. |
| 4696 |
%This is actually a regional style for some of the English dialects, |
| 4697 |
%so with \styfmt{datetime2} this additionally needs the |
| 4698 |
%\module{english} module installed. To exactly replicate this date |
| 4699 |
%format, including the day of week name, the superscript ordinal |
| 4700 |
%suffix and the comma after the month name, you need the |
| 4701 |
%\pkgopt{showdow} and \pkgopt{en-GB} package options and |
| 4702 |
%the \csopt{DTMlangsetup}{ord} and \csopt{DTMlangsetup}{monthyearsep} |
| 4703 |
%options for the \style{en-GB} style. For example: |
| 4704 |
%\begin{verbatim} |
| 4705 |
%\usepackage[showdow,en-GB]{datetime2} |
| 4706 |
%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}} |
| 4707 |
%\end{verbatim} |
| 4708 |
%Another possibility is: |
| 4709 |
%\begin{verbatim} |
| 4710 |
%\usepackage[british]{babel} |
| 4711 |
%\usepackage[showdow]{datetime2} |
| 4712 |
%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space}} |
| 4713 |
%\DTMsetdatestyle{en-GB} |
| 4714 |
%\end{verbatim} |
| 4715 |
%There are other regional styles in the \module{english} module that |
| 4716 |
%produce the same format, such as \style{en-GG}. |
| 4717 |
% |
| 4718 |
%\begin{definition}[\inpkg{datetime}] |
| 4719 |
%\oldcs{shortdate} |
| 4720 |
%\end{definition} |
| 4721 |
%This is similar to \cs{longdate} but uses abbreviated names to |
| 4722 |
%produce a date in the form: Wed 8\textsuperscript{th} Mar, 2000. |
| 4723 |
%With \styfmt{datetime2}, this is like the above but additionally |
| 4724 |
%needs the \csopt{DTMlangsetup}{abbr} option for the \style{en-GB} |
| 4725 |
%style: |
| 4726 |
%\begin{verbatim} |
| 4727 |
%\usepackage[showdow,en-GB]{datetime2} |
| 4728 |
%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space},abbr} |
| 4729 |
%\end{verbatim} |
| 4730 |
%or |
| 4731 |
%\begin{verbatim} |
| 4732 |
%\usepackage[british]{babel} |
| 4733 |
%\usepackage[showdow]{datetime2} |
| 4734 |
%\DTMlangsetup[en-GB]{ord=raise,monthyearsep={,\space},abbr} |
| 4735 |
%\DTMsetdatestyle{en-GB} |
| 4736 |
%\end{verbatim} |
| 4737 |
% |
| 4738 |
%\begin{definition}[\inpkg{datetime}] |
| 4739 |
%\oldcs{ddmmyyyydate} |
| 4740 |
%\end{definition} |
| 4741 |
%This produces a date in the form 08/03/2000. This can be reproduced |
| 4742 |
%with just \styfmt{datetime2} using the \style{ddmmyyyy} style with |
| 4743 |
%the date separator set to a slash: |
| 4744 |
%\begin{verbatim} |
| 4745 |
%\DTMsetdatestyle{ddmmyyyy} |
| 4746 |
%\DTMsetup{datesep=/} |
| 4747 |
%\end{verbatim} |
| 4748 |
% |
| 4749 |
%\begin{definition}[\inpkg{datetime}] |
| 4750 |
%\oldcs{dmyyyydate} |
| 4751 |
%\end{definition} |
| 4752 |
%This produces a date in the form 8/3/2000. This can be reproduced |
| 4753 |
%with just \styfmt{datetime2} using the \style{dmyyyy} style with |
| 4754 |
%the date separator set to a slash: |
| 4755 |
%\begin{verbatim} |
| 4756 |
%\DTMsetdatestyle{dmyyyy} |
| 4757 |
%\DTMsetup{datesep=/} |
| 4758 |
%\end{verbatim} |
| 4759 |
%This format is also the style of some of the regional numeric date |
| 4760 |
%styles. For example, with the \module{english} module: |
| 4761 |
%\begin{verbatim} |
| 4762 |
%\usepackage[british]{babel} |
| 4763 |
%\usepackage{datetime2} |
| 4764 |
%\DTMsetdatestyle{en-GB-numeric} |
| 4765 |
%\end{verbatim} |
| 4766 |
% |
| 4767 |
%\begin{definition}[\inpkg{datetime}] |
| 4768 |
%\oldcs{ddmmyydate} |
| 4769 |
%\end{definition} |
| 4770 |
%This produces a date in the form 08/03/00. This can be reproduced |
| 4771 |
%with just \styfmt{datetime2} using the \style{ddmmyy} style with |
| 4772 |
%the date separator set to a slash: |
| 4773 |
%\begin{verbatim} |
| 4774 |
%\DTMsetdatestyle{ddmmyy} |
| 4775 |
%\DTMsetup{datesep=/} |
| 4776 |
%\end{verbatim} |
| 4777 |
% |
| 4778 |
%\begin{definition}[\inpkg{datetime}] |
| 4779 |
%\oldcs{dmyydate} |
| 4780 |
%\end{definition} |
| 4781 |
%This produces a date in the form 8/3/00. This can be reproduced |
| 4782 |
%with just \styfmt{datetime2} using the \style{dmyy} style with |
| 4783 |
%the date separator set to a slash: |
| 4784 |
%\begin{verbatim} |
| 4785 |
%\DTMsetdatestyle{dmyy} |
| 4786 |
%\DTMsetup{datesep=/} |
| 4787 |
%\end{verbatim} |
| 4788 |
% |
| 4789 |
%\begin{definition}[\inpkg{datetime}] |
| 4790 |
%\oldcs{textdate} |
| 4791 |
%\end{definition} |
| 4792 |
%This style is designed to produce a full text British date in the |
| 4793 |
%form: Wednesday the Eighth of March, Two Thousand. The |
| 4794 |
%\sty{datetime2-en-fulltext} package is required to reproduce this |
| 4795 |
%style: |
| 4796 |
%\begin{verbatim} |
| 4797 |
%\usepackage[showdow]{datetime2-en-fulltext} |
| 4798 |
%\DTMsetdatestyle{en-FullText} |
| 4799 |
%\end{verbatim} |
| 4800 |
%Note that with both \styfmt{datetime} and |
| 4801 |
%\styfmt{datetime2-en-fulltext} this style should not be used if the |
| 4802 |
%current language isn't English. |
| 4803 |
% |
| 4804 |
%\begin{definition}[\inpkg{datetime}] |
| 4805 |
%\oldcs{usdate} |
| 4806 |
%\end{definition} |
| 4807 |
%This style is designed to produce \TeX's default US date format in |
| 4808 |
%the form March 8, 2000. This style can be reproduced with |
| 4809 |
%\styfmt{datetime2} and the \module{english} module: |
| 4810 |
%\begin{verbatim} |
| 4811 |
%\usepackage[en-US]{datetime2} |
| 4812 |
%\end{verbatim} |
| 4813 |
%or |
| 4814 |
%\begin{verbatim} |
| 4815 |
%\usepackage[USenglish]{babel} |
| 4816 |
%\usepackage[useregional]{datetime2} |
| 4817 |
%\DTMsetdatestyle{en-US} |
| 4818 |
%\end{verbatim} |
| 4819 |
% |
| 4820 |
%\begin{definition}[\inpkg{datetime}] |
| 4821 |
%\oldcs{mmddyyyydate} |
| 4822 |
%\end{definition} |
| 4823 |
%This style produces a date in a middle-endian format in the form: |
| 4824 |
%03/08/2000. This style can be reproduced with \styfmt{datetime2} using |
| 4825 |
%the \style{mmddyyyy} style with the date separator set to a slash: |
| 4826 |
%\begin{verbatim} |
| 4827 |
%\DTMsetup{datesep=/} |
| 4828 |
%\DTMsetdatestyle{mmddyyyy} |
| 4829 |
%\end{verbatim} |
| 4830 |
% |
| 4831 |
%\begin{definition}[\inpkg{datetime}] |
| 4832 |
%\oldcs{mdyyyydate} |
| 4833 |
%\end{definition} |
| 4834 |
%This style produces a date in a middle-endian format in the form: |
| 4835 |
%3/8/2000. This style can be reproduced with \styfmt{datetime2} using |
| 4836 |
%the \style{mdyyyy} style with the date separator set to a slash: |
| 4837 |
%\begin{verbatim} |
| 4838 |
%\DTMsetup{datesep=/} |
| 4839 |
%\DTMsetdatestyle{mdyyyy} |
| 4840 |
%\end{verbatim} |
| 4841 |
%This format is also the style of some of the regional numeric date |
| 4842 |
%styles. For example, with the \module{english} module: |
| 4843 |
%\begin{verbatim} |
| 4844 |
%\usepackage[USenglish]{babel} |
| 4845 |
%\usepackage{datetime2} |
| 4846 |
%\DTMsetdatestyle{en-US-numeric} |
| 4847 |
%\end{verbatim} |
| 4848 |
% |
| 4849 |
%\begin{definition}[\inpkg{datetime}] |
| 4850 |
%\oldcs{mmddyydate} |
| 4851 |
%\end{definition} |
| 4852 |
%This style produces a date in a middle-endian format in the form: |
| 4853 |
%03/08/00. This style can be reproduced with \styfmt{datetime2} using |
| 4854 |
%the \style{mmddyy} style with the date separator set to a slash: |
| 4855 |
%\begin{verbatim} |
| 4856 |
%\DTMsetup{datesep=/} |
| 4857 |
%\DTMsetdatestyle{mmddyy} |
| 4858 |
%\end{verbatim} |
| 4859 |
% |
| 4860 |
%\begin{definition}[\inpkg{datetime}] |
| 4861 |
%\oldcs{mdyydate} |
| 4862 |
%\end{definition} |
| 4863 |
%This style produces a date in a middle-endian format in the form: |
| 4864 |
%3/8/00. This style can be reproduced with \styfmt{datetime2} using |
| 4865 |
%the \style{mdyy} style with the date separator set to a slash: |
| 4866 |
%\begin{verbatim} |
| 4867 |
%\DTMsetup{datesep=/} |
| 4868 |
%\DTMsetdatestyle{mdyy} |
| 4869 |
%\end{verbatim} |
| 4870 |
% |
| 4871 |
%\section{Predefined Time Formats} |
| 4872 |
% |
| 4873 |
%The time formats are set in \styfmt{datetime} using |
| 4874 |
%\begin{definition}[\inpkg{datetime}] |
| 4875 |
%\oldcs{settimeformat}\marg{style-name} |
| 4876 |
%\end{definition} |
| 4877 |
%With \styfmt{datetime2}, the time styles are set using |
| 4878 |
%\begin{definition}[\inpkg{datetime2}] |
| 4879 |
%\ics{DTMsettimestyle}\marg{style-name} |
| 4880 |
%\end{definition} |
| 4881 |
%(which just changes the time style without changing the date style) or |
| 4882 |
%\begin{definition}[\inpkg{datetime2}] |
| 4883 |
%\ics{DTMsetstyle}\marg{style name} |
| 4884 |
%\end{definition} |
| 4885 |
%which sets the full date-time style. |
| 4886 |
% |
| 4887 |
%The \styfmt{datetime} package provides the following time styles: |
| 4888 |
%\begin{description} |
| 4889 |
%\item[xxivtime] This style produces the time in twenty-four hour |
| 4890 |
%format in the form 09:28. (The default time style for |
| 4891 |
%\styfmt{datetime}.) Note that this style has no seconds. The format |
| 4892 |
%can be reproduced in \styfmt{datetime2} with the \style{default} |
| 4893 |
%style and the \pkgopt{showseconds} option set to \pkgoptfmt{false}: |
| 4894 |
%\begin{verbatim} |
| 4895 |
%\DTMsettimestyle{default} |
| 4896 |
%\DTMsetup{showseconds=false} |
| 4897 |
%\end{verbatim} |
| 4898 |
% |
| 4899 |
%\item[hhmmsstime] This is like the previous style but includes the |
| 4900 |
%seconds. This is the default time style for \styfmt{datetime2}: |
| 4901 |
%\begin{verbatim} |
| 4902 |
%\DTMsettimestyle{default} |
| 4903 |
%\end{verbatim} |
| 4904 |
% |
| 4905 |
%\item[ampmtime] This style produces the time in twelve hour format |
| 4906 |
%in the form 9:28am or 7:54pm. This style is available in some of the |
| 4907 |
%regional modules for \styfmt{datetime2}. For example, using the |
| 4908 |
%\style{en-GB} style in the \module{english} module: |
| 4909 |
%\begin{verbatim} |
| 4910 |
%\usepackage[en-GB]{datetime2} |
| 4911 |
%\end{verbatim} |
| 4912 |
%or |
| 4913 |
%\begin{verbatim} |
| 4914 |
%\usepackage[british]{babel} |
| 4915 |
%\usepackage{datetime2} |
| 4916 |
%\DTMsettimestyle{en-GB} |
| 4917 |
%\end{verbatim} |
| 4918 |
% |
| 4919 |
%\item[oclock] This style is designed for a full text English time |
| 4920 |
%format in the form: Twenty-Eight minutes past Ten in the afternoon. |
| 4921 |
%This style can be reproduced with the \style{en-FullText} style |
| 4922 |
%provided by the \sty{datetime2-en-fulltext} package: |
| 4923 |
%\begin{verbatim} |
| 4924 |
%\usepackage{datetime2-en-fulltext} |
| 4925 |
%\DTMsettimestyle{en-FullText} |
| 4926 |
%\end{verbatim} |
| 4927 |
% |
| 4928 |
%\end{description} |
| 4929 |
% |
| 4930 |
%\section{Defining a New Date Format} |
| 4931 |
% |
| 4932 |
%The \styfmt{datetime} package provides: |
| 4933 |
%\begin{definition}[\inpkg{datetime}] |
| 4934 |
%\oldcs{newdateformat}\marg{name}\marg{format} |
| 4935 |
%\end{definition} |
| 4936 |
%to define a new date style. Within \meta{format}, the placeholder |
| 4937 |
%commands \oldcs{THEDAY}, \oldcs{THEMONTH} and \oldcs{THEYEAR} are |
| 4938 |
%used to represent the relevant day, month and year values. There are |
| 4939 |
%also counter placeholders \texttt{DAY}, \texttt{MONTH} and |
| 4940 |
%\texttt{YEAR}, which may be used instead. |
| 4941 |
% |
| 4942 |
%A necessary consequence of allowing placeholder commands in |
| 4943 |
%\meta{format} means that these commands must be set as appropriate |
| 4944 |
%before the date can be formatted. This means that the formatted date |
| 4945 |
%can't be expanded and the date commands must be made robust to |
| 4946 |
%protect them in moving arguments. This is an inherent problem with the |
| 4947 |
%\styfmt{datetime} package that can't be fixed without breaking |
| 4948 |
%backwards compatibility and is one of the main reasons for |
| 4949 |
%introducing the replacement \styfmt{datetime2} package. |
| 4950 |
% |
| 4951 |
%The \styfmt{datetime2} package provides a better way of providing |
| 4952 |
%date styles, which are defined using: |
| 4953 |
%\begin{definition}[\inpkg{datetime2}] |
| 4954 |
%\ics{DTMnewdatestyle}\marg{name}\marg{definition} |
| 4955 |
%\end{definition} |
| 4956 |
%Instead of using placeholder commands, the date styles |
| 4957 |
%simply redefine the date formatting macros within \meta{definition}. |
| 4958 |
%There are two principle date formatting commands that the date style |
| 4959 |
%must define although styles may redefine additional helper commands |
| 4960 |
%if necessary. |
| 4961 |
% |
| 4962 |
%The two main date formatting commands are: |
| 4963 |
%\begin{definition}[\inpkg{datetime2}] |
| 4964 |
%\ics{DTMdisplaydate}\marg{YYYY}\marg{MM}\marg{DD}\marg{dow} |
| 4965 |
%\end{definition} |
| 4966 |
%for use where no case-changing is required and |
| 4967 |
%\begin{definition}[\inpkg{datetime2}] |
| 4968 |
%\ics{DTMDisplaydate}\marg{YYYY}\marg{MM}\marg{DD}\marg{dow} |
| 4969 |
%\end{definition} |
| 4970 |
%for use where the date must begin with an upper case letter, for |
| 4971 |
%example if the date occurs at the start of a sentence. For styles |
| 4972 |
%where the case-change is irrelevant (for example, numeric styles or |
| 4973 |
%styles that always start with an upper case letter), the |
| 4974 |
%\cs{DTMDisplaydate} command may simply be set to |
| 4975 |
%\cs{DTMdisplaydate}. |
| 4976 |
% |
| 4977 |
%The \styfmt{datetime} manual provides some examples of new date |
| 4978 |
%styles. The first is simply a numeric little-endian style with a hyphen |
| 4979 |
%separating each number: |
| 4980 |
%\begin{verbatim} |
| 4981 |
%\newdateformat{mydate}{\THEDAY-\THEMONTH-\THEYEAR} |
| 4982 |
%\end{verbatim} |
| 4983 |
% |
| 4984 |
%To convert this into a \styfmt{datetime2} format, the new style |
| 4985 |
%simply needs to redefine \cs{DTMdisplaydate} so that it has the |
| 4986 |
%following definition: |
| 4987 |
%\begin{verbatim} |
| 4988 |
%\renewcommand{\DTMdisplaydate}[4]{#3-#2-#1} |
| 4989 |
%\end{verbatim} |
| 4990 |
%Note that this command must always have four arguments, even if one |
| 4991 |
%or more of them are ignored. So here \cs{THEYEAR} is just the first |
| 4992 |
%argument \verb|#1|, \cs{THEMONTH} is the second argument \verb|#2| |
| 4993 |
%and \cs{THEDAY} is the third argument \verb|#3|. One other thing to note is |
| 4994 |
%that the arguments may be supplied with a leading zero. If you want |
| 4995 |
%to trim this off, you can use \TeX's \ics{number} primitive. For |
| 4996 |
%example: |
| 4997 |
%\begin{verbatim} |
| 4998 |
%\renewcommand{\DTMdisplaydate}[4]{\number#3-\number#2-\number#1 } |
| 4999 |
%\end{verbatim} |
| 5000 |
%This is the better method to allow for, say, registers used in any |
| 5001 |
%of the arguments. |
| 5002 |
% |
| 5003 |
%Therefore this new date style can be defined for \styfmt{datetime2} |
| 5004 |
%as follows: |
| 5005 |
%\begin{verbatim} |
| 5006 |
%\DTMnewdatestyle{mydate}{% |
| 5007 |
% \renewcommand{\DTMdisplaydate}[4]{\number##3-\number##2-\number##1 }% |
| 5008 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5009 |
%} |
| 5010 |
%\end{verbatim} |
| 5011 |
%(Note the need to double the \verb|#| in the parameters, as is usual |
| 5012 |
%when redefining a command within another command in this manner.) |
| 5013 |
% |
| 5014 |
%For example, using \styfmt{datetime}: |
| 5015 |
%\begin{verbatim} |
| 5016 |
%\documentclass{article} |
| 5017 |
%\usepackage{datetime} |
| 5018 |
% |
| 5019 |
%\newdateformat{mydate}{\THEDAY-\THEMONTH-\THEYEAR} |
| 5020 |
%\mydate |
| 5021 |
% |
| 5022 |
%\begin{document} |
| 5023 |
%\today. |
| 5024 |
%\end{document} |
| 5025 |
%\end{verbatim} |
| 5026 |
%Now using \styfmt{datetime2}: |
| 5027 |
%\begin{verbatim} |
| 5028 |
%\documentclass{article} |
| 5029 |
%\usepackage{datetime2} |
| 5030 |
% |
| 5031 |
%\DTMnewdatestyle{mydate}{% |
| 5032 |
% \renewcommand{\DTMdisplaydate}[4]{\number##3-\number##2-\number##1 }% |
| 5033 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5034 |
%} |
| 5035 |
%\DTMsetdatestyle{mydate} |
| 5036 |
% |
| 5037 |
%\begin{document} |
| 5038 |
%\today. |
| 5039 |
%\end{document} |
| 5040 |
%\end{verbatim} |
| 5041 |
% |
| 5042 |
%Another example provided in the \styfmt{datetime} manual ensures two |
| 5043 |
%digits for the month and day of month: |
| 5044 |
%\begin{verbatim} |
| 5045 |
%\newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} |
| 5046 |
%\end{verbatim} |
| 5047 |
% |
| 5048 |
%This is a minor modification to the previous example. The two digit |
| 5049 |
%number format can be obtained through \styfmt{datetime2}'s |
| 5050 |
%\ics{DTMtwodigits} command: |
| 5051 |
%\begin{verbatim} |
| 5052 |
%\DTMnewdatestyle{dashdate}{% |
| 5053 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5054 |
% \DTMtwodigits{##3}-\DTMtwodigits{##2}-\number##1 }% |
| 5055 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5056 |
%} |
| 5057 |
%\end{verbatim} |
| 5058 |
% |
| 5059 |
%A complete example follows for \styfmt{datetime}: |
| 5060 |
%\begin{verbatim} |
| 5061 |
%\documentclass{article} |
| 5062 |
%\usepackage{datetime} |
| 5063 |
% |
| 5064 |
%\newdateformat{dashdate}{\twodigit{\THEDAY}-\twodigit{\THEMONTH}-\THEYEAR} |
| 5065 |
%\dashdate |
| 5066 |
% |
| 5067 |
%\begin{document} |
| 5068 |
%\today. |
| 5069 |
%\end{document} |
| 5070 |
%\end{verbatim} |
| 5071 |
%And for \styfmt{datetime2}: |
| 5072 |
%\begin{verbatim} |
| 5073 |
%\documentclass{article} |
| 5074 |
%\usepackage{datetime2} |
| 5075 |
% |
| 5076 |
%\DTMnewdatestyle{dashdate}{% |
| 5077 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5078 |
% \DTMtwodigits{##3}-\DTMtwodigits{##2}-\number##1 }% |
| 5079 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5080 |
%} |
| 5081 |
%\DTMsetdatestyle{dashdate} |
| 5082 |
% |
| 5083 |
%\begin{document} |
| 5084 |
%\today. |
| 5085 |
%\end{document} |
| 5086 |
%\end{verbatim} |
| 5087 |
% |
| 5088 |
%You may have noticed that there's no equivalent of |
| 5089 |
%\styfmt{datetime}'s counter placeholders, but there's no real need |
| 5090 |
%for them and any attempt at implementing them would return to the |
| 5091 |
%original problem of preventing an expandable date format. \LaTeX\ |
| 5092 |
%counters all internally use \TeX\ count registers and counter |
| 5093 |
%formatting commands have to access those registers to determine the |
| 5094 |
%counter value. |
| 5095 |
% |
| 5096 |
%To illustrate this, the \styfmt{datetime} manual provides the |
| 5097 |
%example: |
| 5098 |
%\begin{verbatim} |
| 5099 |
%\newdateformat{usvardate}{\monthname[\THEMONTH] \ordinal{DAY}, \THEYEAR} |
| 5100 |
%\end{verbatim} |
| 5101 |
%This uses the \texttt{DAY} counter placeholder since \cs{ordinal} |
| 5102 |
%(provided by the \sty{fmtcount} package) requires a counter name as |
| 5103 |
%the argument. However, \cs{ordinal} internally uses \cs{ordinalnum} |
| 5104 |
%with the internal count register as the argument, so the format |
| 5105 |
%could just as easily be defined as: |
| 5106 |
%\begin{verbatim} |
| 5107 |
%\newdateformat{usvardate}{\monthname[\THEMONTH] \ordinalnum{\THEDAY}, \THEYEAR} |
| 5108 |
%\end{verbatim} |
| 5109 |
% |
| 5110 |
%So how can this style be reproduced with \styfmt{datetime2}? A |
| 5111 |
%na\"ive approach is: |
| 5112 |
%\begin{verbatim} |
| 5113 |
%\DTMnewdatestyle{usvardate}{% |
| 5114 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5115 |
% \DTMmonthname{##2} \ordinalnum{##2}, \number##1 }% |
| 5116 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5117 |
%} |
| 5118 |
%\end{verbatim} |
| 5119 |
%This requires both \styfmt{datetime2-calc} (for \ics{DTMmonthname}) |
| 5120 |
%and \sty{fmtcount} (for \cs{ordinalnum}). |
| 5121 |
% |
| 5122 |
%A complete example that uses it: |
| 5123 |
%\begin{verbatim} |
| 5124 |
%\documentclass{article} |
| 5125 |
% |
| 5126 |
%\usepackage{fmtcount} |
| 5127 |
%\usepackage[calc]{datetime2} |
| 5128 |
% |
| 5129 |
%\DTMnewdatestyle{usvardate}{% |
| 5130 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5131 |
% \DTMmonthname{##2} \ordinalnum{##2}, \number##1 }% |
| 5132 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5133 |
%} |
| 5134 |
%\DTMsetdatestyle{usvardate} |
| 5135 |
% |
| 5136 |
%\begin{document} |
| 5137 |
%\today. |
| 5138 |
%\end{document} |
| 5139 |
%\end{verbatim} |
| 5140 |
%This produces a warning from \cs{DTMmonthname} because |
| 5141 |
%\cs{DTMenglishmonthname} hasn't been defined, so it uses |
| 5142 |
%\cs{pgfcalendarmonthname} instead. The document displays the text: |
| 5143 |
%\begin{quote} |
| 5144 |
%January 1\textsuperscript{st}, 2016. |
| 5145 |
%\end{quote} |
| 5146 |
%This seems to produce the correct output, but let's see what happens |
| 5147 |
%if we make a minor modification to the example: |
| 5148 |
%\begin{verbatim} |
| 5149 |
%\documentclass{article} |
| 5150 |
% |
| 5151 |
%\usepackage[english,french]{babel} |
| 5152 |
%\usepackage{fmtcount} |
| 5153 |
%\usepackage[calc]{datetime2} |
| 5154 |
% |
| 5155 |
%\DTMnewdatestyle{usvardate}{% |
| 5156 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5157 |
% \DTMmonthname{##2} \ordinalnum{##2}, \number##1 }% |
| 5158 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5159 |
%} |
| 5160 |
%\DTMsetdatestyle{usvardate} |
| 5161 |
% |
| 5162 |
%\begin{document} |
| 5163 |
%\today. |
| 5164 |
%\end{document} |
| 5165 |
%\end{verbatim} |
| 5166 |
%This now produces: |
| 5167 |
%\begin{quote} |
| 5168 |
%janvier 1\textsuperscript{er}, 2016. |
| 5169 |
%\end{quote} |
| 5170 |
%which doesn't match the rationale of the style being a variation of |
| 5171 |
%the standard US date style nor does it match the little-endian |
| 5172 |
%syntax of French dates. |
| 5173 |
% |
| 5174 |
%Now let's make another minor change to the example: |
| 5175 |
%\begin{verbatim} |
| 5176 |
%\documentclass{article} |
| 5177 |
% |
| 5178 |
%\usepackage{fmtcount} |
| 5179 |
%\usepackage[calc]{datetime2} |
| 5180 |
% |
| 5181 |
%\DTMnewdatestyle{usvardate}{% |
| 5182 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5183 |
% \DTMmonthname{##2} \ordinalnum{##2}, \number##1 }% |
| 5184 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5185 |
%} |
| 5186 |
%\DTMsetdatestyle{usvardate} |
| 5187 |
% |
| 5188 |
%\begin{document} |
| 5189 |
%\section{\today: an example} |
| 5190 |
% |
| 5191 |
%\today. |
| 5192 |
%\end{document} |
| 5193 |
%\end{verbatim} |
| 5194 |
%This document can't compile properly and causes the error: |
| 5195 |
%\begin{verbatim} |
| 5196 |
%! Argument of \@sect has an extra }. |
| 5197 |
%<inserted text> |
| 5198 |
% \par |
| 5199 |
%\end{verbatim} |
| 5200 |
%This is because the style definition has made \cs{today} fragile |
| 5201 |
%because it uses an unprotected fragile command. This can be fixed by |
| 5202 |
%protecting \cs{ordinalnum} in the style definition. |
| 5203 |
% |
| 5204 |
%Let's make another modification: |
| 5205 |
%\begin{verbatim} |
| 5206 |
%\documentclass{article} |
| 5207 |
% |
| 5208 |
%\usepackage{fmtcount} |
| 5209 |
%\usepackage[calc]{datetime2} |
| 5210 |
% |
| 5211 |
%\DTMnewdatestyle{usvardate}{% |
| 5212 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5213 |
% \DTMmonthname{##2} \protect\ordinalnum{##2}, \number##1 }% |
| 5214 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5215 |
%} |
| 5216 |
%\DTMsetdatestyle{usvardate} |
| 5217 |
% |
| 5218 |
%\pagestyle{headings} |
| 5219 |
% |
| 5220 |
%\begin{document} |
| 5221 |
%\section{\today: an example} |
| 5222 |
% |
| 5223 |
%\today. |
| 5224 |
%\end{document} |
| 5225 |
%\end{verbatim} |
| 5226 |
%This compiles without error now that \cs{ordinalnum} has been |
| 5227 |
%protected, but the page header appears as: |
| 5228 |
%\begin{quote} |
| 5229 |
%\emph{1\quad January 1\textsuperscript{st}, 2016: AN EXAMPLE}\hfill 1 |
| 5230 |
%\end{quote} |
| 5231 |
%The date hasn't been rendered in upper case so the header doesn't |
| 5232 |
%look right. |
| 5233 |
% |
| 5234 |
%If \sty{hyperref} is added, another problem becomes evident: |
| 5235 |
%\begin{verbatim} |
| 5236 |
%\documentclass{article} |
| 5237 |
% |
| 5238 |
%\usepackage{fmtcount} |
| 5239 |
%\usepackage[calc]{datetime2} |
| 5240 |
%\usepackage[colorlinks]{hyperref} |
| 5241 |
% |
| 5242 |
%\DTMnewdatestyle{usvardate}{% |
| 5243 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5244 |
% \DTMmonthname{##2} \protect\ordinalnum{##2}, \number##1 }% |
| 5245 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5246 |
%} |
| 5247 |
%\DTMsetdatestyle{usvardate} |
| 5248 |
% |
| 5249 |
%\pagestyle{headings} |
| 5250 |
% |
| 5251 |
%\begin{document} |
| 5252 |
%\section{\today: an example} |
| 5253 |
% |
| 5254 |
%\today. |
| 5255 |
%\end{document} |
| 5256 |
%\end{verbatim} |
| 5257 |
%The PDF bookmarks for this document show the section title as: |
| 5258 |
%\begin{quote} |
| 5259 |
%01 , 2016: an example |
| 5260 |
%\end{quote} |
| 5261 |
% |
| 5262 |
%Both the header and the bookmark problem are caused by |
| 5263 |
%non-expandable elements of the date style. \emph{The same problems |
| 5264 |
%occur with \styfmt{datetime}}, and is one of the main reasons for |
| 5265 |
%developing a replacement package since these problems can't be fixed |
| 5266 |
%by \styfmt{datetime}. In fact, the \styfmt{datetime} version of this |
| 5267 |
%example looks even worse in the bookmarks: |
| 5268 |
%\begin{verbatim} |
| 5269 |
%\documentclass{article} |
| 5270 |
% |
| 5271 |
%\usepackage{datetime} |
| 5272 |
%\usepackage[colorlinks]{hyperref} |
| 5273 |
% |
| 5274 |
%\newdateformat{usvardate}{\monthname[\THEMONTH] \ordinalnum{\THEDAY}, \THEYEAR} |
| 5275 |
%\usvardate |
| 5276 |
% |
| 5277 |
%\pagestyle{headings} |
| 5278 |
% |
| 5279 |
%\begin{document} |
| 5280 |
%\section{\today: an example} |
| 5281 |
% |
| 5282 |
%\today. |
| 5283 |
%\end{document} |
| 5284 |
%\end{verbatim} |
| 5285 |
%The bookmark now looks like: |
| 5286 |
%\begin{quote} |
| 5287 |
%===[0], 0: an example |
| 5288 |
%\end{quote} |
| 5289 |
%(The page header is the same as for the \styfmt{datetime2} example |
| 5290 |
%above, with the date not matching the rest of the heading case.) |
| 5291 |
% |
| 5292 |
%A more appropriate way of defining this style with |
| 5293 |
%\styfmt{datetime2} package is to use the \emph{expandable} commands |
| 5294 |
%provided by the \module{english} module: |
| 5295 |
%\begin{verbatim} |
| 5296 |
%\documentclass{article} |
| 5297 |
% |
| 5298 |
%\usepackage[calc,en-GB]{datetime2} |
| 5299 |
%\usepackage[colorlinks]{hyperref} |
| 5300 |
% |
| 5301 |
%\DTMnewdatestyle{usvardate}{% |
| 5302 |
% \renewcommand*{\DTMenglishfmtordsuffix}{\DTMenGBfmtordsuffix}% |
| 5303 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5304 |
% \DTMenglishmonthname{##2} \DTMenglishordinal{##2}, \number##1 }% |
| 5305 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5306 |
%} |
| 5307 |
%\DTMsetdatestyle{usvardate} |
| 5308 |
% |
| 5309 |
%\pagestyle{headings} |
| 5310 |
% |
| 5311 |
%\begin{document} |
| 5312 |
%\section{\today: an example} |
| 5313 |
% |
| 5314 |
%\today. |
| 5315 |
%\end{document} |
| 5316 |
%\end{verbatim} |
| 5317 |
%This fixes both the header and the bookmarks. |
| 5318 |
% |
| 5319 |
%If you don't want to rely on remembering to use the \pkgopt{en-GB} |
| 5320 |
%option to load the \style{en-GB} style (which defines |
| 5321 |
%\cs{DTMenGBfmtordsuffix}) you can use this alternative: |
| 5322 |
%\begin{verbatim} |
| 5323 |
%\documentclass{article} |
| 5324 |
% |
| 5325 |
%\usepackage[calc]{datetime2} |
| 5326 |
%\usepackage[colorlinks]{hyperref} |
| 5327 |
% |
| 5328 |
%\DTMusemodule{english}{en-GB} |
| 5329 |
% |
| 5330 |
%\DTMnewdatestyle{usvardate}{% |
| 5331 |
% \renewcommand*{\DTMenglishfmtordsuffix}{\DTMenGBfmtordsuffix}% |
| 5332 |
% \renewcommand{\DTMdisplaydate}[4]{% |
| 5333 |
% \DTMenglishmonthname{##2} \DTMenglishordinal{##2}, \number##1 }% |
| 5334 |
% \renewcommand{\DTMDisplaydate}{\DTMdisplaydate}% |
| 5335 |
%} |
| 5336 |
%\DTMsetdatestyle{usvardate} |
| 5337 |
% |
| 5338 |
%\pagestyle{headings} |
| 5339 |
% |
| 5340 |
%\begin{document} |
| 5341 |
%\section{\today: an example} |
| 5342 |
% |
| 5343 |
%\today. |
| 5344 |
%\end{document} |
| 5345 |
%\end{verbatim} |
| 5346 |
%This is a useful method to employ if you want to define the new |
| 5347 |
%style in a package without forcing the package options used to load |
| 5348 |
%\styfmt{datetime2}. |
| 5349 |
% |
| 5350 |
%Note that this new style definition is unaffected by language |
| 5351 |
%changes, so the other problem with the \styfmt{datetime} version of |
| 5352 |
%this style is also eliminated. |
| 5353 |
% |
| 5354 |
%\section{Defining a New Time Format} |
| 5355 |
% |
| 5356 |
%The \styfmt{datetime} package provides: |
| 5357 |
%\begin{definition}[\inpkg{datetime}] |
| 5358 |
%\oldcs{newtimeformat}\marg{name}\marg{format} |
| 5359 |
%\end{definition} |
| 5360 |
%to define a new time style. Within \meta{format}, the placeholder |
| 5361 |
%commands \oldcs{THEHOUR}, \oldcs{THEMINUTE}, \oldcs{THESECOND}, |
| 5362 |
%\oldcs{THEHOURXII}, \oldcs{THETOHOUR}, \oldcs{THETOMINUTE} may be |
| 5363 |
%used. There are also corresponding placeholder counters: |
| 5364 |
%\texttt{HOUR}, \texttt{MINUTE}, \texttt{SECOND}, \texttt{HOURXII}, |
| 5365 |
%\texttt{TOHOUR} and \texttt{TOMINUTE}. |
| 5366 |
% |
| 5367 |
%This placeholder style of format for the time has the same problems |
| 5368 |
%as that for the date styles described in the previous section. |
| 5369 |
% |
| 5370 |
%Time styles are defined in \styfmt{datetime2} using: |
| 5371 |
%\begin{definition}[\inpkg{datetime2}] |
| 5372 |
%\ics{DTMnewtimestyle}\marg{name}\marg{definition} |
| 5373 |
%\end{definition} |
| 5374 |
% |
| 5375 |
%As with the date styles, the \styfmt{datetime2} package provides |
| 5376 |
%styles that redefine a formatting macro. In this case, the time |
| 5377 |
%(without the zone) is simply formatted with |
| 5378 |
%\begin{definition}[\inpkg{datetime2}] |
| 5379 |
%\ics{DTMdisplaytime}\marg{hh}\marg{mm}\marg{ss} |
| 5380 |
%\end{definition} |
| 5381 |
%so the \meta{definition} part of \cs{DTMnewtimestyle} needs to |
| 5382 |
%redefine this command. |
| 5383 |
% |
| 5384 |
%The placeholder commands \cs{THEHOUR}, \cs{THEMINUTE} |
| 5385 |
%and \cs{THESECOND} from \styfmt{datetime} can now be represented by |
| 5386 |
%the first, second and third arguments of \cs{DTMdisplaytime}. The |
| 5387 |
%other placeholders are more complicated as they need to be |
| 5388 |
%calculated which may prevent the style from being an expandable |
| 5389 |
%format. |
| 5390 |
% |
| 5391 |
%The \styfmt{datetime} manual provides a simple example of defining a |
| 5392 |
%new time style: |
| 5393 |
%\begin{verbatim} |
| 5394 |
%\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} |
| 5395 |
%\end{verbatim} |
| 5396 |
%This style is then set using: |
| 5397 |
%\begin{verbatim} |
| 5398 |
%\settimeformat{dottime} |
| 5399 |
%\end{verbatim} |
| 5400 |
% |
| 5401 |
%An equivalent time style can be defined with \styfmt{datetime2}: |
| 5402 |
%\begin{verbatim} |
| 5403 |
%\DTMnewtimestyle{dottime}{% |
| 5404 |
% \renewcommand*\DTMdisplaytime[3]{\DTMtwodigits{##1}.\DTMtwodigits{##2}}} |
| 5405 |
%\end{verbatim} |
| 5406 |
% |
| 5407 |
%A complete example using \styfmt{datetime}: |
| 5408 |
%\begin{verbatim} |
| 5409 |
%\documentclass{article} |
| 5410 |
% |
| 5411 |
%\usepackage{datetime} |
| 5412 |
% |
| 5413 |
%\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} |
| 5414 |
%\settimeformat{dottime} |
| 5415 |
% |
| 5416 |
%\begin{document} |
| 5417 |
%\currenttime. |
| 5418 |
%\end{document} |
| 5419 |
%\end{verbatim} |
| 5420 |
%A complete example using \styfmt{datetime2}: |
| 5421 |
%\begin{verbatim} |
| 5422 |
%\documentclass{article} |
| 5423 |
% |
| 5424 |
%\usepackage{datetime2} |
| 5425 |
% |
| 5426 |
%\DTMnewtimestyle{dottime}{% |
| 5427 |
% \renewcommand*\DTMdisplaytime[3]{\DTMtwodigits{##1}.\DTMtwodigits{##2}}} |
| 5428 |
%\DTMsettimestyle{dottime} |
| 5429 |
% |
| 5430 |
%\begin{document} |
| 5431 |
%\DTMcurrenttime. |
| 5432 |
%\end{document} |
| 5433 |
%\end{verbatim} |
| 5434 |
% |
| 5435 |
%Note that the \styfmt{datetime} example has a problem with PDF |
| 5436 |
%bookmarks if the time is used in a sectioning command, for the same |
| 5437 |
%reasons as those discussed above in the previous section. This can |
| 5438 |
%be seen with a slight modification to the example: |
| 5439 |
%\begin{verbatim} |
| 5440 |
%\documentclass{article} |
| 5441 |
% |
| 5442 |
%\usepackage{datetime} |
| 5443 |
%\usepackage[colorlinks]{hyperref} |
| 5444 |
% |
| 5445 |
%\newtimeformat{dottime}{\twodigit{\THEHOUR}.\twodigit{\THEMINUTE}} |
| 5446 |
%\settimeformat{dottime} |
| 5447 |
% |
| 5448 |
%\begin{document} |
| 5449 |
%\section{\currenttime: an example} |
| 5450 |
% |
| 5451 |
%\currenttime. |
| 5452 |
%\end{document} |
| 5453 |
%\end{verbatim} |
| 5454 |
%The bookmark appears as: |
| 5455 |
%\begin{quote} |
| 5456 |
%====by 1=by 12by 12 by -=by -60by -1=0.00: an example |
| 5457 |
%\end{quote} |
| 5458 |
% |
| 5459 |
%The \styfmt{datetime2} example works fine with a similar |
| 5460 |
%modification: |
| 5461 |
%\begin{verbatim} |
| 5462 |
%\documentclass{article} |
| 5463 |
% |
| 5464 |
%\usepackage{datetime2} |
| 5465 |
%\usepackage[colorlinks]{hyperref} |
| 5466 |
% |
| 5467 |
%\DTMnewtimestyle{dottime}{% |
| 5468 |
% \renewcommand*\DTMdisplaytime[3]{\DTMtwodigits{##1}.\DTMtwodigits{##2}}} |
| 5469 |
%\DTMsettimestyle{dottime} |
| 5470 |
% |
| 5471 |
%\begin{document} |
| 5472 |
%\section{\DTMcurrenttime: an example} |
| 5473 |
% |
| 5474 |
%\DTMcurrenttime. |
| 5475 |
%\end{document} |
| 5476 |
%\end{verbatim} |
| 5477 |
% |
| 5478 |
%There is one slight drawback with this example that's irrelevant to the choice |
| 5479 |
%of package. The bookmark (and table of contents, if present) will always show |
| 5480 |
%the time from the previous \LaTeX\ run. This is only a problem when using the |
| 5481 |
%current time, especially if seconds are required or the document build takes |
| 5482 |
%longer than a minute. If the example has a specific time instead of one that |
| 5483 |
%changes for every \LaTeX\ run, then this issue is eliminated. |
| 5484 |
% |
| 5485 |
%If you want a time style that requires the other placeholder |
| 5486 |
%commands provided by \styfmt{datetime}, then it's more complicated |
| 5487 |
%to convert to \styfmt{datetime2} as the values that |
| 5488 |
%\styfmt{datetime} conveniently computes and stores in the |
| 5489 |
%placeholder commands \oldcs{THEHOURXII}, \oldcs{THETOHOUR} and |
| 5490 |
%\oldcs{THETOMINUTE} now need to be calculated, preferably in an |
| 5491 |
%expandable way. |
| 5492 |
% |
| 5493 |
%An expandable twelve hour time format can be illustrated with the |
| 5494 |
%\style{englishampm} style provided by the \module{english} |
| 5495 |
%module:\footnote{Bug fix from \styfmt{datetime2-english} v1.03 |
| 5496 |
%included} |
| 5497 |
%\begin{verbatim} |
| 5498 |
%\DTMnewtimestyle |
| 5499 |
% {englishampm}% label |
| 5500 |
% {% |
| 5501 |
% \renewcommand*\DTMdisplaytime[3]{% |
| 5502 |
% \ifnum##2=0 |
| 5503 |
% \ifnum##1=12 |
| 5504 |
% \DTMtexorpdfstring |
| 5505 |
% {\DTMenglishampmfmt{\DTMenglishnoon}}% |
| 5506 |
% {\DTMenglishnoon}% |
| 5507 |
% \else |
| 5508 |
% \ifnum##1=0 |
| 5509 |
% \DTMtexorpdfstring |
| 5510 |
% {\DTMenglishampmfmt{\DTMenglishmidnight}}% |
| 5511 |
% {\DTMenglishmidnight}% |
| 5512 |
% \else |
| 5513 |
% \ifnum##1=24 |
| 5514 |
% \DTMtexorpdfstring |
| 5515 |
% {\DTMenglishampmfmt{\DTMenglishmidnight}}% |
| 5516 |
% {\DTMenglishmidnight}% |
| 5517 |
% \else |
| 5518 |
% \ifnum##1<12 |
| 5519 |
% \number##1 |
| 5520 |
% \DTMtexorpdfstring |
| 5521 |
% {\DTMenglishampmfmt{\DTMenglisham}}% |
| 5522 |
% {\DTMenglisham}% |
| 5523 |
% \else |
| 5524 |
% \number\numexpr##1-12\relax |
| 5525 |
% \DTMtexorpdfstring |
| 5526 |
% {\DTMenglishampmfmt{\DTMenglishpm}}% |
| 5527 |
% {\DTMenglishpm}% |
| 5528 |
% \fi |
| 5529 |
% \fi |
| 5530 |
% \fi |
| 5531 |
% \fi |
| 5532 |
% \fi |
| 5533 |
% \else |
| 5534 |
% \ifnum##1<13 |
| 5535 |
% \ifnum##1=0 |
| 5536 |
% 12% |
| 5537 |
% \else |
| 5538 |
% \number##1 |
| 5539 |
% \fi |
| 5540 |
% \DTMenglishtimesep\DTMtwodigits{##2}% |
| 5541 |
% \ifnum##1=12 |
| 5542 |
% \DTMtexorpdfstring |
| 5543 |
% {\DTMenglishampmfmt{\DTMenglishpm}}% |
| 5544 |
% {\DTMenglishpm}% |
| 5545 |
% \else |
| 5546 |
% \DTMtexorpdfstring |
| 5547 |
% {\DTMenglishampmfmt{\DTMenglisham}}% |
| 5548 |
% {\DTMenglisham}% |
| 5549 |
% \fi |
| 5550 |
% \else |
| 5551 |
% \number\numexpr##1-12\relax |
| 5552 |
% \DTMenglishtimesep\DTMtwodigits{##2}% |
| 5553 |
% \ifnum##1=24 |
| 5554 |
% \DTMtexorpdfstring |
| 5555 |
% {\DTMenglishampmfmt{\DTMenglisham}}% |
| 5556 |
% {\DTMenglisham}% |
| 5557 |
% \else |
| 5558 |
% \DTMtexorpdfstring |
| 5559 |
% {\DTMenglishampmfmt{\DTMenglishpm}}% |
| 5560 |
% {\DTMenglishpm}% |
| 5561 |
% \fi |
| 5562 |
% \fi |
| 5563 |
% \fi |
| 5564 |
% }% |
| 5565 |
% }% |
| 5566 |
%\end{verbatim} |
| 5567 |
% |
| 5568 |
%This is certainly more complicated than the |
| 5569 |
%\texttt{ampmtime} format provided by \styfmt{datetime}, which is |
| 5570 |
%defined as: |
| 5571 |
%\begin{verbatim} |
| 5572 |
%\newtimeformat{ampmtime}% |
| 5573 |
%{% |
| 5574 |
% \ifthenelse{\value{HOUR}=0}{12}{\THEHOURXII}% |
| 5575 |
% \timeseparator |
| 5576 |
% \twodigit{\THEMINUTE}% |
| 5577 |
% \ifthenelse{\value{HOUR}<12}{\amname}% |
| 5578 |
% {% |
| 5579 |
% \ifthenelse{\value{HOUR}=12}{ \noon}{\pmname}% |
| 5580 |
% }% |
| 5581 |
%} |
| 5582 |
%\end{verbatim} |
| 5583 |
%However the \styfmt{datetime2} version produces better results, |
| 5584 |
%especially where expansion is required (for example, in bookmarks or |
| 5585 |
%writing a time stamp to an external file). The \styfmt{datetime2} |
| 5586 |
%version also performs extra checks for midnight where the |
| 5587 |
%\styfmt{datetime} version produces ambiguous text. So the |
| 5588 |
%\texttt{ampmtime} definition is simple but buggy. |
| 5589 |
% |
| 5590 |
%The basic algorithm for \style{englishampm} is: |
| 5591 |
%\begin{description} |
| 5592 |
%\item If the minute value is 0 (\verb|\ifnum##2=0|): |
| 5593 |
% \begin{description} |
| 5594 |
% \item If the hour value is 12 (\verb|\ifnum##1=12|): |
| 5595 |
% \begin{description} |
| 5596 |
% \item Print \qt{noon} |
| 5597 |
% \end{description} |
| 5598 |
% |
| 5599 |
% \item Otherwise (not noon but on the hour) |
| 5600 |
% |
| 5601 |
% \begin{description} |
| 5602 |
% \item If the hour value is 0 (\verb|\ifnum##1=0|) |
| 5603 |
% \begin{description} |
| 5604 |
% \item Print \qt{midnight} |
| 5605 |
% \end{description} |
| 5606 |
% |
| 5607 |
% \item Otherwise (not 12:00 or 00:00 but on the hour) |
| 5608 |
% |
| 5609 |
% \begin{description} |
| 5610 |
% \item If the hour value is 24 (\verb|\ifnum##1=24|) |
| 5611 |
% \begin{description} |
| 5612 |
% \item Print \qt{midnight} |
| 5613 |
% \end{description} |
| 5614 |
% |
| 5615 |
% \item Otherwise (not 12:00 or 00:00 or 24:00 but on the hour) |
| 5616 |
% \begin{description} |
| 5617 |
% \item If the hour value is less than 12 (\verb|\ifnum##1<12|) |
| 5618 |
% \begin{description} |
| 5619 |
% \item Print the hour value (\verb|\number##1|) |
| 5620 |
% \item Print \qt{am} |
| 5621 |
% \end{description} |
| 5622 |
% \item Otherwise |
| 5623 |
% \begin{description} |
| 5624 |
% \item Print the hour value less 12 |
| 5625 |
% (\verb|\number\numexpr##1-12|) |
| 5626 |
% \item Print \qt{pm} |
| 5627 |
% \end{description} |
| 5628 |
% \end{description} |
| 5629 |
% \end{description} |
| 5630 |
% \end{description} |
| 5631 |
% \end{description} |
| 5632 |
% |
| 5633 |
% \item Otherwise (minute value isn't zero) |
| 5634 |
% |
| 5635 |
% \begin{description} |
| 5636 |
% \item If the hour value is less than 13 (\verb|\ifnum##1<13|) |
| 5637 |
% |
| 5638 |
% \begin{description} |
| 5639 |
% \item If the hour value is 0 (\verb|\ifnum##1=0|) |
| 5640 |
% \begin{description} |
| 5641 |
% \item Print \qt{12} |
| 5642 |
% \end{description} |
| 5643 |
% \item Otherwise |
| 5644 |
% \begin{description} |
| 5645 |
% \item Print the hour (\verb|\number##1|) |
| 5646 |
% \end{description} |
| 5647 |
% |
| 5648 |
% \item Print the separator between the hour and minute |
| 5649 |
% (\verb|\DTMenglishtimesep|) |
| 5650 |
% |
| 5651 |
% \item Print minute value (\verb|\DTMtwodigits{##2}|) |
| 5652 |
% |
| 5653 |
% \item If the hour value is 12 (\verb|\ifnum##=12|) |
| 5654 |
% \begin{description} |
| 5655 |
% \item Print \qt{pm} |
| 5656 |
% \end{description} |
| 5657 |
% \item Otherwise (hour value less than 12) |
| 5658 |
% \begin{description} |
| 5659 |
% \item Print \qt{am} |
| 5660 |
% \end{description} |
| 5661 |
% \end{description} |
| 5662 |
% |
| 5663 |
% \item Otherwise (hour value $\ge13$) |
| 5664 |
% |
| 5665 |
% \begin{description} |
| 5666 |
% \item Print the hour value less 12 |
| 5667 |
% (\verb|\number\numexpr##1-12|) |
| 5668 |
% \item Print the time separator |
| 5669 |
% |
| 5670 |
% \item Print minute value (\verb|\DTMtwodigits{##2}|) |
| 5671 |
% |
| 5672 |
% \item If the hour value is 24 (\verb|\ifnum##1=24|) |
| 5673 |
% \begin{description} |
| 5674 |
% \item Print \qt{am} |
| 5675 |
% \end{description} |
| 5676 |
% \item Otherwise |
| 5677 |
% \begin{description} |
| 5678 |
% \item Print \qt{pm} |
| 5679 |
% \end{description} |
| 5680 |
% \end{description} |
| 5681 |
% \end{description} |
| 5682 |
%\end{description} |
| 5683 |
%Most of the complication in this style isn't trying to determine the |
| 5684 |
%equivalent value of \cs{THEHOURXII} (\verb|\number\numexpr##1-12| |
| 5685 |
%if \verb|##1>12|) but in improving the algorithm to catch special |
| 5686 |
%cases that the \styfmt{datetime} style misses. Additionally, |
| 5687 |
%\ics{DTMtexorpdfstring} is used to prevent any font formatting |
| 5688 |
%commands from being added to the bookmarks. |
| 5689 |
% |
| 5690 |
%The \sty{datetime2-en-fulltext} package provides an example of a |
| 5691 |
%time style that requires calculating the minutes to the hour and the |
| 5692 |
%next hour. Note that fragile commands are protected in this style. |
| 5693 |
%Since it contains fragile commands that require protection, it can't |
| 5694 |
%be used in an expandable context. |
| 5695 |
% |
| 5696 |
%Remember that most of the styles provided by \styfmt{datetime2} and its |
| 5697 |
%associated modules and dependent packages are configurable, so if |
| 5698 |
%your preferred style is only marginally different to a predefined |
| 5699 |
%style, you may be able to tweak that style to fit your requirements. |
| 5700 |
%For example, the dot time format can be obtained using the |
| 5701 |
%\style{default} style with the seconds suppressed and the separator |
| 5702 |
%change to a dot: |
| 5703 |
%\begin{verbatim} |
| 5704 |
%\DTMsettimestyle{default} |
| 5705 |
%\DTMsetup{timesep={.},showseconds=false} |
| 5706 |
%\end{verbatim} |
| 5707 |
% |
| 5708 |
%The twelve hour format provided by the \module{english} module can also be |
| 5709 |
%adjusted. This style honours the package-wide time-related option |
| 5710 |
%\pkgopt{hourminsep} and the \qt{am}, \qt{pm}, \qt{midnight} or |
| 5711 |
%\qt{noon} part is formatted according to: |
| 5712 |
%\begin{definition}[\inpkg{datetime2-english}] |
| 5713 |
%\ics{DTMenglishampmfmt}\marg{text} |
| 5714 |
%\end{definition} |
| 5715 |
% |
| 5716 |
%So a twelve hour format that uses a dot instead of a colon and has |
| 5717 |
%the text part in small caps can be obtained using: |
| 5718 |
%\begin{verbatim} |
| 5719 |
%\usepackage[english,hourminsep={.}]{datetime2} |
| 5720 |
%\renewcommand*{\DTMenglishampmfmt}[1]{\textsc{#1}} |
| 5721 |
%\end{verbatim} |
| 5722 |
% |
| 5723 |
%\StopEventually{\PrintChanges\PrintIndex} |
| 5724 |
% |
| 5725 |
% |
| 5726 |
%\chapter{The Code} |
| 5727 |
%\iffalse |
| 5728 |
% \begin{macrocode} |
| 5729 |
%<*datetime2.sty> |
| 5730 |
% \end{macrocode} |
| 5731 |
%\fi |
| 5732 |
%\section{datetime2.sty code} |
| 5733 |
%\changes{1.0}{2015-03-24}{Initial release} |
| 5734 |
% \begin{macrocode} |
| 5735 |
\NeedsTeXFormat{LaTeX2e} |
| 5736 |
\ProvidesPackage{datetime2}[2021/03/21 v1.5.7 (NLCT) date and time formats] |
| 5737 |
% \end{macrocode} |
| 5738 |
% Use \sty{tracklang} to find out what languages have been loaded. |
| 5739 |
% \begin{macrocode} |
| 5740 |
\RequirePackage{tracklang} |
| 5741 |
% \end{macrocode} |
| 5742 |
% Also require \sty{etoolbox}. |
| 5743 |
% \begin{macrocode} |
| 5744 |
\RequirePackage{etoolbox} |
| 5745 |
% \end{macrocode} |
| 5746 |
% Need \sty{xkeyval} for \meta{key}=\meta{value} interface. |
| 5747 |
% \begin{macrocode} |
| 5748 |
\RequirePackage{xkeyval}[2006/11/18] |
| 5749 |
% \end{macrocode} |
| 5750 |
% |
| 5751 |
%\begin{macro}{\dtm@pdfcreationdate} |
| 5752 |
%\changes{1.5}{2016-06-04}{new} |
| 5753 |
%The \sty{luatex85} package defines \ics{pdfcreationdate} in terms of |
| 5754 |
%\cs{pdffeedback}, but the parsing commands need a command whose |
| 5755 |
%replacement text is directly in the PDF date time format, so define a command |
| 5756 |
%with the full replacement text that can be used instead. This will allow |
| 5757 |
%for any possible future changes of \cs{pdfcreationdate} that |
| 5758 |
%require deeper levels of expansion. |
| 5759 |
% \begin{macrocode} |
| 5760 |
\ifdef\pdfcreationdate |
| 5761 |
{% |
| 5762 |
\edef\dtm@pdfcreationdate{\pdfcreationdate}% |
| 5763 |
}% |
| 5764 |
{% |
| 5765 |
% \end{macrocode} |
| 5766 |
%\changes{1.5.1}{2016-06-05}{added check for \cs{pdffeedback}} |
| 5767 |
% Check if newer version of Lua\TeX\ is being used but |
| 5768 |
% \sty{luatex85} hasn't been loaded. |
| 5769 |
% \begin{macrocode} |
| 5770 |
\ifdef\pdffeedback |
| 5771 |
{% |
| 5772 |
\edef\dtm@pdfcreationdate{\pdffeedback creationdate}% |
| 5773 |
}% |
| 5774 |
{% |
| 5775 |
% \end{macrocode} |
| 5776 |
%Neither \cs{pdfcreationdate} nor \cs{pdffeedback} are defined. |
| 5777 |
%(The \TeX\ format is most probably \XeLaTeX.) |
| 5778 |
%If the \sty{locale} package has been loaded, \cs{LocaleNowStamp} |
| 5779 |
%should be available. |
| 5780 |
% \begin{macrocode} |
| 5781 |
\ifdef\LocaleNowStamp |
| 5782 |
{% |
| 5783 |
\ifx\LocaleNowStamp\empty |
| 5784 |
% \end{macrocode} |
| 5785 |
%OS query failed, so there's no point trying directly with |
| 5786 |
%\sty{texosquery}. |
| 5787 |
% \begin{macrocode} |
| 5788 |
\else |
| 5789 |
\let\dtm@pdfcreationdate\LocaleNowStamp |
| 5790 |
\fi |
| 5791 |
}% |
| 5792 |
% \end{macrocode} |
| 5793 |
% If \sty{texosquery} |
| 5794 |
%has been loaded, then the current date and time can be fetched |
| 5795 |
%using \ics{TeXOSQueryNow} provided the shell escape has been |
| 5796 |
%enabled. (It might not be, so don't automatically load |
| 5797 |
%\sty{texosquery}.) Since it might have been loaded using \cs{input} |
| 5798 |
%rather than \cs{usepackage}, just test if \cs{TeXOSQueryNow} has |
| 5799 |
%been defined. |
| 5800 |
%\changes{1.5.2}{2016-07-12}{added check for \cs{TeXOSQueryNow}} |
| 5801 |
% \begin{macrocode} |
| 5802 |
{% |
| 5803 |
\ifdef\TeXOSQueryNow |
| 5804 |
{% |
| 5805 |
\TeXOSQueryNow{\dtm@pdfcreationdate}% |
| 5806 |
\ifdefempty\dtm@pdfcreationdate |
| 5807 |
{% |
| 5808 |
% \end{macrocode} |
| 5809 |
%Failed (maybe shell escape has been disabled). |
| 5810 |
% \begin{macrocode} |
| 5811 |
\undef\dtm@pdfcreationdate |
| 5812 |
}% |
| 5813 |
{}% |
| 5814 |
}% |
| 5815 |
{}% |
| 5816 |
}% |
| 5817 |
}% |
| 5818 |
} |
| 5819 |
% \end{macrocode} |
| 5820 |
%\end{macro} |
| 5821 |
% |
| 5822 |
%\begin{macro}{\dtm@yearmonthsep} |
| 5823 |
% Separator between year and month for numeric dates. |
| 5824 |
% \begin{macrocode} |
| 5825 |
\newcommand*{\dtm@yearmonthsep}{-} |
| 5826 |
% \end{macrocode} |
| 5827 |
%\end{macro} |
| 5828 |
% |
| 5829 |
%\begin{macro}{\dtm@monthdaysep} |
| 5830 |
% Separator between month and day for numeric dates. |
| 5831 |
% \begin{macrocode} |
| 5832 |
\newcommand*{\dtm@monthdaysep}{-} |
| 5833 |
% \end{macrocode} |
| 5834 |
%\end{macro} |
| 5835 |
% |
| 5836 |
%\begin{macro}{\dtm@dayyearsep} |
| 5837 |
% Separator between day and year for numeric middle-endian dates. |
| 5838 |
% \begin{macrocode} |
| 5839 |
\newcommand*{\dtm@dayyearsep}{-} |
| 5840 |
% \end{macrocode} |
| 5841 |
%\end{macro} |
| 5842 |
% |
| 5843 |
%\begin{macro}{\dtm@hourminsep} |
| 5844 |
% Separator between the hour and minute for times. |
| 5845 |
% \begin{macrocode} |
| 5846 |
\newcommand*{\dtm@hourminsep}{:} |
| 5847 |
% \end{macrocode} |
| 5848 |
%\end{macro} |
| 5849 |
% |
| 5850 |
%\begin{macro}{\dtm@minsecsep} |
| 5851 |
% Separator between the minute and second for times. |
| 5852 |
% \begin{macrocode} |
| 5853 |
\newcommand*{\dtm@minsecsep}{:} |
| 5854 |
% \end{macrocode} |
| 5855 |
%\end{macro} |
| 5856 |
% |
| 5857 |
%\begin{macro}{\dtm@timezonesep} |
| 5858 |
% Separator between the date and time. |
| 5859 |
% \begin{macrocode} |
| 5860 |
\newcommand*{\dtm@datetimesep}{\space}% |
| 5861 |
% \end{macrocode} |
| 5862 |
%\end{macro} |
| 5863 |
% |
| 5864 |
%\begin{macro}{\dtm@timezonesep} |
| 5865 |
% Separator between the time and time zone. |
| 5866 |
% \begin{macrocode} |
| 5867 |
\newcommand*{\dtm@timezonesep}{} |
| 5868 |
% \end{macrocode} |
| 5869 |
%\end{macro} |
| 5870 |
% |
| 5871 |
%\begin{option}{datesep} |
| 5872 |
% Set year/month and month/day separator. |
| 5873 |
% \begin{macrocode} |
| 5874 |
\define@key{datetime2.sty}{datesep}{% |
| 5875 |
\renewcommand*{\dtm@yearmonthsep}{#1}% |
| 5876 |
\renewcommand*{\dtm@monthdaysep}{#1}% |
| 5877 |
\renewcommand*{\dtm@dayyearsep}{#1}% |
| 5878 |
} |
| 5879 |
% \end{macrocode} |
| 5880 |
%\end{option} |
| 5881 |
% |
| 5882 |
%\begin{option}{yearmonthsep} |
| 5883 |
% Set year/month separator. |
| 5884 |
% \begin{macrocode} |
| 5885 |
\define@key{datetime2.sty}{yearmonthsep}{% |
| 5886 |
\renewcommand*{\dtm@yearmonthsep}{#1}% |
| 5887 |
} |
| 5888 |
% \end{macrocode} |
| 5889 |
%\end{option} |
| 5890 |
% |
| 5891 |
%\begin{option}{monthdaysep} |
| 5892 |
% Set month/day separator. |
| 5893 |
% \begin{macrocode} |
| 5894 |
\define@key{datetime2.sty}{monthdaysep}{% |
| 5895 |
\renewcommand*{\dtm@monthdaysep}{#1}% |
| 5896 |
} |
| 5897 |
% \end{macrocode} |
| 5898 |
%\end{option} |
| 5899 |
% |
| 5900 |
%\begin{option}{dayyearsep} |
| 5901 |
% Set day/year separator for middle-endian dates. |
| 5902 |
% \begin{macrocode} |
| 5903 |
\define@key{datetime2.sty}{dayyearsep}{% |
| 5904 |
\renewcommand*{\dtm@dayyearsep}{#1}% |
| 5905 |
} |
| 5906 |
% \end{macrocode} |
| 5907 |
%\end{option} |
| 5908 |
% |
| 5909 |
%\begin{option}{timesep} |
| 5910 |
% Set hour/minute and minute/second separator. |
| 5911 |
% \begin{macrocode} |
| 5912 |
\define@key{datetime2.sty}{timesep}{% |
| 5913 |
\renewcommand*{\dtm@hourminsep}{#1}% |
| 5914 |
\renewcommand*{\dtm@minsecsep}{#1}% |
| 5915 |
} |
| 5916 |
% \end{macrocode} |
| 5917 |
%\end{option} |
| 5918 |
% |
| 5919 |
%\begin{option}{hourminsep} |
| 5920 |
% Set hour/minute separator. |
| 5921 |
% \begin{macrocode} |
| 5922 |
\define@key{datetime2.sty}{hourminsep}{% |
| 5923 |
\renewcommand*{\dtm@hourminsep}{#1}% |
| 5924 |
} |
| 5925 |
% \end{macrocode} |
| 5926 |
%\end{option} |
| 5927 |
% |
| 5928 |
%\begin{option}{minsecsep} |
| 5929 |
% Set minute/second separator. |
| 5930 |
% \begin{macrocode} |
| 5931 |
\define@key{datetime2.sty}{minsecsep}{% |
| 5932 |
\renewcommand*{\dtm@minsecsep}{#1}% |
| 5933 |
} |
| 5934 |
% \end{macrocode} |
| 5935 |
%\end{option} |
| 5936 |
% |
| 5937 |
%\begin{option}{timezonesep} |
| 5938 |
% Set separator between the time and the time zone (used in |
| 5939 |
% \cs{DTMnow}). |
| 5940 |
% \begin{macrocode} |
| 5941 |
\define@key{datetime2.sty}{timezonesep}{% |
| 5942 |
\renewcommand*{\dtm@timezonesep}{#1}% |
| 5943 |
} |
| 5944 |
% \end{macrocode} |
| 5945 |
%\end{option} |
| 5946 |
% |
| 5947 |
%\begin{option}{datetimesep} |
| 5948 |
% Set separator between the date and the time (used in |
| 5949 |
% \cs{DTMnow}). |
| 5950 |
% \begin{macrocode} |
| 5951 |
\define@key{datetime2.sty}{datetimesep}{% |
| 5952 |
\renewcommand*{\dtm@datetimesep}{#1}% |
| 5953 |
} |
| 5954 |
% \end{macrocode} |
| 5955 |
%\end{option} |
| 5956 |
% |
| 5957 |
%\begin{option}{showseconds} |
| 5958 |
% Boolean key to determine whether or not to show the seconds. |
| 5959 |
% \begin{macrocode} |
| 5960 |
\define@boolkey{datetime2.sty}[DTM]{showseconds}[true]{} |
| 5961 |
% \end{macrocode} |
| 5962 |
%\end{option} |
| 5963 |
% |
| 5964 |
%\begin{option}{showdate} |
| 5965 |
% Boolean key to determine whether or not to show the date in |
| 5966 |
% \cs{DTMdisplay} and \cs{DTMDisplay}. |
| 5967 |
% \begin{macrocode} |
| 5968 |
\define@boolkey{datetime2.sty}[DTM]{showdate}[true]{} |
| 5969 |
\DTMshowdatetrue |
| 5970 |
% \end{macrocode} |
| 5971 |
%\end{option} |
| 5972 |
% |
| 5973 |
%\begin{option}{showzone} |
| 5974 |
% Boolean key to determine whether or not to show the time zone in |
| 5975 |
% \cs{DTMdisplay} and \cs{DTMDisplay}. |
| 5976 |
% \begin{macrocode} |
| 5977 |
\define@boolkey{datetime2.sty}[DTM]{showzone}[true]{} |
| 5978 |
% \end{macrocode} |
| 5979 |
%\end{option} |
| 5980 |
% |
| 5981 |
%\begin{option}{showisoZ} |
| 5982 |
% Boolean key to determine whether or not to use \texttt{Z} instead |
| 5983 |
% of \texttt{+00:00} for UTC in the \style{default}, \style{iso} or |
| 5984 |
% \style{pdf} styles. (Other styles may also use this.) |
| 5985 |
% \begin{macrocode} |
| 5986 |
\define@boolkey{datetime2.sty}[DTM]{showisoZ}[true]{} |
| 5987 |
\DTMshowisoZtrue |
| 5988 |
% \end{macrocode} |
| 5989 |
%\end{option} |
| 5990 |
% |
| 5991 |
% Switch off seconds and time zone if \cs{dtm@pdfcreationdate} |
| 5992 |
% isn't defined, otherwise switch on. |
| 5993 |
% \begin{macrocode} |
| 5994 |
\ifdef\dtm@pdfcreationdate |
| 5995 |
{% |
| 5996 |
\DTMshowsecondstrue |
| 5997 |
\DTMshowzonetrue |
| 5998 |
}% |
| 5999 |
{% |
| 6000 |
\DTMshowsecondsfalse |
| 6001 |
\DTMshowzonefalse |
| 6002 |
}% |
| 6003 |
% \end{macrocode} |
| 6004 |
% |
| 6005 |
%\begin{option}{showzoneminutes} |
| 6006 |
% Boolean key to determine whether or not to show the time zone |
| 6007 |
% minutes. (If \cs{DTMshowzonefalse} then this option is irrelevant.) |
| 6008 |
% \begin{macrocode} |
| 6009 |
\define@boolkey{datetime2.sty}[DTM]{showzoneminutes}[true]{} |
| 6010 |
\DTMshowzoneminutestrue |
| 6011 |
% \end{macrocode} |
| 6012 |
%\end{option} |
| 6013 |
% |
| 6014 |
%\begin{macro}{\DTMifcaseregional} |
| 6015 |
%\begin{definition} |
| 6016 |
%\cs{DTMifcaseregional}\marg{false}\marg{text}\marg{numeric} |
| 6017 |
%\end{definition} |
| 6018 |
% Determines if the user wants the language modules to set the |
| 6019 |
% regional format. The first argument \meta{false} indicates that |
| 6020 |
% they don't want the regional format set, the second argument |
| 6021 |
% \meta{text} indicates they want the textual format (e.g. 1st |
| 6022 |
% March, 2015 or March 1, 2005) and the third argument \meta{numeric} |
| 6023 |
% indicates they want the numeric format (e.g. 1/3/2015 or |
| 6024 |
% 3/1/2015). A change in the setting will only have an affect when |
| 6025 |
% the module is loaded and when \cs{date}\meta{language} is used to |
| 6026 |
% set the style. The default is false. |
| 6027 |
% \begin{macrocode} |
| 6028 |
\newcommand*{\DTMifcaseregional}[3]{#1} |
| 6029 |
% \end{macrocode} |
| 6030 |
%\end{macro} |
| 6031 |
% |
| 6032 |
%\begin{option}{useregional} |
| 6033 |
% Setting to determine whether or not to use the regional |
| 6034 |
% settings (if any are loaded). |
| 6035 |
%\changes{1.5.4}{2019-10-21}{renamed scratch variables} |
| 6036 |
% \begin{macrocode} |
| 6037 |
\define@choicekey{datetime2.sty}{useregional}[\@dtm@useregional@val\@dtm@useregional@nr]% |
| 6038 |
{false,text,numeric,num}[text]% |
| 6039 |
{% |
| 6040 |
\ifcase\@dtm@useregional@nr\relax |
| 6041 |
\renewcommand*{\DTMifcaseregional}[3]{##1}% |
| 6042 |
\or |
| 6043 |
\renewcommand*{\DTMifcaseregional}[3]{##2}% |
| 6044 |
\or |
| 6045 |
\renewcommand*{\DTMifcaseregional}[3]{##3}% |
| 6046 |
\or |
| 6047 |
\renewcommand*{\DTMifcaseregional}[3]{##3}% |
| 6048 |
\fi |
| 6049 |
} |
| 6050 |
% \end{macrocode} |
| 6051 |
%\end{option} |
| 6052 |
% |
| 6053 |
%\begin{macro}{\@dtm@setusecalc} |
| 6054 |
% \begin{macrocode} |
| 6055 |
\newcommand*{\@dtm@setusecalc}{% |
| 6056 |
\renewcommand*{\@dtm@usecalc}{\RequirePackage{datetime2-calc}}% |
| 6057 |
} |
| 6058 |
% \end{macrocode} |
| 6059 |
%\end{macro} |
| 6060 |
%\begin{macro}{\@dtm@usecalc} |
| 6061 |
% \begin{macrocode} |
| 6062 |
\newcommand*{\@dtm@usecalc}{} |
| 6063 |
% \end{macrocode} |
| 6064 |
%\end{macro} |
| 6065 |
% Disable attempt to load \sty{datetime2-calc} in the document. |
| 6066 |
% \begin{macrocode} |
| 6067 |
\AtBeginDocument{% |
| 6068 |
\@ifpackageloaded{datetime2-calc}% |
| 6069 |
{% |
| 6070 |
\renewcommand*{\@dtm@setusecalc}{}% |
| 6071 |
}% |
| 6072 |
{% |
| 6073 |
\renewcommand*{\@dtm@setusecalc}{% |
| 6074 |
\PackageError{datetime2}{You must load `datetime2-calc' |
| 6075 |
package to use option `showdow'}{Try one of the following:^^J |
| 6076 |
pass `calc' option to `datetime2' package when you load it^^J |
| 6077 |
or move `showdow' option to `datetime2' package option list^^J |
| 6078 |
or move \string\DTLsetup\space to the preamble.}% |
| 6079 |
}% |
| 6080 |
}% |
| 6081 |
} |
| 6082 |
% \end{macrocode} |
| 6083 |
% |
| 6084 |
%\begin{option}{calc} |
| 6085 |
% This option will load the \sty{datetime2-calc} which uses the |
| 6086 |
% \sty{pgfcalendar} package to compute the day of week and offsets. |
| 6087 |
% The package is loaded at the end of this one. |
| 6088 |
% \begin{macrocode} |
| 6089 |
\DeclareOptionX{calc}{\@dtm@setusecalc} |
| 6090 |
% \end{macrocode} |
| 6091 |
%\end{option} |
| 6092 |
% |
| 6093 |
%\begin{option}{showdow} |
| 6094 |
% Boolean key to determine whether or not to show the day of week |
| 6095 |
% for the styles that can show the day of week. If this is switched |
| 6096 |
% on, then \sty{datetime2-calc} is required. If this key is set later |
| 6097 |
% in the document with \cs{DTMsetup}, then the \sty{datetime2-calc} |
| 6098 |
% package must previously be loaded for it to have an effect. |
| 6099 |
% \begin{macrocode} |
| 6100 |
\define@boolkey{datetime2.sty}[DTM]{showdow}[true]{% |
| 6101 |
\ifDTMshowdow \@dtm@setusecalc \fi |
| 6102 |
} |
| 6103 |
\DTMshowdowfalse |
| 6104 |
% \end{macrocode} |
| 6105 |
%\end{option} |
| 6106 |
% |
| 6107 |
%\begin{macro}{\@dtm@warning} |
| 6108 |
% Warning messages. |
| 6109 |
% \begin{macrocode} |
| 6110 |
\newcommand*{\@dtm@warning}[1]{% |
| 6111 |
\if@dtm@warn |
| 6112 |
\PackageWarning{datetime2}{#1}% |
| 6113 |
\fi |
| 6114 |
} |
| 6115 |
% \end{macrocode} |
| 6116 |
%\end{macro} |
| 6117 |
% |
| 6118 |
%\begin{option}{warn} |
| 6119 |
% Allow user to suppress package warnings. |
| 6120 |
% \begin{macrocode} |
| 6121 |
\define@boolkey{datetime2.sty}[@dtm@]{warn}[true]{} |
| 6122 |
\@dtm@warntrue |
| 6123 |
% \end{macrocode} |
| 6124 |
%\end{option} |
| 6125 |
% |
| 6126 |
%\begin{macro}{\@dtm@initialstyle} |
| 6127 |
% \begin{macrocode} |
| 6128 |
\newcommand*{\@dtm@initialstyle}{} |
| 6129 |
% \end{macrocode} |
| 6130 |
%\end{macro} |
| 6131 |
%\begin{option}{style} |
| 6132 |
% Set the style. This automatically sets |
| 6133 |
% \pkgopt[false]{useregional}. |
| 6134 |
% \begin{macrocode} |
| 6135 |
\define@key{datetime2.sty}{style}{% |
| 6136 |
\renewcommand*{\@dtm@initialstyle}{#1}% |
| 6137 |
\ifstrempty{#1}% |
| 6138 |
{}% |
| 6139 |
{% |
| 6140 |
\renewcommand*{\DTMifcaseregional}[3]{##1}% |
| 6141 |
}% |
| 6142 |
} |
| 6143 |
% \end{macrocode} |
| 6144 |
%\end{option} |
| 6145 |
% |
| 6146 |
% Pass any unknown options to \sty{tracklang}. |
| 6147 |
% This will automatically switch the "useregional" setting to |
| 6148 |
% \texttt{text}. |
| 6149 |
%\changes{1.3}{2016-01-22}{added predefined dialect test} |
| 6150 |
%\changes{1.5.5}{2019-11-11}{add check for \cs{TrackIfKnownLanguage}} |
| 6151 |
% \begin{macrocode} |
| 6152 |
\DeclareOptionX*{% |
| 6153 |
\ifcsundef{@tracklang@add@\CurrentOption}% |
| 6154 |
{% |
| 6155 |
\ifundef\TrackIfKnownLanguage |
| 6156 |
{% |
| 6157 |
\PackageError{datetime2}{Unrecognised dialect `\CurrentOption'. |
| 6158 |
If you are using a valid ISO language code |
| 6159 |
please update tracklang.sty to at least v1.3.9}% |
| 6160 |
{Any options that aren't described in the manual are assumed |
| 6161 |
\MessageBreak to be language or dialect names.}% |
| 6162 |
}% |
| 6163 |
{% |
| 6164 |
\TrackIfKnownLanguage{\CurrentOption}% |
| 6165 |
{\renewcommand*{\DTMifcaseregional}[3]{#2}}% |
| 6166 |
{% |
| 6167 |
\PackageError{datetime2}{`\CurrentOption' is not a recognised dialect |
| 6168 |
\MessageBreak and doesn't contain a known language code. |
| 6169 |
\MessageBreak Perhaps you have misspelt it or the |
| 6170 |
\MessageBreak named dialect may be unsupported or |
| 6171 |
\MessageBreak perhaps you forgot the `<key>=' part |
| 6172 |
\MessageBreak for example, `style=\CurrentOption'}% |
| 6173 |
{Any options that aren't described in the manual are assumed |
| 6174 |
\MessageBreak to be language or dialect names.}% |
| 6175 |
}% |
| 6176 |
}% |
| 6177 |
}% |
| 6178 |
{% |
| 6179 |
\TrackPredefinedDialect{\CurrentOption}% |
| 6180 |
\renewcommand*{\DTMifcaseregional}[3]{#2}% |
| 6181 |
}% |
| 6182 |
} |
| 6183 |
% \end{macrocode} |
| 6184 |
% |
| 6185 |
%Process options passed to this package: |
| 6186 |
% \begin{macrocode} |
| 6187 |
\ProcessOptionsX |
| 6188 |
% \end{macrocode} |
| 6189 |
% |
| 6190 |
% Disable \texttt{calc} option. If it's required, just load |
| 6191 |
% \sty{datetime2-calc} with \cs{usepackage}. |
| 6192 |
% \begin{macrocode} |
| 6193 |
\disable@keys{datetime2.sty}{calc} |
| 6194 |
% \end{macrocode} |
| 6195 |
% Disable \texttt{style} option. If it's required, just |
| 6196 |
% use \cs{DTMsetup}. |
| 6197 |
% \begin{macrocode} |
| 6198 |
\disable@keys{datetime2.sty}{style} |
| 6199 |
% \end{macrocode} |
| 6200 |
% |
| 6201 |
% Provide a way to set options after package has been loaded. |
| 6202 |
%\begin{macro}{\DTMsetup} |
| 6203 |
% \begin{macrocode} |
| 6204 |
\newcommand*{\DTMsetup}[1]{% |
| 6205 |
\def\@dtm@usecalc{}% |
| 6206 |
\setkeys{datetime2.sty}{#1}% |
| 6207 |
\@dtm@usecalc |
| 6208 |
} |
| 6209 |
% \end{macrocode} |
| 6210 |
%\end{macro} |
| 6211 |
% |
| 6212 |
%\subsection{Defaults} |
| 6213 |
% This section sets up the defaults. |
| 6214 |
% |
| 6215 |
%\begin{macro}{\@dtm@parsedate} |
| 6216 |
% Parse date in the format \meta{year}-\meta{month}-\meta{day}. |
| 6217 |
% The arguments are expanded. (This is redefined by |
| 6218 |
% \sty{datetime2-calc}.) |
| 6219 |
% \begin{macrocode} |
| 6220 |
\def\@dtm@parsedate#1-#2-#3\@dtm@endparsedate{% |
| 6221 |
\edef\@dtm@year{\number#1}% |
| 6222 |
\edef\@dtm@month{\number#2}% |
| 6223 |
\edef\@dtm@day{\number#3}% |
| 6224 |
\def\@dtm@dow{-1}% |
| 6225 |
} |
| 6226 |
% \end{macrocode} |
| 6227 |
%\end{macro} |
| 6228 |
% |
| 6229 |
%\begin{macro}{\@dtm@parsetime} |
| 6230 |
% Define command to parse time in the format |
| 6231 |
% \meta{h}:\meta{m}:\meta{s}. The results are stored in |
| 6232 |
% \cs{@dtm@hour}, \cs{@dtm@minute} and \cs{@dtm@second}. |
| 6233 |
% The arguments are expanded. |
| 6234 |
% \begin{macrocode} |
| 6235 |
\def\@dtm@parsetime#1:#2:#3\@dtm@endparsetime{% |
| 6236 |
\edef\@dtm@hour{\number#1}% |
| 6237 |
\edef\@dtm@minute{\number#2}% |
| 6238 |
\edef\@dtm@second{\number#3}% |
| 6239 |
} |
| 6240 |
% \end{macrocode} |
| 6241 |
%\end{macro} |
| 6242 |
% |
| 6243 |
%\begin{macro}{\@dtm@parsetimezn} |
| 6244 |
% Define command to parse time in the format |
| 6245 |
% \meta{h}:\meta{m}:\meta{s} \meta{znh}:\meta{znm}. The results are stored in |
| 6246 |
% \cs{@dtm@hour}, \cs{@dtm@minute}, \cs{@dtm@second}, |
| 6247 |
% \cs{@dtm@timezonehour} and \cs{@dtm@timezoneminute}. |
| 6248 |
% The arguments are expanded. |
| 6249 |
% \begin{macrocode} |
| 6250 |
\def\@dtm@parsetimezn#1:#2:#3 #4\@dtm@endparsetimezn{% |
| 6251 |
\@dtm@parsetime#1:#2:#3\@dtm@endparsetime |
| 6252 |
\@dtm@parsezone{#4}% |
| 6253 |
} |
| 6254 |
% \end{macrocode} |
| 6255 |
%\end{macro} |
| 6256 |
% |
| 6257 |
%\begin{macro}{\@dtm@parsezone} |
| 6258 |
% Define command to parse time zone in the format |
| 6259 |
% \texttt{Z} or \meta{znh}:\meta{znm}. The results are stored in |
| 6260 |
% \cs{@dtm@timezonehour} and \cs{@dtm@timezoneminute}. |
| 6261 |
% The arguments are expanded in the event that registers are used. |
| 6262 |
% \begin{macrocode} |
| 6263 |
\newcommand*{\@dtm@parsezone}[1]{% |
| 6264 |
\ifstrequal{#1}{Z}% |
| 6265 |
{% |
| 6266 |
\def\@dtm@timezonehour{+00}% |
| 6267 |
\def\@dtm@timezoneminute{00}% |
| 6268 |
}% |
| 6269 |
{% |
| 6270 |
\@dtm@parse@zone#1\@dtm@endparse@zone |
| 6271 |
}% |
| 6272 |
} |
| 6273 |
\def\@dtm@parse@zone#1:#2\@dtm@endparse@zone{% |
| 6274 |
\edef\@dtm@timezonehour{\number#1}% |
| 6275 |
\edef\@dtm@timezoneminute{\number#2}% |
| 6276 |
} |
| 6277 |
% \end{macrocode} |
| 6278 |
%\end{macro} |
| 6279 |
% |
| 6280 |
%\begin{macro}{\@dtm@parsetimestamp} |
| 6281 |
% Parse date and time in ISO format |
| 6282 |
%\meta{YYYY}-\meta{MM}-\meta{DD}T\meta{hh}:\meta{mm}:\meta{sec}\meta{time |
| 6283 |
%zone} |
| 6284 |
% where \meta{time zone} may be \texttt{Z} or in the form |
| 6285 |
% \meta{hh}:\meta{mm} (where \meta{hh} includes the sign). |
| 6286 |
% \begin{macrocode} |
| 6287 |
\def\@dtm@parsetimestamp#1-#2-#3T#4:#5:#6#7#8\@dtm@endparsetimestamp{% |
| 6288 |
\@dtm@parsedate#1-#2-#3\@dtm@endparsedate |
| 6289 |
\@dtm@parsetime#4:#5:#6#7\@dtm@endparsetime |
| 6290 |
\@dtm@parsezone{#8}% |
| 6291 |
} |
| 6292 |
% \end{macrocode} |
| 6293 |
%\end{macro} |
| 6294 |
% |
| 6295 |
%\begin{macro}{\DTMsavefilemoddate} |
| 6296 |
% Not available for some engines. |
| 6297 |
% \begin{macrocode} |
| 6298 |
\newcommand*{\DTMsavefilemoddate}[2]{% |
| 6299 |
\@dtm@warning{Your TeX engine doesn't support accessing |
| 6300 |
file modification dates}% |
| 6301 |
\cslet{@dtm@#1@year}{0}% |
| 6302 |
\cslet{@dtm@#1@month}{0}% |
| 6303 |
\cslet{@dtm@#1@day}{0}% |
| 6304 |
\cslet{@dtm@#1@dow}{-1}% |
| 6305 |
\cslet{@dtm@#1@hour}{0}% |
| 6306 |
\cslet{@dtm@#1@minute}{0}% |
| 6307 |
\cslet{@dtm@#1@second}{0}% |
| 6308 |
\cslet{@dtm@#1@TZhour}{0}% |
| 6309 |
\cslet{@dtm@#1@TZminute}{0}% |
| 6310 |
} |
| 6311 |
% \end{macrocode} |
| 6312 |
%\end{macro} |
| 6313 |
% |
| 6314 |
%\begin{macro}{\DTMsavefrompdfdata} |
| 6315 |
%\changes{1.5.2}{2016-07-12}{new} |
| 6316 |
%Save a date-time stamp that's specified in PDF format. |
| 6317 |
% \begin{macrocode} |
| 6318 |
\newcommand*{\DTMsavefrompdfdata}[2]{% |
| 6319 |
\edef\@dtm@tmp{#2}% |
| 6320 |
\expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime |
| 6321 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 6322 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 6323 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 6324 |
\cslet{@dtm@#1@dow}{\@dtm@dow}% |
| 6325 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 6326 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 6327 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 6328 |
\cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% |
| 6329 |
\cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% |
| 6330 |
} |
| 6331 |
% \end{macrocode} |
| 6332 |
%\end{macro} |
| 6333 |
% |
| 6334 |
% Find out the current time. If \cs{dtm@pdfcreationdate} is defined, |
| 6335 |
% it can be fetched from that. |
| 6336 |
% \begin{macrocode} |
| 6337 |
\ifdef\dtm@pdfcreationdate |
| 6338 |
{% |
| 6339 |
% \end{macrocode} |
| 6340 |
% Define commands to parse \cs{dtm@pdfcreationdate} |
| 6341 |
% \begin{macrocode} |
| 6342 |
\def\@dtm@parsepdfdatetime#1:#2#3#4#5#6#7#8#9{% |
| 6343 |
\def\@dtm@year{#2#3#4#5}% |
| 6344 |
\def\@dtm@month{#6#7}% |
| 6345 |
\def\@dtm@day{#8#9}% |
| 6346 |
\@dtm@parsepdftime |
| 6347 |
} |
| 6348 |
\def\@dtm@parsepdftime#1#2#3#4#5#6#7\@dtm@endparsepdfdatetime{% |
| 6349 |
\def\@dtm@hour{#1#2}% |
| 6350 |
\def\@dtm@minute{#3#4}% |
| 6351 |
\def\@dtm@second{#5#6}% |
| 6352 |
\ifstrequal{#7}{Z}% |
| 6353 |
{% |
| 6354 |
\def\@dtm@timezonehour{00}% |
| 6355 |
\def\@dtm@timezoneminute{00}% |
| 6356 |
}% |
| 6357 |
{% |
| 6358 |
\@dtm@parsepdftimezone#7% |
| 6359 |
}% |
| 6360 |
} |
| 6361 |
\def\@dtm@parsepdftimezone#1'#2'{% |
| 6362 |
\def\@dtm@timezonehour{#1}% |
| 6363 |
\def\@dtm@timezoneminute{#2}% |
| 6364 |
}% |
| 6365 |
% \end{macrocode} |
| 6366 |
% Now parse \cs{dtm@pdfcreationdate} |
| 6367 |
% \begin{macrocode} |
| 6368 |
\expandafter\@dtm@parsepdfdatetime\dtm@pdfcreationdate\@dtm@endparsepdfdatetime |
| 6369 |
% \end{macrocode} |
| 6370 |
% Save the values. |
| 6371 |
% \begin{macrocode} |
| 6372 |
\let\@dtm@currentyear\@dtm@year |
| 6373 |
\let\@dtm@currentmonth\@dtm@month |
| 6374 |
\let\@dtm@currentday\@dtm@day |
| 6375 |
\let\@dtm@currenthour\@dtm@hour |
| 6376 |
\let\@dtm@currentminute\@dtm@minute |
| 6377 |
\let\@dtm@currentsecond\@dtm@second |
| 6378 |
\let\@dtm@currenttimezonehour\@dtm@timezonehour |
| 6379 |
\let\@dtm@currenttimezoneminute\@dtm@timezoneminute |
| 6380 |
% |
| 6381 |
% \end{macrocode} |
| 6382 |
% Lua\TeX\ doesn't provide \cs{pdffilemoddate}. |
| 6383 |
% \begin{macrocode} |
| 6384 |
\ifdef\pdffilemoddate |
| 6385 |
{% |
| 6386 |
\renewcommand*{\DTMsavefilemoddate}[2]{% |
| 6387 |
\expandafter\@dtm@parsepdfdatetime\pdffilemoddate{#2}\@dtm@endparsepdfdatetime |
| 6388 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 6389 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 6390 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 6391 |
\cslet{@dtm@#1@dow}{\@dtm@dow}% |
| 6392 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 6393 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 6394 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 6395 |
\cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% |
| 6396 |
\cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% |
| 6397 |
} |
| 6398 |
}% |
| 6399 |
{% |
| 6400 |
\ifdef\directlua |
| 6401 |
{ |
| 6402 |
% \end{macrocode} |
| 6403 |
% Lua time zone information provided by \verb|%z| is OS dependent, |
| 6404 |
% so this might not work. |
| 6405 |
% \begin{macrocode} |
| 6406 |
\renewcommand*{\DTMsavefilemoddate}[2]{% |
| 6407 |
\expandafter\@dtm@parseluadatetime |
| 6408 |
\directlua{tex.print(os.date( |
| 6409 |
"\expandafter\@gobble\string\%Y-% |
| 6410 |
\expandafter\@gobble\string\%m-% |
| 6411 |
\expandafter\@gobble\string\%d-% |
| 6412 |
\expandafter\@gobble\string\%w |
| 6413 |
\expandafter\@gobble\string\%H:% |
| 6414 |
\expandafter\@gobble\string\%M:% |
| 6415 |
\expandafter\@gobble\string\%S |
| 6416 |
\expandafter\@gobble\string\%z", |
| 6417 |
lfs.attributes("#2").modification))}% |
| 6418 |
\@dtm@endparseluadatetime |
| 6419 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 6420 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 6421 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 6422 |
\cslet{@dtm@#1@dow}{\@dtm@dow}% |
| 6423 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 6424 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 6425 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 6426 |
\cslet{@dtm@#1@TZhour}{\@dtm@TZhour}% |
| 6427 |
\cslet{@dtm@#1@TZminute}{\@dtm@TZminute}% |
| 6428 |
} |
| 6429 |
\def\@dtm@parseluadatetime#1-#2-#3-#4 #5:#6:#7 #8\@dtm@endparseluadatetime{% |
| 6430 |
\edef\@dtm@year{\number#1}% |
| 6431 |
\edef\@dtm@month{\number#2}% |
| 6432 |
\edef\@dtm@day{\number#3}% |
| 6433 |
\edef\@dtm@dow{\number#4}% |
| 6434 |
\edef\@dtm@hour{\number#5}% |
| 6435 |
\edef\@dtm@minute{\number#6}% |
| 6436 |
\edef\@dtm@second{\number#7}% |
| 6437 |
\@dtm@parseluatimezone#8000000\@dtm@endparseluatimezone |
| 6438 |
} |
| 6439 |
\def\@dtm@parseluatimezone#1#2#3#4#5#6{% |
| 6440 |
\ifstrequal{#1}{+}% |
| 6441 |
{% |
| 6442 |
\def\@dtm@TZhour{#1#2#3}% |
| 6443 |
\ifstrequal{#4}{:}% |
| 6444 |
{% |
| 6445 |
\def\@dtm@TZminute{#5#6}% |
| 6446 |
}% |
| 6447 |
{% |
| 6448 |
\def\@dtm@TZminute{#4#5}% |
| 6449 |
}% |
| 6450 |
}% |
| 6451 |
{% |
| 6452 |
\ifstrequal{#1}{-}% |
| 6453 |
{% |
| 6454 |
\def\@dtm@TZhour{#1#2#3}% |
| 6455 |
\ifstrequal{#4}{:}% |
| 6456 |
{% |
| 6457 |
\def\@dtm@TZminute{#5#6}% |
| 6458 |
}% |
| 6459 |
{% |
| 6460 |
\def\@dtm@TZminute{#4#5}% |
| 6461 |
}% |
| 6462 |
}% |
| 6463 |
{% |
| 6464 |
\ifstrequal{#1}{Z}% |
| 6465 |
{% |
| 6466 |
\def\@dtm@TZhour{0}% |
| 6467 |
\def\@dtm@TZminute{0}% |
| 6468 |
}% |
| 6469 |
{% |
| 6470 |
\def\@dtm@TZhour{#1#2}% |
| 6471 |
\ifstrequal{#3}{:}% |
| 6472 |
{% |
| 6473 |
\def\@dtm@TZminute{#4#5}% |
| 6474 |
}% |
| 6475 |
{% |
| 6476 |
\def\@dtm@TZminute{#3#4}% |
| 6477 |
}% |
| 6478 |
}% |
| 6479 |
}% |
| 6480 |
}% |
| 6481 |
\@@dtm@parseluatimezone |
| 6482 |
} |
| 6483 |
\def\@@dtm@parseluatimezone#1\@dtm@endparseluatimezone{% |
| 6484 |
} |
| 6485 |
} |
| 6486 |
{% |
| 6487 |
% \end{macrocode} |
| 6488 |
%If \ics{directlua} isn't defined but \sty{texosquery} has been |
| 6489 |
%loaded, we can use \cs{TeXOSQueryFileDate} if the shell escape is |
| 6490 |
%enabled. |
| 6491 |
% \begin{macrocode} |
| 6492 |
\ifdef\TeXOSQueryFileDate |
| 6493 |
{ |
| 6494 |
\renewcommand*{\DTMsavefilemoddate}[2]{% |
| 6495 |
\TeXOSQueryFileDate{\@dtm@tmp}{#2}% |
| 6496 |
\ifdefempty\@dtm@tmp |
| 6497 |
{% |
| 6498 |
% \end{macrocode} |
| 6499 |
% OS query failed. |
| 6500 |
% \begin{macrocode} |
| 6501 |
\@dtm@warning{Your TeX engine doesn't support accessing |
| 6502 |
file modification dates and the attempt to use texosquery |
| 6503 |
failed}% |
| 6504 |
\cslet{@dtm@#1@year}{0}% |
| 6505 |
\cslet{@dtm@#1@month}{0}% |
| 6506 |
\cslet{@dtm@#1@day}{0}% |
| 6507 |
\cslet{@dtm@#1@dow}{-1}% |
| 6508 |
\cslet{@dtm@#1@hour}{0}% |
| 6509 |
\cslet{@dtm@#1@minute}{0}% |
| 6510 |
\cslet{@dtm@#1@second}{0}% |
| 6511 |
\cslet{@dtm@#1@TZhour}{0}% |
| 6512 |
\cslet{@dtm@#1@TZminute}{0}% |
| 6513 |
}% |
| 6514 |
{% |
| 6515 |
\expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime |
| 6516 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 6517 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 6518 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 6519 |
\cslet{@dtm@#1@dow}{\@dtm@dow}% |
| 6520 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 6521 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 6522 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 6523 |
\cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% |
| 6524 |
\cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% |
| 6525 |
}% |
| 6526 |
}% |
| 6527 |
} |
| 6528 |
{} |
| 6529 |
} |
| 6530 |
}% |
| 6531 |
}% |
| 6532 |
{% |
| 6533 |
% \end{macrocode} |
| 6534 |
% \cs{pdfcreationdate} not defined. By a process of elimination, the |
| 6535 |
% \TeX\ engine is either \XeTeX\ or it's very old. (Or it may be a |
| 6536 |
% new version of Lua\TeX\ without \sty{luatex85}.) In this case, the |
| 6537 |
% seconds and time zone can't be obtained. The hour and minute need |
| 6538 |
% to be calculated from \TeX's \cs{time} primitive. |
| 6539 |
% \begin{macrocode} |
| 6540 |
\count@=\time\relax |
| 6541 |
\divide\count@ by 60\relax |
| 6542 |
\edef\@dtm@currenthour{\number\count@}% |
| 6543 |
\multiply\count@ by -60\relax |
| 6544 |
\advance\count@ by \time\relax |
| 6545 |
\edef\@dtm@currentminute{\number\count@}% |
| 6546 |
\newcommand*{\@dtm@currentsecond}{00}% |
| 6547 |
\newcommand\@dtm@currenttimezonehour{00}% |
| 6548 |
\newcommand\@dtm@currenttimezoneminute{00}% |
| 6549 |
% \end{macrocode} |
| 6550 |
% Get the day, month and year from \TeX's primitives. |
| 6551 |
% \begin{macrocode} |
| 6552 |
\edef\@dtm@currentyear{\number\year}% |
| 6553 |
\edef\@dtm@currentmonth{\number\month}% |
| 6554 |
\edef\@dtm@currentday{\number\day}% |
| 6555 |
} |
| 6556 |
% \end{macrocode} |
| 6557 |
% Make \cs{DTMsavefilemoddate} robust. |
| 6558 |
% \begin{macrocode} |
| 6559 |
\robustify\DTMsavefilemoddate |
| 6560 |
% \end{macrocode} |
| 6561 |
% |
| 6562 |
% Current day of week defaults to \texttt{-1} (that is, ignore it). |
| 6563 |
%\begin{macro}{\@dtm@currentdow} |
| 6564 |
% \begin{macrocode} |
| 6565 |
\newcommand*{\@dtm@currentdow}{-1} |
| 6566 |
% \end{macrocode} |
| 6567 |
%\end{macro} |
| 6568 |
% |
| 6569 |
% Allow \XeLaTeX\ users a way of manually setting the current time zone. |
| 6570 |
%\begin{macro}{\DTMsetcurrentzone} |
| 6571 |
% \begin{macrocode} |
| 6572 |
\newcommand*{\DTMsetcurrentzone}[2]{% |
| 6573 |
\renewcommand\@dtm@currenttimezonehour{#1}% |
| 6574 |
\renewcommand\@dtm@currenttimezoneminute{#2}% |
| 6575 |
} |
| 6576 |
% \end{macrocode} |
| 6577 |
%\end{macro} |
| 6578 |
% |
| 6579 |
%\begin{macro}{\DTMtoday} |
| 6580 |
%\changes{1.4}{2016-02-11}{new} |
| 6581 |
% Provided in case of conflict to obtain \styfmt{datetime2}'s |
| 6582 |
% version of \cs{today}. |
| 6583 |
% \begin{macrocode} |
| 6584 |
\newcommand*{\DTMtoday}{% |
| 6585 |
\DTMdisplaydate |
| 6586 |
{\@dtm@currentyear}% |
| 6587 |
{\@dtm@currentmonth}% |
| 6588 |
{\@dtm@currentday}% |
| 6589 |
{\@dtm@currentdow}% |
| 6590 |
} |
| 6591 |
% \end{macrocode} |
| 6592 |
%\end{macro} |
| 6593 |
% |
| 6594 |
%\begin{macro}{\today} |
| 6595 |
%\changes{1.4}{2016-02-11}{no longer using \cs{renewcommand}} |
| 6596 |
% Version 1.4 dropped \cs{renewcommand} in case |
| 6597 |
% \cs{today} hasn't already been defined. |
| 6598 |
% \begin{macrocode} |
| 6599 |
\let\today\DTMtoday |
| 6600 |
% \end{macrocode} |
| 6601 |
%\end{macro} |
| 6602 |
% |
| 6603 |
% The \cls{scrlttr2} class redefines \cs{today} at the start of the |
| 6604 |
% document, so check for this. |
| 6605 |
% \begin{macrocode} |
| 6606 |
\@ifclassloaded{scrlttr2}{\AtBeginDocument{\let\today\DTMtoday}}{} |
| 6607 |
% \end{macrocode} |
| 6608 |
% |
| 6609 |
%\begin{macro}{\DTMToday} |
| 6610 |
% First letter upper case version. |
| 6611 |
%\changes{1.4}{2016-02-11}{new} |
| 6612 |
% Added to v1.4 to provide \sty{datetime2}'s version in case of |
| 6613 |
% conflict. |
| 6614 |
% \begin{macrocode} |
| 6615 |
\newcommand*{\DTMToday}{% |
| 6616 |
\DTMDisplaydate |
| 6617 |
{\@dtm@currentyear}% |
| 6618 |
{\@dtm@currentmonth}% |
| 6619 |
{\@dtm@currentday}% |
| 6620 |
{\@dtm@currentdow}% |
| 6621 |
} |
| 6622 |
% \end{macrocode} |
| 6623 |
%\end{macro} |
| 6624 |
% |
| 6625 |
%\begin{macro}{\Today} |
| 6626 |
% \begin{macrocode} |
| 6627 |
\let\Today\DTMToday |
| 6628 |
% \end{macrocode} |
| 6629 |
%\end{macro} |
| 6630 |
% |
| 6631 |
%\begin{macro}{\DTMdisplaydate} |
| 6632 |
%\begin{definition} |
| 6633 |
%\cs{DTMdisplaydate}\marg{year}\marg{month}\marg{day}\marg{day of |
| 6634 |
%week} |
| 6635 |
%\end{definition} |
| 6636 |
% Display the given date. If the day of week is negative, ignore it. |
| 6637 |
% The default style ignores it regardless. |
| 6638 |
% \begin{macrocode} |
| 6639 |
\newcommand*\DTMdisplaydate[4]{% |
| 6640 |
\number#1\dtm@yearmonthsep\DTMtwodigits{#2}\dtm@monthdaysep\DTMtwodigits{#3}% |
| 6641 |
}% |
| 6642 |
% \end{macrocode} |
| 6643 |
%\end{macro} |
| 6644 |
% |
| 6645 |
%\begin{macro}{\DTMDisplaydate} |
| 6646 |
% First letter upper case version. Defaults to \cs{DTMdisplaydate}. |
| 6647 |
% \begin{macrocode} |
| 6648 |
\newcommand*{\DTMDisplaydate}{\DTMdisplaydate} |
| 6649 |
% \end{macrocode} |
| 6650 |
%\end{macro} |
| 6651 |
% |
| 6652 |
%\begin{macro}{\DTMfinaldot} |
| 6653 |
%\changes{1.5.5}{2019-11-11}{new} |
| 6654 |
%Some date styles require the date to end with a period (full stop). |
| 6655 |
%These styles should use \cs{DTLfinaldot} for the terminating |
| 6656 |
%period. This allows the starred version of \cs{DTMdate} to |
| 6657 |
%locally redefine this command to do nothing when the date is |
| 6658 |
%required at the end of a sentence. |
| 6659 |
% \begin{macrocode} |
| 6660 |
\newcommand*{\DTMfinaldot}{.} |
| 6661 |
% \end{macrocode} |
| 6662 |
%\end{macro} |
| 6663 |
% |
| 6664 |
%\begin{macro}{\DTMdate} |
| 6665 |
% Display date where date is specified in the format |
| 6666 |
%\meta{yyyy}-\meta{mm}-\meta{dd}. Use \cs{expandafter} in case |
| 6667 |
%argument is a control sequence containing the date. |
| 6668 |
%This command isn't expandable. This now has a starred version that |
| 6669 |
%locally redefines \cs{DTMfinaldot} to do nothing. |
| 6670 |
%\changes{1.5.5}{2019-11-11}{added starred version} |
| 6671 |
% \begin{macrocode} |
| 6672 |
\newrobustcmd*{\DTMdate}{\@ifstar\@sDTMdate\@DTMdate} |
| 6673 |
% \end{macrocode} |
| 6674 |
%\end{macro} |
| 6675 |
% |
| 6676 |
%\begin{macro}{\@DTMdate} |
| 6677 |
%\changes{1.5.5}{2019-11-11}{new} |
| 6678 |
% \begin{macrocode} |
| 6679 |
\newcommand*{\@DTMdate}[1]{% |
| 6680 |
\expandafter\@dtm@parsedate#1\@dtm@endparsedate |
| 6681 |
\DTMdisplaydate{\@dtm@year}{\@dtm@month}{\@dtm@day}{\@dtm@dow}% |
| 6682 |
} |
| 6683 |
% \end{macrocode} |
| 6684 |
%\end{macro} |
| 6685 |
% |
| 6686 |
%\begin{macro}{\@sDTMdate} |
| 6687 |
%\changes{1.5.5}{2019-11-11}{new} |
| 6688 |
% \begin{macrocode} |
| 6689 |
\newcommand*{\@sDTMdate}[1]{% |
| 6690 |
{% |
| 6691 |
\let\DTMfinaldot\empty |
| 6692 |
\@DTMdate{#1}% |
| 6693 |
}% |
| 6694 |
} |
| 6695 |
% \end{macrocode} |
| 6696 |
%\end{macro} |
| 6697 |
% |
| 6698 |
%\begin{macro}{\DTMDate} |
| 6699 |
% Upper case version. This now has a starred version that |
| 6700 |
%locally redefines \cs{DTMfinaldot} to do nothing. |
| 6701 |
%\changes{1.5.5}{2019-11-11}{added starred version} |
| 6702 |
% \begin{macrocode} |
| 6703 |
\newrobustcmd*{\DTMDate}{\@ifstar\@sDTMDate\@DTMDate} |
| 6704 |
% \end{macrocode} |
| 6705 |
%\end{macro} |
| 6706 |
% |
| 6707 |
%\begin{macro}{\@sDTMDate} |
| 6708 |
%\changes{1.5.5}{2019-11-11}{new} |
| 6709 |
% \begin{macrocode} |
| 6710 |
\newcommand*{\@DTMDate}[1]{% |
| 6711 |
\expandafter\@dtm@parsedate#1\@dtm@endparsedate |
| 6712 |
\DTMDisplaydate{\@dtm@year}{\@dtm@month}{\@dtm@day}{\@dtm@dow}% |
| 6713 |
} |
| 6714 |
% \end{macrocode} |
| 6715 |
%\end{macro} |
| 6716 |
% |
| 6717 |
%\begin{macro}{\@sDTMDate} |
| 6718 |
%\changes{1.5.5}{2019-11-11}{new} |
| 6719 |
% \begin{macrocode} |
| 6720 |
\newcommand*{\@sDTMDate}[1]{% |
| 6721 |
{% |
| 6722 |
\let\DTMfinaldot\empty |
| 6723 |
\@DTMDate{#1}% |
| 6724 |
}% |
| 6725 |
} |
| 6726 |
% \end{macrocode} |
| 6727 |
%\end{macro} |
| 6728 |
% |
| 6729 |
%\begin{macro}{\DTMcurrenttime} |
| 6730 |
% Display the current time. |
| 6731 |
% \begin{macrocode} |
| 6732 |
\newcommand*{\DTMcurrenttime}{% |
| 6733 |
\DTMdisplaytime |
| 6734 |
{\@dtm@currenthour}% |
| 6735 |
{\@dtm@currentminute}% |
| 6736 |
{\@dtm@currentsecond}% |
| 6737 |
} |
| 6738 |
% \end{macrocode} |
| 6739 |
%\end{macro} |
| 6740 |
% |
| 6741 |
%\begin{macro}{\DTMdisplaytime} |
| 6742 |
%\begin{definition} |
| 6743 |
%\cs{DTMdisplaytime}\marg{hour}\marg{minute}\marg{sec} |
| 6744 |
%\end{definition} |
| 6745 |
% Display the given time. |
| 6746 |
% \begin{macrocode} |
| 6747 |
\newcommand*\DTMdisplaytime[3]{% |
| 6748 |
\DTMtwodigits{#1}\dtm@hourminsep\DTMtwodigits{#2}% |
| 6749 |
\ifDTMshowseconds\dtm@minsecsep\DTMtwodigits{#3}\fi |
| 6750 |
}% |
| 6751 |
% \end{macrocode} |
| 6752 |
%\end{macro} |
| 6753 |
% |
| 6754 |
%\begin{macro}{\DTMtime} |
| 6755 |
% Display date where time is specified in the format |
| 6756 |
%\meta{hour}:\meta{minute}:\meta{seconds}. This uses \cs{expandafter} in case |
| 6757 |
%argument is a control sequence containing the time. Not expandable. |
| 6758 |
% \begin{macrocode} |
| 6759 |
\newrobustcmd*{\DTMtime}[1]{% |
| 6760 |
\@dtm@parsetime#1\@dtm@endparsetime |
| 6761 |
\DTMdisplaytime{\@dtm@hour}{\@dtm@minute}{\@dtm@second}% |
| 6762 |
} |
| 6763 |
% \end{macrocode} |
| 6764 |
%\end{macro} |
| 6765 |
% |
| 6766 |
%\begin{macro}{\DTMcurrentzone} |
| 6767 |
% Display the current time zone. |
| 6768 |
% \begin{macrocode} |
| 6769 |
\newcommand*{\DTMcurrentzone}{% |
| 6770 |
\DTMdisplayzone |
| 6771 |
{\@dtm@currenttimezonehour}% |
| 6772 |
{\@dtm@currenttimezoneminute}% |
| 6773 |
} |
| 6774 |
% \end{macrocode} |
| 6775 |
%\end{macro} |
| 6776 |
% |
| 6777 |
%\begin{macro}{\DTMdisplayzone} |
| 6778 |
% Display time zone. |
| 6779 |
% \begin{macrocode} |
| 6780 |
\newcommand*{\DTMdisplayzone}[2]{% |
| 6781 |
\ifboolexpe |
| 6782 |
{ bool{DTMshowisoZ} |
| 6783 |
and test{\ifnumequal{#1}{0}} |
| 6784 |
and test{\ifnumequal{#2}{0}} |
| 6785 |
}% |
| 6786 |
{% |
| 6787 |
Z% |
| 6788 |
}% |
| 6789 |
{% |
| 6790 |
\ifnum#1<0\else+\fi\DTMtwodigits{#1}% |
| 6791 |
\ifDTMshowzoneminutes\dtm@hourminsep\DTMtwodigits{#2}\fi |
| 6792 |
}% |
| 6793 |
} |
| 6794 |
% \end{macrocode} |
| 6795 |
%\end{macro} |
| 6796 |
% |
| 6797 |
%\begin{macro}{\DTMnow} |
| 6798 |
% Current date, time and time zone. |
| 6799 |
% \begin{macrocode} |
| 6800 |
\newcommand*{\DTMnow}{% |
| 6801 |
\DTMdisplay |
| 6802 |
{\@dtm@currentyear} |
| 6803 |
{\@dtm@currentmonth} |
| 6804 |
{\@dtm@currentday} |
| 6805 |
{\@dtm@currentdow} |
| 6806 |
{\@dtm@currenthour}% |
| 6807 |
{\@dtm@currentminute}% |
| 6808 |
{\@dtm@currentsecond}% |
| 6809 |
{\@dtm@currenttimezonehour}% |
| 6810 |
{\@dtm@currenttimezoneminute}% |
| 6811 |
} |
| 6812 |
% \end{macrocode} |
| 6813 |
%\end{macro} |
| 6814 |
% |
| 6815 |
%\begin{macro}{\DTMNow} |
| 6816 |
% Current date, time and time zone. |
| 6817 |
% \begin{macrocode} |
| 6818 |
\newcommand*{\DTMNow}{% |
| 6819 |
\DTMDisplay |
| 6820 |
{\@dtm@currentyear} |
| 6821 |
{\@dtm@currentmonth} |
| 6822 |
{\@dtm@currentday} |
| 6823 |
{\@dtm@currentdow} |
| 6824 |
{\@dtm@currenthour}% |
| 6825 |
{\@dtm@currentminute}% |
| 6826 |
{\@dtm@currentsecond}% |
| 6827 |
{\@dtm@currenttimezonehour}% |
| 6828 |
{\@dtm@currenttimezoneminute}% |
| 6829 |
} |
| 6830 |
% \end{macrocode} |
| 6831 |
%\end{macro} |
| 6832 |
% |
| 6833 |
%\begin{macro}{\DTMdisplay} |
| 6834 |
%\begin{definition} |
| 6835 |
%\cs{DTMdisplay}\marg{YYYY}\marg{MM}\marg{DD}\marg{DOW}\marg{hh}\marg{mm}\marg{ss}\newline\marg{TZh}\marg{TZm} |
| 6836 |
%\end{definition} |
| 6837 |
% Display the date and time. |
| 6838 |
% \begin{macrocode} |
| 6839 |
\newcommand*{\DTMdisplay}[9]{% |
| 6840 |
\ifDTMshowdate |
| 6841 |
\DTMdisplaydate{#1}{#2}{#3}{#4}% |
| 6842 |
\dtm@datetimesep |
| 6843 |
\fi |
| 6844 |
\DTMdisplaytime |
| 6845 |
{#5}% |
| 6846 |
{#6}% |
| 6847 |
{#7}% |
| 6848 |
\ifDTMshowzone |
| 6849 |
\dtm@timezonesep |
| 6850 |
\DTMdisplayzone |
| 6851 |
{#8}% |
| 6852 |
{#9}% |
| 6853 |
\fi |
| 6854 |
} |
| 6855 |
% \end{macrocode} |
| 6856 |
%\end{macro} |
| 6857 |
% |
| 6858 |
%\begin{macro}{\DTMDisplay} |
| 6859 |
%\begin{definition} |
| 6860 |
%\cs{DTMDisplay}\marg{YYYY}\marg{MM}\marg{DD}\marg{DOW}\marg{hh}\marg{mm}\marg{ss}\newline\marg{TZh}\marg{TZm} |
| 6861 |
%\end{definition} |
| 6862 |
% First letter upper case version. Defaults to \cs{DTMdisplay}. |
| 6863 |
% \begin{macrocode} |
| 6864 |
\newcommand*{\DTMDisplay}{\DTMdisplay} |
| 6865 |
% \end{macrocode} |
| 6866 |
%\end{macro} |
| 6867 |
% |
| 6868 |
%\subsection{Styles} |
| 6869 |
% |
| 6870 |
% Provide user level commands for displaying number as two digits. |
| 6871 |
% (Truncate if over 99, to allow for converting year to two digits). |
| 6872 |
%\begin{macro}{\DTMtwodigits} |
| 6873 |
% \begin{macrocode} |
| 6874 |
\newcommand*{\DTMtwodigits}[1]{% |
| 6875 |
\ifnum#1<0 |
| 6876 |
-\DTMtwodigits{-#1}% |
| 6877 |
\else |
| 6878 |
\ifnum#1<100 |
| 6879 |
\ifnum#1<10 |
| 6880 |
0\number#1 |
| 6881 |
\else |
| 6882 |
\number#1 |
| 6883 |
\fi |
| 6884 |
\else |
| 6885 |
% \end{macrocode} |
| 6886 |
% \cs{numexpr} rounds rather than truncates integer division, which |
| 6887 |
% is a little awkward to get around in an expandable context. |
| 6888 |
% \begin{macrocode} |
| 6889 |
\ifnum\numexpr#1-(#1/100)*100<0 |
| 6890 |
\number\numexpr#1-((#1/100)-1)*100\relax |
| 6891 |
\else |
| 6892 |
\number\numexpr#1-(#1/100)*100\relax |
| 6893 |
\fi |
| 6894 |
\fi |
| 6895 |
\fi |
| 6896 |
} |
| 6897 |
% \end{macrocode} |
| 6898 |
%\end{macro} |
| 6899 |
% |
| 6900 |
%\begin{macro}{\DTMcentury} |
| 6901 |
% Expands to the given number divided by 100 rounded upwards (in |
| 6902 |
% absolute terms). |
| 6903 |
% Provided in case the user just wants the century. |
| 6904 |
% \begin{macrocode} |
| 6905 |
\newcommand*{\DTMcentury}[1]{% |
| 6906 |
\ifnum#1<0 |
| 6907 |
-\DTMcentury{-#1}% |
| 6908 |
\else |
| 6909 |
\ifnum\numexpr#1-(#1/100)*100<1 |
| 6910 |
\number\numexpr#1/100\relax |
| 6911 |
\else |
| 6912 |
\number\numexpr(#1/100)+1\relax |
| 6913 |
\fi |
| 6914 |
\fi |
| 6915 |
} |
| 6916 |
% \end{macrocode} |
| 6917 |
%\end{macro} |
| 6918 |
% |
| 6919 |
%\begin{macro}{\DTMdivhundred} |
| 6920 |
% Expands to the given number divided by 100. |
| 6921 |
% \begin{macrocode} |
| 6922 |
\newcommand*{\DTMdivhundred}[1]{% |
| 6923 |
\ifnum#1<0 |
| 6924 |
-\DTMdivhundred{-#1}% |
| 6925 |
\else |
| 6926 |
\ifnum\numexpr#1-(#1/100)*100<0 |
| 6927 |
\number\numexpr(#1)/100-1\relax |
| 6928 |
\else |
| 6929 |
\number\numexpr((#1)/100)\relax |
| 6930 |
\fi |
| 6931 |
\fi |
| 6932 |
} |
| 6933 |
% \end{macrocode} |
| 6934 |
%\end{macro} |
| 6935 |
% |
| 6936 |
%\begin{macro}{\DTMtexorpdfstring} |
| 6937 |
%Provide user with a command that will use \sty{hyperref}'s |
| 6938 |
%\cs{texorpdfstring} if \sty{hyperref} has been loaded. If |
| 6939 |
%\sty{hyperref} isn't loaded it just does the first argument. |
| 6940 |
% \begin{macrocode} |
| 6941 |
\newcommand*{\DTMtexorpdfstring}[2]{#1} |
| 6942 |
\AtBeginDocument{% |
| 6943 |
\@ifpackageloaded{hyperref}% |
| 6944 |
{% |
| 6945 |
\renewcommand*{\DTMtexorpdfstring}{\texorpdfstring}% |
| 6946 |
}% |
| 6947 |
{}% |
| 6948 |
} |
| 6949 |
% \end{macrocode} |
| 6950 |
%\end{macro} |
| 6951 |
% |
| 6952 |
% Access separator: |
| 6953 |
%\begin{macro}{\DTMsep} |
| 6954 |
% \begin{macrocode} |
| 6955 |
\newcommand*{\DTMsep}[1]{\csname dtm@#1sep\endcsname} |
| 6956 |
% \end{macrocode} |
| 6957 |
%\end{macro} |
| 6958 |
% |
| 6959 |
% Date-only styles are stored internally as |
| 6960 |
% \cs{@dtm@datestyle@}\meta{label}, time-only styles are stored |
| 6961 |
% internally as \cs{@dtm@timestyle@}\meta{label}, zone-only styles |
| 6962 |
% are stored internally as \cs{@dtm@zonestyle@}\meta{label}. |
| 6963 |
% |
| 6964 |
%\begin{macro}{\DTMnewdatestyle} |
| 6965 |
% Define a new date-only style. This should only redefine |
| 6966 |
% \cs{DTMdisplaydate} and \cs{DTMDisplaydate}, which may or may not |
| 6967 |
% use the separators \cs{dtm@yearmonthsep} and \cs{dtm@monthdaysep}. |
| 6968 |
% \begin{macrocode} |
| 6969 |
\newcommand*{\DTMnewdatestyle}[2]{% |
| 6970 |
\ifcsdef{@dtm@datestyle@#1}% |
| 6971 |
{% |
| 6972 |
\PackageError{datetime2}{Date style `#1' already exists}{}% |
| 6973 |
}% |
| 6974 |
{% |
| 6975 |
\csdef{@dtm@datestyle@#1}{#2}% |
| 6976 |
}% |
| 6977 |
} |
| 6978 |
% \end{macrocode} |
| 6979 |
%\end{macro} |
| 6980 |
% |
| 6981 |
%\begin{macro}{\DTMrenewdatestyle} |
| 6982 |
% Redefine a date style. This should only redefine |
| 6983 |
% \cs{DTMdisplaydate} and \cs{DTMDisplaydate}, which may or may not |
| 6984 |
% use the separators \cs{dtm@yearmonthsep} and \cs{dtm@monthdaysep}. |
| 6985 |
% This may also be used to modify the date part of a full style. |
| 6986 |
%\changes{1.2}{2015-11-10}{new} |
| 6987 |
% \begin{macrocode} |
| 6988 |
\newcommand*{\DTMrenewdatestyle}[2]{% |
| 6989 |
\ifcsundef{@dtm@datestyle@#1}% |
| 6990 |
{% |
| 6991 |
\PackageError{datetime2}{Date style `#1' doesn't exist}{}% |
| 6992 |
}% |
| 6993 |
{% |
| 6994 |
\csdef{@dtm@datestyle@#1}{#2}% |
| 6995 |
}% |
| 6996 |
} |
| 6997 |
% \end{macrocode} |
| 6998 |
%\end{macro} |
| 6999 |
% |
| 7000 |
%\begin{macro}{\DTMprovidedatestyle} |
| 7001 |
% Define a date style if it doesn't already exist. |
| 7002 |
%\changes{1.2}{2015-11-10}{new} |
| 7003 |
% \begin{macrocode} |
| 7004 |
\newcommand*{\DTMprovidedatestyle}[2]{% |
| 7005 |
\ifcsdef{@dtm@datestyle@#1}% |
| 7006 |
{% |
| 7007 |
}% |
| 7008 |
{% |
| 7009 |
\csdef{@dtm@datestyle@#1}{#2}% |
| 7010 |
}% |
| 7011 |
} |
| 7012 |
% \end{macrocode} |
| 7013 |
%\end{macro} |
| 7014 |
% |
| 7015 |
%\begin{macro}{\DTMnewtimestyle} |
| 7016 |
% Define a new time-only style. This should only redefine |
| 7017 |
% \cs{DTMdisplaytime}, which may or may not use the separators |
| 7018 |
% \cs{dtm@hourminsep} and \cs{dtm@minsecsep}. |
| 7019 |
% \begin{macrocode} |
| 7020 |
\newcommand*{\DTMnewtimestyle}[2]{% |
| 7021 |
\ifcsdef{@dtm@timestyle@#1}% |
| 7022 |
{% |
| 7023 |
\PackageError{datetime2}{Time style `#1' already exists}{}% |
| 7024 |
}% |
| 7025 |
{% |
| 7026 |
\csdef{@dtm@timestyle@#1}{#2}% |
| 7027 |
}% |
| 7028 |
} |
| 7029 |
% \end{macrocode} |
| 7030 |
%\end{macro} |
| 7031 |
% |
| 7032 |
%\begin{macro}{\DTMrenewtimestyle} |
| 7033 |
% Redefine a time style. This should only redefine |
| 7034 |
% \cs{DTMdisplaytime}, which may or may not use the separators |
| 7035 |
% \cs{dtm@hourminsep} and \cs{dtm@minsecsep}. |
| 7036 |
% This may also be used to modify the time part of a full style. |
| 7037 |
%\changes{1.2}{2015-11-10}{new} |
| 7038 |
% \begin{macrocode} |
| 7039 |
\newcommand*{\DTMrenewtimestyle}[2]{% |
| 7040 |
\ifcsundef{@dtm@timestyle@#1}% |
| 7041 |
{% |
| 7042 |
\PackageError{datetime2}{Time style `#1' doesn't exist}{}% |
| 7043 |
}% |
| 7044 |
{% |
| 7045 |
\csdef{@dtm@timestyle@#1}{#2}% |
| 7046 |
}% |
| 7047 |
} |
| 7048 |
% \end{macrocode} |
| 7049 |
%\end{macro} |
| 7050 |
% |
| 7051 |
%\begin{macro}{\DTMprovidetimestyle} |
| 7052 |
% Define a time style if it doesn't already exist. |
| 7053 |
%\changes{1.2}{2015-11-10}{new} |
| 7054 |
% \begin{macrocode} |
| 7055 |
\newcommand*{\DTMprovidetimestyle}[2]{% |
| 7056 |
\ifcsdef{@dtm@timestyle@#1}% |
| 7057 |
{% |
| 7058 |
}% |
| 7059 |
{% |
| 7060 |
\csdef{@dtm@timestyle@#1}{#2}% |
| 7061 |
}% |
| 7062 |
} |
| 7063 |
% \end{macrocode} |
| 7064 |
%\end{macro} |
| 7065 |
% |
| 7066 |
%\begin{macro}{\DTMnewzonestyle} |
| 7067 |
% Define a new zone-only style. This should only redefine |
| 7068 |
% \cs{DTMdisplayzone}, which may or may not use the separator |
| 7069 |
% \cs{dtm@hourminsep}. |
| 7070 |
% \begin{macrocode} |
| 7071 |
\newcommand*{\DTMnewzonestyle}[2]{% |
| 7072 |
\ifcsdef{@dtm@zonestyle@#1}% |
| 7073 |
{% |
| 7074 |
\PackageError{datetime2}{Zone style `#1' already exists}{}% |
| 7075 |
}% |
| 7076 |
{% |
| 7077 |
\csdef{@dtm@zonestyle@#1}{#2}% |
| 7078 |
}% |
| 7079 |
} |
| 7080 |
% \end{macrocode} |
| 7081 |
%\end{macro} |
| 7082 |
% |
| 7083 |
%\begin{macro}{\DTMrenewzonestyle} |
| 7084 |
% Redefine a new zone style. This should only redefine |
| 7085 |
% \cs{DTMdisplayzone}, which may or may not use the separator |
| 7086 |
% \cs{dtm@hourminsep}. |
| 7087 |
% This may also be used to modify the zone part of a full style. |
| 7088 |
%\changes{1.2}{2015-11-10}{new} |
| 7089 |
% \begin{macrocode} |
| 7090 |
\newcommand*{\DTMrenewzonestyle}[2]{% |
| 7091 |
\ifcsundef{@dtm@zonestyle@#1}% |
| 7092 |
{% |
| 7093 |
\PackageError{datetime2}{Zone style `#1' doesn't exist}{}% |
| 7094 |
}% |
| 7095 |
{% |
| 7096 |
\csdef{@dtm@zonestyle@#1}{#2}% |
| 7097 |
}% |
| 7098 |
} |
| 7099 |
% \end{macrocode} |
| 7100 |
%\end{macro} |
| 7101 |
% |
| 7102 |
%\begin{macro}{\DTMprovidezonestyle} |
| 7103 |
% Defines a new zone style if it doesn't already exist. |
| 7104 |
%\changes{1.2}{2015-11-10}{new} |
| 7105 |
% \begin{macrocode} |
| 7106 |
\newcommand*{\DTMprovidezonestyle}[2]{% |
| 7107 |
\ifcsdef{@dtm@zonestyle@#1}% |
| 7108 |
{% |
| 7109 |
}% |
| 7110 |
{% |
| 7111 |
\csdef{@dtm@zonestyle@#1}{#2}% |
| 7112 |
}% |
| 7113 |
} |
| 7114 |
% \end{macrocode} |
| 7115 |
%\end{macro} |
| 7116 |
% |
| 7117 |
% Zone styles may use mappings to use a~regional time zone (such as |
| 7118 |
% GMT or BST). It's up to the language modules to define these |
| 7119 |
% mappings. A~mapping for time zone \meta{TZh}:\meta{TZm} is stored in |
| 7120 |
% \cs{@dtm@zonemap@}\meta{TZh}\texttt{:}\meta{TZm}. |
| 7121 |
%\begin{macro}{\DTMdefzonemap} |
| 7122 |
%\begin{definition} |
| 7123 |
%\cs{DTMdefzonemap}\marg{TZh}\marg{TZm}\marg{map} |
| 7124 |
%\end{definition} |
| 7125 |
% This will override any previous mapping for the given time zone. |
| 7126 |
% \begin{macrocode} |
| 7127 |
\newcommand*{\DTMdefzonemap}[3]{% |
| 7128 |
\csdef{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}{#3}% |
| 7129 |
} |
| 7130 |
% \end{macrocode} |
| 7131 |
%\end{macro} |
| 7132 |
% |
| 7133 |
%\begin{macro}{\DTMusezonemapordefault} |
| 7134 |
% Expands to the mapping or the default if not defined. |
| 7135 |
% \begin{macrocode} |
| 7136 |
\newcommand*{\DTMusezonemapordefault}[2]{% |
| 7137 |
\ifcsundef{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}% |
| 7138 |
{% |
| 7139 |
\ifnum#1<0\else+\fi |
| 7140 |
\DTMtwodigits{#1}% |
| 7141 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{#2}\fi |
| 7142 |
}% |
| 7143 |
{\csname @dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}\endcsname}% |
| 7144 |
} |
| 7145 |
% \end{macrocode} |
| 7146 |
%\end{macro} |
| 7147 |
% |
| 7148 |
%\begin{macro}{\DTMusezonemap} |
| 7149 |
% Expands to the mapping. (No check if defined.) |
| 7150 |
% \begin{macrocode} |
| 7151 |
\newcommand*{\DTMusezonemap}[2]{% |
| 7152 |
\csname @dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}\endcsname |
| 7153 |
} |
| 7154 |
% \end{macrocode} |
| 7155 |
%\end{macro} |
| 7156 |
% |
| 7157 |
%\begin{macro}{\DTMhaszonemap} |
| 7158 |
% \begin{macrocode} |
| 7159 |
\newcommand*{\DTMhaszonemap}[4]{% |
| 7160 |
\ifcsundef{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}{#4}{#3}% |
| 7161 |
} |
| 7162 |
% \end{macrocode} |
| 7163 |
%\end{macro} |
| 7164 |
% |
| 7165 |
%\begin{macro}{\DTMclearmap} |
| 7166 |
% Undefines the given zone mapping. No check is made to determine if |
| 7167 |
% the map exists. |
| 7168 |
% \begin{macrocode} |
| 7169 |
\newcommand*{\DTMclearmap}[2]{% |
| 7170 |
\csundef{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}% |
| 7171 |
} |
| 7172 |
% \end{macrocode} |
| 7173 |
%\end{macro} |
| 7174 |
% |
| 7175 |
%\begin{macro}{\DTMshowmap} |
| 7176 |
%Debugging command. |
| 7177 |
% \begin{macrocode} |
| 7178 |
\newcommand*{\DTMshowmap}[2]{% |
| 7179 |
\csshow{@dtm@zonemap@\DTMtwodigits{#1}:\DTMtwodigits{#2}}% |
| 7180 |
} |
| 7181 |
% \end{macrocode} |
| 7182 |
%\end{macro} |
| 7183 |
% |
| 7184 |
%\begin{macro}{\DTMresetzones} |
| 7185 |
% Regional modules should use this before setting their local zones, |
| 7186 |
% so that users can unset previously defined zones that are outside |
| 7187 |
% the region if they require. By default this does nothing, so no |
| 7188 |
% modifications are made. |
| 7189 |
% \begin{macrocode} |
| 7190 |
\newcommand*{\DTMresetzones}{} |
| 7191 |
% \end{macrocode} |
| 7192 |
%\end{macro} |
| 7193 |
% |
| 7194 |
%\begin{macro}{\DTMNatoZoneMaps} |
| 7195 |
% Provide a command to set the time zone abbreviations to the |
| 7196 |
% military\slash NATO style. |
| 7197 |
% \begin{macrocode} |
| 7198 |
\newcommand*{\DTMNatoZoneMaps}{% |
| 7199 |
\defzonemap{01}{00}{A}% Alpha time zone |
| 7200 |
\defzonemap{02}{00}{B}% Bravo time zone |
| 7201 |
\defzonemap{03}{00}{C}% Charlie time zone |
| 7202 |
\defzonemap{04}{00}{D}% Delta time zone |
| 7203 |
\defzonemap{05}{00}{E}% Echo time zone |
| 7204 |
\defzonemap{06}{00}{F}% Foxtrot time zone |
| 7205 |
\defzonemap{07}{00}{G}% Golf time zone |
| 7206 |
\defzonemap{08}{00}{H}% Hotel time zone |
| 7207 |
\defzonemap{09}{00}{I}% India time zone |
| 7208 |
\defzonemap{10}{00}{K}% Kilo time zone |
| 7209 |
\defzonemap{11}{00}{L}% Lima time zone |
| 7210 |
\defzonemap{12}{00}{M}% Mike time zone |
| 7211 |
\defzonemap{-01}{00}{N}% November time zone |
| 7212 |
\defzonemap{-02}{00}{O}% Oscar time zone |
| 7213 |
\defzonemap{-03}{00}{P}% Papa time zone |
| 7214 |
\defzonemap{-04}{00}{Q}% Quebec time zone |
| 7215 |
\defzonemap{-05}{00}{R}% Romeo time zone |
| 7216 |
\defzonemap{-06}{00}{S}% Sierra time zone |
| 7217 |
\defzonemap{-07}{00}{T}% Tango time zone |
| 7218 |
\defzonemap{-08}{00}{U}% Uniform time zone |
| 7219 |
\defzonemap{-09}{00}{V}% Victor time zone |
| 7220 |
\defzonemap{-10}{00}{W}% Whiskey time zone |
| 7221 |
\defzonemap{-11}{00}{X}% X-ray time zone |
| 7222 |
\defzonemap{-12}{00}{Y}% Yankee time zone |
| 7223 |
\defzonemap{00}{00}{Z}% Zulu time zone |
| 7224 |
} |
| 7225 |
% \end{macrocode} |
| 7226 |
%\end{macro} |
| 7227 |
% |
| 7228 |
%\begin{macro}{\DTMifhasstyle} |
| 7229 |
%\begin{definition} |
| 7230 |
%\cs{DTMifhasstyle}\marg{label}\marg{true}\marg{false} |
| 7231 |
%\end{definition} |
| 7232 |
%\changes{1.5.2}{2016-07-12}{new} |
| 7233 |
%Test to determine if style exists. |
| 7234 |
% \begin{macrocode} |
| 7235 |
\newcommand*{\DTMifhasstyle}[3]{% |
| 7236 |
\ifcsdef{@dtm@style@#1}{#2}{#3}% |
| 7237 |
} |
| 7238 |
% \end{macrocode} |
| 7239 |
%\end{macro} |
| 7240 |
% |
| 7241 |
%\begin{macro}{\DTMifhasdatestyle} |
| 7242 |
%\begin{definition} |
| 7243 |
%\cs{DTMifhasdatestyle}\marg{label}\marg{true}\marg{false} |
| 7244 |
%\end{definition} |
| 7245 |
%\changes{1.5.2}{2016-07-12}{new} |
| 7246 |
%Test to determine if partial date style exists. |
| 7247 |
% \begin{macrocode} |
| 7248 |
\newcommand*{\DTMifhasdatestyle}[3]{% |
| 7249 |
\ifcsdef{@dtm@datestyle@#1}{#2}{#3}% |
| 7250 |
} |
| 7251 |
% \end{macrocode} |
| 7252 |
%\end{macro} |
| 7253 |
% |
| 7254 |
%\begin{macro}{\DTMifhastimestyle} |
| 7255 |
%\begin{definition} |
| 7256 |
%\cs{DTMifhastimestyle}\marg{label}\marg{true}\marg{false} |
| 7257 |
%\end{definition} |
| 7258 |
%\changes{1.5.2}{2016-07-12}{new} |
| 7259 |
%Test to determine if time style exists. |
| 7260 |
% \begin{macrocode} |
| 7261 |
\newcommand*{\DTMifhastimestyle}[3]{% |
| 7262 |
\ifcsdef{@dtm@timestyle@#1}{#2}{#3}% |
| 7263 |
} |
| 7264 |
% \end{macrocode} |
| 7265 |
%\end{macro} |
| 7266 |
% |
| 7267 |
%\begin{macro}{\DTMifhaszonestyle} |
| 7268 |
%\begin{definition} |
| 7269 |
%\cs{DTMifhaszonestyle}\marg{label}\marg{true}\marg{false} |
| 7270 |
%\end{definition} |
| 7271 |
%\changes{1.5.2}{2016-07-12}{new} |
| 7272 |
%Test to determine if time zone style exists. |
| 7273 |
% \begin{macrocode} |
| 7274 |
\newcommand*{\DTMifhaszonestyle}[3]{% |
| 7275 |
\ifcsdef{@dtm@zonestyle@#1}{#2}{#3}% |
| 7276 |
} |
| 7277 |
% \end{macrocode} |
| 7278 |
%\end{macro} |
| 7279 |
% |
| 7280 |
%\begin{macro}{\DTMnewstyle} |
| 7281 |
%\begin{definition} |
| 7282 |
%\cs{DTMnewstyle}\marg{label}\marg{date style definition}\marg{time |
| 7283 |
%style definition}\marg{zone style definition}\marg{full format |
| 7284 |
%definition} |
| 7285 |
%\end{definition} |
| 7286 |
% Define a new style. The full format redefines \cs{DTMdisplay} |
| 7287 |
% and \cs{DTMDisplay}. |
| 7288 |
% \begin{macrocode} |
| 7289 |
\newcommand*{\DTMnewstyle}[5]{% |
| 7290 |
\DTMifhasstyle{#1}% |
| 7291 |
{% |
| 7292 |
\PackageError{datetime2}{Style `#1' already exists}{}% |
| 7293 |
}% |
| 7294 |
{% |
| 7295 |
\DTMnewdatestyle{#1}{#2}% |
| 7296 |
\DTMnewtimestyle{#1}{#3}% |
| 7297 |
\DTMnewzonestyle{#1}{#4}% |
| 7298 |
\csdef{@dtm@style@#1}{% |
| 7299 |
\csuse{@dtm@datestyle@#1}% |
| 7300 |
\csuse{@dtm@timestyle@#1}% |
| 7301 |
\csuse{@dtm@zonestyle@#1}% |
| 7302 |
#5% |
| 7303 |
}% |
| 7304 |
}% |
| 7305 |
} |
| 7306 |
% \end{macrocode} |
| 7307 |
%\end{macro} |
| 7308 |
% |
| 7309 |
%\begin{macro}{\DTMrenewstyle} |
| 7310 |
%\begin{definition} |
| 7311 |
%\cs{DTMrenewstyle}\marg{label}\marg{date style definition}\marg{time |
| 7312 |
%style definition}\marg{zone style definition}\marg{full format |
| 7313 |
%definition} |
| 7314 |
%\end{definition} |
| 7315 |
% Redefine a style. The full format redefines \cs{DTMdisplay} |
| 7316 |
% and \cs{DTMDisplay}. |
| 7317 |
%\changes{1.2}{2015-11-10}{new} |
| 7318 |
% \begin{macrocode} |
| 7319 |
\newcommand*{\DTMrenewstyle}[5]{% |
| 7320 |
\DTMifhasstyle{#1}% |
| 7321 |
{% |
| 7322 |
\DTMrenewdatestyle{#1}{#2}% |
| 7323 |
\DTMrenewtimestyle{#1}{#3}% |
| 7324 |
\DTMrenewzonestyle{#1}{#4}% |
| 7325 |
\csdef{@dtm@style@#1}{% |
| 7326 |
\csuse{@dtm@datestyle@#1}% |
| 7327 |
\csuse{@dtm@timestyle@#1}% |
| 7328 |
\csuse{@dtm@zonestyle@#1}% |
| 7329 |
#5% |
| 7330 |
}% |
| 7331 |
}% |
| 7332 |
{% |
| 7333 |
\PackageError{datetime2}{Style `#1' doesn't exist}{}% |
| 7334 |
}% |
| 7335 |
} |
| 7336 |
% \end{macrocode} |
| 7337 |
%\end{macro} |
| 7338 |
% |
| 7339 |
%\begin{macro}{\DTMprovidestyle} |
| 7340 |
%\begin{definition} |
| 7341 |
%\cs{DTMprovidestyle}\marg{label}\marg{date style definition}\marg{time |
| 7342 |
%style definition}\marg{zone style definition}\marg{full format |
| 7343 |
%definition} |
| 7344 |
%\end{definition} |
| 7345 |
% Defines a full style if it doesn't already exist. |
| 7346 |
%\changes{1.2}{2015-11-10}{new} |
| 7347 |
% \begin{macrocode} |
| 7348 |
\newcommand*{\DTMprovidestyle}[5]{% |
| 7349 |
\DTMifhasstyle{#1}% |
| 7350 |
{% |
| 7351 |
}% |
| 7352 |
{% |
| 7353 |
\DTMprovidedatestyle{#1}{#2}% |
| 7354 |
\DTMprovidetimestyle{#1}{#3}% |
| 7355 |
\DTMprovidezonestyle{#1}{#4}% |
| 7356 |
\csdef{@dtm@style@#1}{% |
| 7357 |
\csuse{@dtm@datestyle@#1}% |
| 7358 |
\csuse{@dtm@timestyle@#1}% |
| 7359 |
\csuse{@dtm@zonestyle@#1}% |
| 7360 |
#5% |
| 7361 |
}% |
| 7362 |
}% |
| 7363 |
} |
| 7364 |
% \end{macrocode} |
| 7365 |
%\end{macro} |
| 7366 |
% |
| 7367 |
%\begin{macro}{\DTMsetdatestyle} |
| 7368 |
% \begin{macrocode} |
| 7369 |
\newrobustcmd*{\DTMsetdatestyle}[1]{% |
| 7370 |
\ifcsdef{@dtm@datestyle@#1}% |
| 7371 |
{\csuse{@dtm@datestyle@#1}}% |
| 7372 |
{% |
| 7373 |
\PackageError{datetime2}{Date style `#1' not defined}{}% |
| 7374 |
}% |
| 7375 |
} |
| 7376 |
% \end{macrocode} |
| 7377 |
%\end{macro} |
| 7378 |
% |
| 7379 |
%\begin{macro}{\DTMsettimestyle} |
| 7380 |
% \begin{macrocode} |
| 7381 |
\newrobustcmd*{\DTMsettimestyle}[1]{% |
| 7382 |
\ifcsdef{@dtm@timestyle@#1}% |
| 7383 |
{\csuse{@dtm@timestyle@#1}}% |
| 7384 |
{% |
| 7385 |
\PackageError{datetime2}{Time style `#1' not defined}{}% |
| 7386 |
}% |
| 7387 |
} |
| 7388 |
% \end{macrocode} |
| 7389 |
%\end{macro} |
| 7390 |
% |
| 7391 |
%\begin{macro}{\DTMsetzonestyle} |
| 7392 |
% \begin{macrocode} |
| 7393 |
\newrobustcmd*{\DTMsetzonestyle}[1]{% |
| 7394 |
\ifcsdef{@dtm@zonestyle@#1}% |
| 7395 |
{\csuse{@dtm@zonestyle@#1}}% |
| 7396 |
{% |
| 7397 |
\PackageError{datetime2}{Zone style `#1' not defined}{}% |
| 7398 |
}% |
| 7399 |
} |
| 7400 |
% \end{macrocode} |
| 7401 |
%\end{macro} |
| 7402 |
% |
| 7403 |
%\begin{macro}{\DTMtryregional} |
| 7404 |
%\begin{definition} |
| 7405 |
%\cs{DTMtryregional}\oarg{lang}\marg{lang code cs}\marg{country code cs} |
| 7406 |
%\end{definition} |
| 7407 |
%Tries to see if the regional style can be set. Takes into account |
| 7408 |
%the \pkgopt{useregional} setting. The starred version expects the arguments to be |
| 7409 |
%control sequences. If both are blank or undefined nothing |
| 7410 |
%happens. The optional argument may be the root language label, |
| 7411 |
%which is used if no style exists for the ISO codes. |
| 7412 |
%\changes{1.5.2}{2016-07-12}{new} |
| 7413 |
% \begin{macrocode} |
| 7414 |
\newcommand*{\DTMtryregional}{% |
| 7415 |
\@ifstar\s@dtm@tryregional\@dtm@tryregional |
| 7416 |
} |
| 7417 |
% \end{macrocode} |
| 7418 |
%\end{macro} |
| 7419 |
%\begin{macro}{\@dtm@tryregional} |
| 7420 |
% \begin{macrocode} |
| 7421 |
\newcommand*{\@dtm@tryregional}[3][]{% |
| 7422 |
\edef\@dtm@langcode{#2}% |
| 7423 |
\edef\@dtm@countrycode{#3}% |
| 7424 |
\s@dtm@tryregional[#1]{\@dtm@langcode}{\@dtm@countrycode}% |
| 7425 |
} |
| 7426 |
% \end{macrocode} |
| 7427 |
%\end{macro} |
| 7428 |
% |
| 7429 |
%\begin{macro}{\s@dtm@tryregional} |
| 7430 |
% \begin{macrocode} |
| 7431 |
\newcommand*{\s@dtm@tryregional}[3][]{% |
| 7432 |
\def\@dtm@thisstyle{}% |
| 7433 |
\edef\@dtm@root{#1}% |
| 7434 |
\ifdefempty{#2}{}% |
| 7435 |
{% |
| 7436 |
\let\@dtm@thisstyle#2% |
| 7437 |
% \end{macrocode} |
| 7438 |
% Determine the root language name if not already provided in the |
| 7439 |
% optional argument. |
| 7440 |
% \begin{macrocode} |
| 7441 |
\ifdefempty\@dtm@root |
| 7442 |
{% |
| 7443 |
\edef\@dtm@root{\TrackedLanguageFromIsoCode{639-1}{#2}}% |
| 7444 |
\ifdefempty\@dtm@root |
| 7445 |
{% |
| 7446 |
\edef\@dtm@root{\TrackedLanguageFromIsoCode{639-2}{#2}}% |
| 7447 |
}% |
| 7448 |
{}% |
| 7449 |
}% |
| 7450 |
{}% |
| 7451 |
}% |
| 7452 |
\ifdefempty{#3}{}% |
| 7453 |
{% |
| 7454 |
\ifdefempty\@dtm@thisstyle |
| 7455 |
{\let\@dtm@thisstyle#3}% |
| 7456 |
{\eappto\@dtm@thisstyle{-#3}}% |
| 7457 |
}% |
| 7458 |
\ifdefempty\@dtm@thisstyle |
| 7459 |
{}% |
| 7460 |
{% |
| 7461 |
\DTMifcaseregional |
| 7462 |
{}% |
| 7463 |
{% |
| 7464 |
\DTMifhasstyle{\@dtm@thisstyle}% |
| 7465 |
{% |
| 7466 |
\csuse{@dtm@style@\@dtm@thisstyle}% |
| 7467 |
}% |
| 7468 |
{% |
| 7469 |
\ifdefempty\@dtm@root |
| 7470 |
{}% |
| 7471 |
{% |
| 7472 |
\DTMifhasstyle{\@dtm@root}% |
| 7473 |
{% |
| 7474 |
\csuse{@dtm@style@\@dtm@root}% |
| 7475 |
}% |
| 7476 |
{}% |
| 7477 |
}% |
| 7478 |
}% |
| 7479 |
}% |
| 7480 |
{% |
| 7481 |
\DTMifhasstyle{\@dtm@thisstyle-numeric}% |
| 7482 |
{% |
| 7483 |
\csuse{@dtm@style@\@dtm@thisstyle-numeric}% |
| 7484 |
}% |
| 7485 |
{% |
| 7486 |
\ifdefempty\@dtm@root |
| 7487 |
{}% |
| 7488 |
{% |
| 7489 |
\DTMifhasstyle{\@dtm@root-numeric}% |
| 7490 |
{% |
| 7491 |
\csuse{@dtm@style@\@dtm@root-numeric}% |
| 7492 |
}% |
| 7493 |
{}% |
| 7494 |
}% |
| 7495 |
}% |
| 7496 |
}% |
| 7497 |
}% |
| 7498 |
} |
| 7499 |
% \end{macrocode} |
| 7500 |
%\end{macro} |
| 7501 |
% |
| 7502 |
%\begin{macro}{\DTMsetregional} |
| 7503 |
%\changes{1.5.2}{2016-07-12}{new} |
| 7504 |
%\changes{1.5.6}{2020-03-02}{removed spurious space} |
| 7505 |
% \begin{macrocode} |
| 7506 |
\newcommand*{\DTMsetregional}[1][text]{% |
| 7507 |
\DTMsetup{useregional=#1}% |
| 7508 |
\ifstrequal{#1}{false}% |
| 7509 |
{% |
| 7510 |
\DTMsetstyle{default}% |
| 7511 |
}% |
| 7512 |
{% |
| 7513 |
\ifcsdef{date\languagename}% |
| 7514 |
{% |
| 7515 |
\csuse{date\languagename}% |
| 7516 |
}% |
| 7517 |
{% |
| 7518 |
% \end{macrocode} |
| 7519 |
% Iterate through dialect list. |
| 7520 |
% \begin{macrocode} |
| 7521 |
\ForEachTrackedDialect{\@dtm@thisdialect}% |
| 7522 |
{% |
| 7523 |
\edef\@dtm@lang{\TrackedLanguageFromDialect\@dtm@thisdialect}% |
| 7524 |
\edef\@dtm@langcode{\TrackedIsoCodeFromLanguage{639-1}{\@dtm@lang}}% |
| 7525 |
\ifdefempty\@dtm@langcode |
| 7526 |
{% |
| 7527 |
\edef\@dtm@langcode{\TrackedIsoCodeFromLanguage{639-2}{\@dtm@lang}}% |
| 7528 |
}% |
| 7529 |
{}% |
| 7530 |
\edef\@dtm@countrycode{% |
| 7531 |
\TrackedIsoCodeFromLanguage{3166-1}{\@dtm@thisdialect}}% |
| 7532 |
\s@dtm@tryregional[\@dtm@lang]{\@dtm@langcode}{\@dtm@countrycode}% |
| 7533 |
}% |
| 7534 |
}% |
| 7535 |
}% |
| 7536 |
} |
| 7537 |
% \end{macrocode} |
| 7538 |
%\end{macro} |
| 7539 |
% |
| 7540 |
%\begin{macro}{\DTMsetstyle} |
| 7541 |
% \begin{macrocode} |
| 7542 |
\newrobustcmd*{\DTMsetstyle}[1]{% |
| 7543 |
\DTMifhasstyle{#1}% |
| 7544 |
{\csuse{@dtm@style@#1}}% |
| 7545 |
{% |
| 7546 |
\let\dtm@unknownstyle\@dtm@unknownstyle |
| 7547 |
\ifcsdef{@dtm@datestyle#1}% |
| 7548 |
{\csuse{@dtm@datestyle@#1}\let\dtm@unknownstyle\@dtm@unknown@style}% |
| 7549 |
{\@dtm@warning{No date style `#1' defined}}% |
| 7550 |
\ifcsdef{@dtm@timestyle#1}% |
| 7551 |
{\csuse{@dtm@timestyle@#1}\let\dtm@unknownstyle\@dtm@unknown@style}% |
| 7552 |
{\@dtm@warning{No time style `#1' defined}}% |
| 7553 |
\ifcsdef{@dtm@zonestyle#1}% |
| 7554 |
{\csuse{@dtm@zonestyle@#1}\let\dtm@unknownstyle\@dtm@unknown@style}% |
| 7555 |
{\@dtm@warning{No zone style `#1' defined}}% |
| 7556 |
\dtm@unknownstyle{#1}% |
| 7557 |
}% |
| 7558 |
} |
| 7559 |
% \end{macrocode} |
| 7560 |
%\end{macro} |
| 7561 |
% |
| 7562 |
%\begin{macro}{\@dtm@unknownstyle} |
| 7563 |
% \begin{macrocode} |
| 7564 |
\newcommand*{\@dtm@unknownstyle}[1]{% |
| 7565 |
\PackageError{datetime2}{Unknown style `#1'}{}% |
| 7566 |
} |
| 7567 |
% \end{macrocode} |
| 7568 |
%\end{macro} |
| 7569 |
% |
| 7570 |
%\begin{macro}{\@dtm@unknown@style} |
| 7571 |
% \begin{macrocode} |
| 7572 |
\newcommand*{\@dtm@unknown@style}[1]{% |
| 7573 |
\@dtm@warning{No full style `#1' defined}{}% |
| 7574 |
} |
| 7575 |
% \end{macrocode} |
| 7576 |
%\end{macro} |
| 7577 |
% |
| 7578 |
% Define \style{default} style: |
| 7579 |
% \begin{macrocode} |
| 7580 |
\DTMnewstyle |
| 7581 |
{default}%label |
| 7582 |
{% date style |
| 7583 |
\renewcommand*\DTMdisplaydate[4]{% |
| 7584 |
\number##1\DTMsep{yearmonth}\DTMtwodigits{##2}% |
| 7585 |
\DTMsep{monthday}\DTMtwodigits{##3}% |
| 7586 |
}% |
| 7587 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 7588 |
}% |
| 7589 |
{% time style |
| 7590 |
\renewcommand*\DTMdisplaytime[3]{% |
| 7591 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 7592 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 7593 |
}% |
| 7594 |
}% |
| 7595 |
{% zone style |
| 7596 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 7597 |
\ifboolexpe |
| 7598 |
{ bool{DTMshowisoZ} |
| 7599 |
and test{\ifnumequal{##1}{0}} |
| 7600 |
and test{\ifnumequal{##2}{0}} |
| 7601 |
}% |
| 7602 |
{% |
| 7603 |
Z% |
| 7604 |
}% |
| 7605 |
{% |
| 7606 |
% \end{macrocode} |
| 7607 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 7608 |
%A space is needed after the conditional to prevent an unwanted |
| 7609 |
%\cs{relax} from being inserted if the time zone is negative. |
| 7610 |
% \begin{macrocode} |
| 7611 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 7612 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 7613 |
}% |
| 7614 |
}% |
| 7615 |
}% |
| 7616 |
{% full style |
| 7617 |
\renewcommand*{\DTMdisplay}[9]{% |
| 7618 |
\ifDTMshowdate |
| 7619 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 7620 |
\DTMsep{datetime}% |
| 7621 |
\fi |
| 7622 |
\DTMdisplaytime |
| 7623 |
{##5}% |
| 7624 |
{##6}% |
| 7625 |
{##7}% |
| 7626 |
\ifDTMshowzone |
| 7627 |
\DTMsep{timezone}% |
| 7628 |
\DTMdisplayzone |
| 7629 |
{##8}% |
| 7630 |
{##9}% |
| 7631 |
\fi |
| 7632 |
}% |
| 7633 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 7634 |
} |
| 7635 |
% \end{macrocode} |
| 7636 |
% |
| 7637 |
% Define \style{iso} style which ignores the separator settings: |
| 7638 |
% \begin{macrocode} |
| 7639 |
\DTMnewstyle |
| 7640 |
{iso}%label |
| 7641 |
{% date style |
| 7642 |
\renewcommand*\DTMdisplaydate[4]{% |
| 7643 |
\number##1-\DTMtwodigits{##2}-\DTMtwodigits{##3}% |
| 7644 |
}% |
| 7645 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 7646 |
}% |
| 7647 |
{% time style |
| 7648 |
\renewcommand*\DTMdisplaytime[3]{% |
| 7649 |
\DTMtwodigits{##1}:\DTMtwodigits{##2}% |
| 7650 |
\ifDTMshowseconds:\DTMtwodigits{##3}\fi |
| 7651 |
}% |
| 7652 |
}% |
| 7653 |
{% zone style |
| 7654 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 7655 |
\ifboolexpe |
| 7656 |
{ bool{DTMshowisoZ} |
| 7657 |
and test{\ifnumequal{##1}{0}} |
| 7658 |
and test{\ifnumequal{##2}{0}} |
| 7659 |
}% |
| 7660 |
{% |
| 7661 |
Z% |
| 7662 |
}% |
| 7663 |
{% |
| 7664 |
% \end{macrocode} |
| 7665 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 7666 |
%A space is needed after the conditional to prevent an unwanted |
| 7667 |
%\cs{relax} from being inserted if the time zone is negative. |
| 7668 |
% \begin{macrocode} |
| 7669 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 7670 |
\ifDTMshowzoneminutes:\DTMtwodigits{##2}\fi |
| 7671 |
}% |
| 7672 |
}% |
| 7673 |
}% |
| 7674 |
{% full style |
| 7675 |
\renewcommand*{\DTMdisplay}[9]{% |
| 7676 |
\ifDTMshowdate |
| 7677 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 7678 |
T% |
| 7679 |
\fi |
| 7680 |
\DTMdisplaytime |
| 7681 |
{##5}% |
| 7682 |
{##6}% |
| 7683 |
{##7}% |
| 7684 |
\ifDTMshowzone |
| 7685 |
\DTMdisplayzone |
| 7686 |
{##8}% |
| 7687 |
{##9}% |
| 7688 |
\fi |
| 7689 |
}% |
| 7690 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 7691 |
} |
| 7692 |
% \end{macrocode} |
| 7693 |
% |
| 7694 |
% Define \style{pdf} style which converts into a format that can be |
| 7695 |
% used in \cs{pdfinfo}: |
| 7696 |
% \begin{macrocode} |
| 7697 |
\DTMnewstyle |
| 7698 |
{pdf}%label |
| 7699 |
{% date style |
| 7700 |
\renewcommand*\DTMdisplaydate[4]{% |
| 7701 |
D:\number##1 % space intended |
| 7702 |
\DTMtwodigits{##2}\DTMtwodigits{##3}% |
| 7703 |
}% |
| 7704 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 7705 |
}% |
| 7706 |
{% time style |
| 7707 |
\renewcommand*\DTMdisplaytime[3]{% |
| 7708 |
\DTMtwodigits{##1}\DTMtwodigits{##2}\DTMtwodigits{##3}% |
| 7709 |
}% |
| 7710 |
}% |
| 7711 |
{% zone style |
| 7712 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 7713 |
\ifboolexpe |
| 7714 |
{ bool{DTMshowisoZ} |
| 7715 |
and test{\ifnumequal{##1}{0}} |
| 7716 |
and test{\ifnumequal{##2}{0}} |
| 7717 |
}% |
| 7718 |
{% |
| 7719 |
Z% |
| 7720 |
}% |
| 7721 |
{% |
| 7722 |
% \end{macrocode} |
| 7723 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 7724 |
%A space is needed after the conditional to prevent an unwanted |
| 7725 |
%\cs{relax} from being inserted if the time zone is negative. |
| 7726 |
% \begin{macrocode} |
| 7727 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}'\DTMtwodigits{##2}'% |
| 7728 |
}% |
| 7729 |
}% |
| 7730 |
}% |
| 7731 |
{% full style |
| 7732 |
\renewcommand*{\DTMdisplay}[9]{% |
| 7733 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 7734 |
\DTMdisplaytime{##5}{##6}{##7}% |
| 7735 |
\DTMdisplayzone{##8}{##9}% |
| 7736 |
}% |
| 7737 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 7738 |
} |
| 7739 |
% \end{macrocode} |
| 7740 |
% |
| 7741 |
% Define \style{yyyymd} style: |
| 7742 |
% \begin{macrocode} |
| 7743 |
\DTMnewstyle |
| 7744 |
{yyyymd}%label |
| 7745 |
{% date style |
| 7746 |
\renewcommand*\DTMdisplaydate[4]{% |
| 7747 |
\number##1 |
| 7748 |
\DTMsep{yearmonth}% |
| 7749 |
\number##2 |
| 7750 |
\DTMsep{monthday}% |
| 7751 |
\number##3 |
| 7752 |
}% |
| 7753 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 7754 |
}% |
| 7755 |
{% time style |
| 7756 |
\renewcommand*\DTMdisplaytime[3]{% |
| 7757 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 7758 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 7759 |
}% |
| 7760 |
}% |
| 7761 |
{% zone style |
| 7762 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 7763 |
\ifboolexpe |
| 7764 |
{ bool{DTMshowisoZ} |
| 7765 |
and test{\ifnumequal{##1}{0}} |
| 7766 |
and test{\ifnumequal{##2}{0}} |
| 7767 |
}% |
| 7768 |
{% |
| 7769 |
Z% |
| 7770 |
}% |
| 7771 |
{% |
| 7772 |
% \end{macrocode} |
| 7773 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 7774 |
%A space is needed after the conditional to prevent an unwanted |
| 7775 |
%\cs{relax} from being inserted if the time zone is negative. |
| 7776 |
% \begin{macrocode} |
| 7777 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 7778 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 7779 |
}% |
| 7780 |
}% |
| 7781 |
}% |
| 7782 |
{% full style |
| 7783 |
\renewcommand*{\DTMdisplay}[9]{% |
| 7784 |
\ifDTMshowdate |
| 7785 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 7786 |
\DTMsep{datetime}% |
| 7787 |
\fi |
| 7788 |
\DTMdisplaytime |
| 7789 |
{##5}% |
| 7790 |
{##6}% |
| 7791 |
{##7}% |
| 7792 |
\ifDTMshowzone |
| 7793 |
\DTMsep{timezone}% |
| 7794 |
\DTMdisplayzone |
| 7795 |
{##8}% |
| 7796 |
{##9}% |
| 7797 |
\fi |
| 7798 |
}% |
| 7799 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 7800 |
} |
| 7801 |
% \end{macrocode} |
| 7802 |
% |
| 7803 |
% Define \style{ddmmyyyy} style: |
| 7804 |
% \begin{macrocode} |
| 7805 |
\DTMnewstyle |
| 7806 |
{ddmmyyyy}%label |
| 7807 |
{% date style |
| 7808 |
\renewcommand*\DTMdisplaydate[4]{% |
| 7809 |
\DTMtwodigits{##3}\DTMsep{monthday}% |
| 7810 |
\DTMtwodigits{##2}\DTMsep{yearmonth}% |
| 7811 |
\number##1 |
| 7812 |
}% |
| 7813 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 7814 |
}% |
| 7815 |
{% time style |
| 7816 |
\renewcommand*\DTMdisplaytime[3]{% |
| 7817 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 7818 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 7819 |
}% |
| 7820 |
}% |
| 7821 |
{% zone style |
| 7822 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 7823 |
\ifboolexpe |
| 7824 |
{ bool{DTMshowisoZ} |
| 7825 |
and test{\ifnumequal{##1}{0}} |
| 7826 |
and test{\ifnumequal{##2}{0}} |
| 7827 |
}% |
| 7828 |
{% |
| 7829 |
Z% |
| 7830 |
}% |
| 7831 |
{% |
| 7832 |
% \end{macrocode} |
| 7833 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 7834 |
%A space is needed after the conditional to prevent an unwanted |
| 7835 |
%\cs{relax} from being inserted if the time zone is negative. |
| 7836 |
% \begin{macrocode} |
| 7837 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 7838 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 7839 |
}% |
| 7840 |
}% |
| 7841 |
}% |
| 7842 |
{% full style |
| 7843 |
\renewcommand*{\DTMdisplay}[9]{% |
| 7844 |
\ifDTMshowdate |
| 7845 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 7846 |
\DTMsep{datetime}% |
| 7847 |
\fi |
| 7848 |
\DTMdisplaytime |
| 7849 |
{##5}% |
| 7850 |
{##6}% |
| 7851 |
{##7}% |
| 7852 |
\ifDTMshowzone |
| 7853 |
\DTMsep{timezone}% |
| 7854 |
\DTMdisplayzone |
| 7855 |
{##8}% |
| 7856 |
{##9}% |
| 7857 |
\fi |
| 7858 |
}% |
| 7859 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 7860 |
} |
| 7861 |
% \end{macrocode} |
| 7862 |
% |
| 7863 |
% Define \style{dmyyyy} style: |
| 7864 |
% \begin{macrocode} |
| 7865 |
\DTMnewstyle |
| 7866 |
{dmyyyy}%label |
| 7867 |
{% date style |
| 7868 |
\renewcommand*\DTMdisplaydate[4]{% |
| 7869 |
\number##3 |
| 7870 |
\DTMsep{monthday}% |
| 7871 |
\number##2 |
| 7872 |
\DTMsep{yearmonth}% |
| 7873 |
\number##1 |
| 7874 |
}% |
| 7875 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 7876 |
}% |
| 7877 |
{% time style |
| 7878 |
\renewcommand*\DTMdisplaytime[3]{% |
| 7879 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 7880 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 7881 |
}% |
| 7882 |
}% |
| 7883 |
{% zone style |
| 7884 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 7885 |
\ifboolexpe |
| 7886 |
{ bool{DTMshowisoZ} |
| 7887 |
and test{\ifnumequal{##1}{0}} |
| 7888 |
and test{\ifnumequal{##2}{0}} |
| 7889 |
}% |
| 7890 |
{% |
| 7891 |
Z% |
| 7892 |
}% |
| 7893 |
{% |
| 7894 |
% \end{macrocode} |
| 7895 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 7896 |
%A space is needed after the conditional to prevent an unwanted |
| 7897 |
%\cs{relax} from being inserted if the time zone is negative. |
| 7898 |
% \begin{macrocode} |
| 7899 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 7900 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 7901 |
}% |
| 7902 |
}% |
| 7903 |
}% |
| 7904 |
{% full style |
| 7905 |
\renewcommand*{\DTMdisplay}[9]{% |
| 7906 |
\ifDTMshowdate |
| 7907 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 7908 |
\DTMsep{datetime}% |
| 7909 |
\fi |
| 7910 |
\DTMdisplaytime |
| 7911 |
{##5}% |
| 7912 |
{##6}% |
| 7913 |
{##7}% |
| 7914 |
\ifDTMshowzone |
| 7915 |
\DTMsep{timezone}% |
| 7916 |
\DTMdisplayzone |
| 7917 |
{##8}% |
| 7918 |
{##9}% |
| 7919 |
\fi |
| 7920 |
}% |
| 7921 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 7922 |
} |
| 7923 |
% \end{macrocode} |
| 7924 |
% |
| 7925 |
% Define \style{dmyy} style: |
| 7926 |
% \begin{macrocode} |
| 7927 |
\DTMnewstyle |
| 7928 |
{dmyy}%label |
| 7929 |
{% date style |
| 7930 |
\renewcommand*\DTMdisplaydate[4]{% |
| 7931 |
\number##3 % space intended |
| 7932 |
\DTMsep{monthday}% |
| 7933 |
\number##2 % space intended |
| 7934 |
\DTMsep{yearmonth}% |
| 7935 |
\DTMtwodigits{##1}% |
| 7936 |
}% |
| 7937 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 7938 |
}% |
| 7939 |
{% time style |
| 7940 |
\renewcommand*\DTMdisplaytime[3]{% |
| 7941 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 7942 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 7943 |
}% |
| 7944 |
}% |
| 7945 |
{% zone style |
| 7946 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 7947 |
\ifboolexpe |
| 7948 |
{ bool{DTMshowisoZ} |
| 7949 |
and test{\ifnumequal{##1}{0}} |
| 7950 |
and test{\ifnumequal{##2}{0}} |
| 7951 |
}% |
| 7952 |
{% |
| 7953 |
Z% |
| 7954 |
}% |
| 7955 |
{% |
| 7956 |
% \end{macrocode} |
| 7957 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 7958 |
%A space is needed after the conditional to prevent an unwanted |
| 7959 |
%\cs{relax} from being inserted if the time zone is negative. |
| 7960 |
% \begin{macrocode} |
| 7961 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 7962 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 7963 |
}% |
| 7964 |
}% |
| 7965 |
}% |
| 7966 |
{% full style |
| 7967 |
\renewcommand*{\DTMdisplay}[9]{% |
| 7968 |
\ifDTMshowdate |
| 7969 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 7970 |
\DTMsep{datetime}% |
| 7971 |
\fi |
| 7972 |
\DTMdisplaytime |
| 7973 |
{##5}% |
| 7974 |
{##6}% |
| 7975 |
{##7}% |
| 7976 |
\ifDTMshowzone |
| 7977 |
\DTMsep{timezone}% |
| 7978 |
\DTMdisplayzone |
| 7979 |
{##8}% |
| 7980 |
{##9}% |
| 7981 |
\fi |
| 7982 |
}% |
| 7983 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 7984 |
} |
| 7985 |
% \end{macrocode} |
| 7986 |
% |
| 7987 |
% Define \style{ddmmyy} style: |
| 7988 |
%\changes{1.3}{2016-01-22}{added ddmmyy style} |
| 7989 |
% \begin{macrocode} |
| 7990 |
\DTMnewstyle |
| 7991 |
{ddmmyy}%label |
| 7992 |
{% date style |
| 7993 |
\renewcommand*\DTMdisplaydate[4]{% |
| 7994 |
\DTMtwodigits{##3}\DTMsep{monthday}% |
| 7995 |
\DTMtwodigits{##2}\DTMsep{yearmonth}% |
| 7996 |
\DTMtwodigits{##1}% |
| 7997 |
}% |
| 7998 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 7999 |
}% |
| 8000 |
{% time style |
| 8001 |
\renewcommand*\DTMdisplaytime[3]{% |
| 8002 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 8003 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 8004 |
}% |
| 8005 |
}% |
| 8006 |
{% zone style |
| 8007 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 8008 |
\ifboolexpe |
| 8009 |
{ bool{DTMshowisoZ} |
| 8010 |
and test{\ifnumequal{##1}{0}} |
| 8011 |
and test{\ifnumequal{##2}{0}} |
| 8012 |
}% |
| 8013 |
{% |
| 8014 |
Z% |
| 8015 |
}% |
| 8016 |
{% |
| 8017 |
% \end{macrocode} |
| 8018 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 8019 |
%A space is needed after the conditional to prevent an unwanted |
| 8020 |
%\cs{relax} from being inserted if the time zone is negative. |
| 8021 |
% \begin{macrocode} |
| 8022 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 8023 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 8024 |
}% |
| 8025 |
}% |
| 8026 |
}% |
| 8027 |
{% full style |
| 8028 |
\renewcommand*{\DTMdisplay}[9]{% |
| 8029 |
\ifDTMshowdate |
| 8030 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 8031 |
\DTMsep{datetime}% |
| 8032 |
\fi |
| 8033 |
\DTMdisplaytime |
| 8034 |
{##5}% |
| 8035 |
{##6}% |
| 8036 |
{##7}% |
| 8037 |
\ifDTMshowzone |
| 8038 |
\DTMsep{timezone}% |
| 8039 |
\DTMdisplayzone |
| 8040 |
{##8}% |
| 8041 |
{##9}% |
| 8042 |
\fi |
| 8043 |
}% |
| 8044 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 8045 |
} |
| 8046 |
% \end{macrocode} |
| 8047 |
% |
| 8048 |
% Define \style{mmddyyyy} style: |
| 8049 |
% \begin{macrocode} |
| 8050 |
\DTMnewstyle |
| 8051 |
{mmddyyyy}%label |
| 8052 |
{% date style |
| 8053 |
\renewcommand*\DTMdisplaydate[4]{% |
| 8054 |
\DTMtwodigits{##2}\DTMsep{monthday}% |
| 8055 |
\DTMtwodigits{##3}\DTMsep{dayyear}% |
| 8056 |
\number##1 |
| 8057 |
}% |
| 8058 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 8059 |
}% |
| 8060 |
{% time style |
| 8061 |
\renewcommand*\DTMdisplaytime[3]{% |
| 8062 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 8063 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 8064 |
}% |
| 8065 |
}% |
| 8066 |
{% zone style |
| 8067 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 8068 |
\ifboolexpe |
| 8069 |
{ bool{DTMshowisoZ} |
| 8070 |
and test{\ifnumequal{##1}{0}} |
| 8071 |
and test{\ifnumequal{##2}{0}} |
| 8072 |
}% |
| 8073 |
{% |
| 8074 |
Z% |
| 8075 |
}% |
| 8076 |
{% |
| 8077 |
% \end{macrocode} |
| 8078 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 8079 |
%A space is needed after the conditional to prevent an unwanted |
| 8080 |
%\cs{relax} from being inserted if the time zone is negative. |
| 8081 |
% \begin{macrocode} |
| 8082 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 8083 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 8084 |
}% |
| 8085 |
}% |
| 8086 |
}% |
| 8087 |
{% full style |
| 8088 |
\renewcommand*{\DTMdisplay}[9]{% |
| 8089 |
\ifDTMshowdate |
| 8090 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 8091 |
\DTMsep{datetime}% |
| 8092 |
\fi |
| 8093 |
\DTMdisplaytime |
| 8094 |
{##5}% |
| 8095 |
{##6}% |
| 8096 |
{##7}% |
| 8097 |
\ifDTMshowzone |
| 8098 |
\DTMsep{timezone}% |
| 8099 |
\DTMdisplayzone |
| 8100 |
{##8}% |
| 8101 |
{##9}% |
| 8102 |
\fi |
| 8103 |
}% |
| 8104 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 8105 |
} |
| 8106 |
% \end{macrocode} |
| 8107 |
% |
| 8108 |
% Define \style{mdyyyy} style: |
| 8109 |
% \begin{macrocode} |
| 8110 |
\DTMnewstyle |
| 8111 |
{mdyyyy}%label |
| 8112 |
{% date style |
| 8113 |
\renewcommand*\DTMdisplaydate[4]{% |
| 8114 |
\number##2 % space intended |
| 8115 |
\DTMsep{monthday}% |
| 8116 |
\number##3 % space intended |
| 8117 |
\DTMsep{dayyear}% |
| 8118 |
\number##1 % space intended |
| 8119 |
}% |
| 8120 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 8121 |
}% |
| 8122 |
{% time style |
| 8123 |
\renewcommand*\DTMdisplaytime[3]{% |
| 8124 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 8125 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 8126 |
}% |
| 8127 |
}% |
| 8128 |
{% zone style |
| 8129 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 8130 |
\ifboolexpe |
| 8131 |
{ bool{DTMshowisoZ} |
| 8132 |
and test{\ifnumequal{##1}{0}} |
| 8133 |
and test{\ifnumequal{##2}{0}} |
| 8134 |
}% |
| 8135 |
{% |
| 8136 |
Z% |
| 8137 |
}% |
| 8138 |
{% |
| 8139 |
% \end{macrocode} |
| 8140 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 8141 |
%A space is needed after the conditional to prevent an unwanted |
| 8142 |
%\cs{relax} from being inserted if the time zone is negative. |
| 8143 |
% \begin{macrocode} |
| 8144 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 8145 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 8146 |
}% |
| 8147 |
}% |
| 8148 |
}% |
| 8149 |
{% full style |
| 8150 |
\renewcommand*{\DTMdisplay}[9]{% |
| 8151 |
\ifDTMshowdate |
| 8152 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 8153 |
\DTMsep{datetime}% |
| 8154 |
\fi |
| 8155 |
\DTMdisplaytime |
| 8156 |
{##5}% |
| 8157 |
{##6}% |
| 8158 |
{##7}% |
| 8159 |
\ifDTMshowzone |
| 8160 |
\DTMsep{timezone}% |
| 8161 |
\DTMdisplayzone |
| 8162 |
{##8}% |
| 8163 |
{##9}% |
| 8164 |
\fi |
| 8165 |
}% |
| 8166 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 8167 |
} |
| 8168 |
% \end{macrocode} |
| 8169 |
% |
| 8170 |
% Define \style{mdyy} style: |
| 8171 |
% \begin{macrocode} |
| 8172 |
\DTMnewstyle |
| 8173 |
{mdyy}%label |
| 8174 |
{% date style |
| 8175 |
\renewcommand*\DTMdisplaydate[4]{% |
| 8176 |
\number##2 % space intended |
| 8177 |
\DTMsep{monthday}% |
| 8178 |
\number##3 % space intended |
| 8179 |
\DTMsep{dayyear}% |
| 8180 |
\DTMtwodigits{##1}% |
| 8181 |
}% |
| 8182 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 8183 |
}% |
| 8184 |
{% time style |
| 8185 |
\renewcommand*\DTMdisplaytime[3]{% |
| 8186 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 8187 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 8188 |
}% |
| 8189 |
}% |
| 8190 |
{% zone style |
| 8191 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 8192 |
\ifboolexpe |
| 8193 |
{ bool{DTMshowisoZ} |
| 8194 |
and test{\ifnumequal{##1}{0}} |
| 8195 |
and test{\ifnumequal{##2}{0}} |
| 8196 |
}% |
| 8197 |
{% |
| 8198 |
Z% |
| 8199 |
}% |
| 8200 |
{% |
| 8201 |
% \end{macrocode} |
| 8202 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 8203 |
%A space is needed after the conditional to prevent an unwanted |
| 8204 |
%\cs{relax} from being inserted if the time zone is negative. |
| 8205 |
% \begin{macrocode} |
| 8206 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 8207 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 8208 |
}% |
| 8209 |
}% |
| 8210 |
}% |
| 8211 |
{% full style |
| 8212 |
\renewcommand*{\DTMdisplay}[9]{% |
| 8213 |
\ifDTMshowdate |
| 8214 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 8215 |
\DTMsep{datetime}% |
| 8216 |
\fi |
| 8217 |
\DTMdisplaytime |
| 8218 |
{##5}% |
| 8219 |
{##6}% |
| 8220 |
{##7}% |
| 8221 |
\ifDTMshowzone |
| 8222 |
\DTMsep{timezone}% |
| 8223 |
\DTMdisplayzone |
| 8224 |
{##8}% |
| 8225 |
{##9}% |
| 8226 |
\fi |
| 8227 |
}% |
| 8228 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 8229 |
} |
| 8230 |
% \end{macrocode} |
| 8231 |
% |
| 8232 |
% Define \style{mmddyy} style: |
| 8233 |
%\changes{1.3}{2016-01-22}{added mmddyy style} |
| 8234 |
% \begin{macrocode} |
| 8235 |
\DTMnewstyle |
| 8236 |
{mmddyy}%label |
| 8237 |
{% date style |
| 8238 |
\renewcommand*\DTMdisplaydate[4]{% |
| 8239 |
\DTMtwodigits{##2}\DTMsep{monthday}% |
| 8240 |
\DTMtwodigits{##3}\DTMsep{dayyear}% |
| 8241 |
\DTMtwodigits{##1}% |
| 8242 |
}% |
| 8243 |
\renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}% |
| 8244 |
}% |
| 8245 |
{% time style |
| 8246 |
\renewcommand*\DTMdisplaytime[3]{% |
| 8247 |
\DTMtwodigits{##1}\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 8248 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 8249 |
}% |
| 8250 |
}% |
| 8251 |
{% zone style |
| 8252 |
\renewcommand*{\DTMdisplayzone}[2]{% |
| 8253 |
\ifboolexpe |
| 8254 |
{ bool{DTMshowisoZ} |
| 8255 |
and test{\ifnumequal{##1}{0}} |
| 8256 |
and test{\ifnumequal{##2}{0}} |
| 8257 |
}% |
| 8258 |
{% |
| 8259 |
Z% |
| 8260 |
}% |
| 8261 |
{% |
| 8262 |
% \end{macrocode} |
| 8263 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 8264 |
%A space is needed after the conditional to prevent an unwanted |
| 8265 |
%\cs{relax} from being inserted if the time zone is negative. |
| 8266 |
% \begin{macrocode} |
| 8267 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 8268 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 8269 |
}% |
| 8270 |
}% |
| 8271 |
}% |
| 8272 |
{% full style |
| 8273 |
\renewcommand*{\DTMdisplay}[9]{% |
| 8274 |
\ifDTMshowdate |
| 8275 |
\DTMdisplaydate{##1}{##2}{##3}{##4}% |
| 8276 |
\DTMsep{datetime}% |
| 8277 |
\fi |
| 8278 |
\DTMdisplaytime |
| 8279 |
{##5}% |
| 8280 |
{##6}% |
| 8281 |
{##7}% |
| 8282 |
\ifDTMshowzone |
| 8283 |
\DTMsep{timezone}% |
| 8284 |
\DTMdisplayzone |
| 8285 |
{##8}% |
| 8286 |
{##9}% |
| 8287 |
\fi |
| 8288 |
}% |
| 8289 |
\renewcommand*{\DTMDisplay}{\DTMdisplay}% |
| 8290 |
} |
| 8291 |
% \end{macrocode} |
| 8292 |
% |
| 8293 |
% Define \style{hmmss} time style |
| 8294 |
% \begin{macrocode} |
| 8295 |
\DTMnewtimestyle |
| 8296 |
{hmmss}% label |
| 8297 |
{% |
| 8298 |
\renewcommand*\DTMdisplaytime[3]{% |
| 8299 |
\number##1 |
| 8300 |
\DTMsep{hourmin}\DTMtwodigits{##2}% |
| 8301 |
\ifDTMshowseconds\DTMsep{minsec}\DTMtwodigits{##3}\fi |
| 8302 |
}% |
| 8303 |
}% |
| 8304 |
% \end{macrocode} |
| 8305 |
% |
| 8306 |
% Define \style{map} zone style |
| 8307 |
% \begin{macrocode} |
| 8308 |
\DTMnewzonestyle |
| 8309 |
{map}% label |
| 8310 |
{% |
| 8311 |
\renewcommand*\DTMdisplaytime[3]{% |
| 8312 |
\DTMusezonemapordefault{##1}{##2}% |
| 8313 |
}% |
| 8314 |
}% |
| 8315 |
% \end{macrocode} |
| 8316 |
% |
| 8317 |
% Define \style{hhmm} zone style |
| 8318 |
% \begin{macrocode} |
| 8319 |
\DTMnewzonestyle |
| 8320 |
{hhmm}% label |
| 8321 |
{% |
| 8322 |
\renewcommand*\DTMdisplaytime[3]{% |
| 8323 |
% \end{macrocode} |
| 8324 |
%\changes{1.5.3}{2018-07-20}{added space after test} |
| 8325 |
%A space is needed after the conditional to prevent an unwanted |
| 8326 |
%\cs{relax} from being inserted if the time zone is negative. |
| 8327 |
% \begin{macrocode} |
| 8328 |
\ifnum##1<0 \else+\fi\DTMtwodigits{##1}% |
| 8329 |
\ifDTMshowzoneminutes\DTMsep{hourmin}\DTMtwodigits{##2}\fi |
| 8330 |
}% |
| 8331 |
} |
| 8332 |
% \end{macrocode} |
| 8333 |
% |
| 8334 |
%\subsection{Saving and Using Dates} |
| 8335 |
% Date and time information is stored in control sequences in the |
| 8336 |
% form \cs{@dtm@}\meta{label}\texttt{@}\meta{tag}, where |
| 8337 |
% \meta{label} is the label uniquely identifying the information and |
| 8338 |
% \meta{tag} is the element (\texttt{year}, \texttt{month}, |
| 8339 |
% \texttt{day}, \texttt{dow}, \texttt{hour}, \texttt{minute}, |
| 8340 |
% \texttt{second}, \texttt{TZhour} and \texttt{TZminute}). Missing |
| 8341 |
% information is stored as \texttt{0} (except for the day of week, which is |
| 8342 |
% stored as \texttt{-1}). |
| 8343 |
% |
| 8344 |
%\begin{macro}{\DTMsavedate} |
| 8345 |
% Save the date specified in the format |
| 8346 |
% \meta{yyyy}-\meta{mm}-\meta{dd}. \cs{expandafter} is used in case |
| 8347 |
% the argument is a control sequence storing the date. This will |
| 8348 |
% redefine an existing saved date with the same label. The first |
| 8349 |
% argument is the label. |
| 8350 |
% \begin{macrocode} |
| 8351 |
\newrobustcmd*{\DTMsavedate}[2]{% |
| 8352 |
\expandafter\@dtm@parsedate#2\@dtm@endparsedate |
| 8353 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 8354 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 8355 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 8356 |
\cslet{@dtm@#1@dow}{\@dtm@dow}% |
| 8357 |
\ifcsundef{@dtm@#1@hour}{\csdef{@dtm@#1@hour}{0}}{}% |
| 8358 |
\ifcsundef{@dtm@#1@minute}{\csdef{@dtm@#1@minute}{0}}{}% |
| 8359 |
\ifcsundef{@dtm@#1@second}{\csdef{@dtm@#1@second}{0}}{}% |
| 8360 |
\ifcsundef{@dtm@#1@TZhour}{\csdef{@dtm@#1@TZhour}{0}}{}% |
| 8361 |
\ifcsundef{@dtm@#1@TZminute}{\csdef{@dtm@#1@TZminute}{0}}{}% |
| 8362 |
} |
| 8363 |
% \end{macrocode} |
| 8364 |
%\end{macro} |
| 8365 |
% |
| 8366 |
%\begin{macro}{\DTMsavenoparsedate} |
| 8367 |
% Save the date without parsing the |
| 8368 |
% \meta{YYYY}-\meta{MM}-\meta{DD} format. |
| 8369 |
% \begin{macrocode} |
| 8370 |
\newrobustcmd*{\DTMsavenoparsedate}[5]{% |
| 8371 |
\csedef{@dtm@#1@year}{\number#2}% |
| 8372 |
\csedef{@dtm@#1@month}{\number#3}% |
| 8373 |
\csedef{@dtm@#1@day}{\number#4}% |
| 8374 |
\csedef{@dtm@#1@dow}{\number#5}% |
| 8375 |
\ifcsundef{@dtm@#1@hour}{\csdef{@dtm@#1@hour}{0}}{}% |
| 8376 |
\ifcsundef{@dtm@#1@minute}{\csdef{@dtm@#1@minute}{0}}{}% |
| 8377 |
\ifcsundef{@dtm@#1@second}{\csdef{@dtm@#1@second}{0}}{}% |
| 8378 |
\ifcsundef{@dtm@#1@TZhour}{\csdef{@dtm@#1@TZhour}{0}}{}% |
| 8379 |
\ifcsundef{@dtm@#1@TZminute}{\csdef{@dtm@#1@TZminute}{0}}{}% |
| 8380 |
} |
| 8381 |
% \end{macrocode} |
| 8382 |
%\end{macro} |
| 8383 |
%\begin{macro}{\DTMsavetime} |
| 8384 |
% Save the time specified in the format |
| 8385 |
% \meta{hh}:\meta{mm}:\meta{ss}. \cs{expandafter} is used in case |
| 8386 |
% the argument is a control sequence storing the date. This will |
| 8387 |
% redefine an existing saved date with the same label. The first |
| 8388 |
% argument is the label. |
| 8389 |
% \begin{macrocode} |
| 8390 |
\newrobustcmd*{\DTMsavetime}[2]{% |
| 8391 |
\expandafter\@dtm@parsetime#2\@dtm@endparsetime |
| 8392 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 8393 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 8394 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 8395 |
\ifcsundef{@dtm@#1@year}{\csdef{@dtm@#1@year}{0}}{}% |
| 8396 |
\ifcsundef{@dtm@#1@month}{\csdef{@dtm@#1@month}{0}}{}% |
| 8397 |
\ifcsundef{@dtm@#1@day}{\csdef{@dtm@#1@day}{0}}{}% |
| 8398 |
\ifcsundef{@dtm@#1@dow}{\csdef{@dtm@#1@dow}{-1}}{}% |
| 8399 |
\ifcsundef{@dtm@#1@TZhour}{\csdef{@dtm@#1@TZhour}{0}}{}% |
| 8400 |
\ifcsundef{@dtm@#1@TZminute}{\csdef{@dtm@#1@TZminute}{0}}{}% |
| 8401 |
} |
| 8402 |
% \end{macrocode} |
| 8403 |
%\end{macro} |
| 8404 |
% |
| 8405 |
%\begin{macro}{\DTMsavetimezn} |
| 8406 |
% Save the time (including zone) specified in the format |
| 8407 |
% \meta{hh}:\meta{mm}:\meta{ss} \meta{tzh}:\meta{tzm}. |
| 8408 |
% \cs{expandafter} is used in case |
| 8409 |
% the argument is a control sequence storing the date. This will |
| 8410 |
% redefine an existing saved date with the same label. The first |
| 8411 |
% argument is the label. |
| 8412 |
% \begin{macrocode} |
| 8413 |
\newrobustcmd*{\DTMsavetimezn}[2]{% |
| 8414 |
\expandafter\@dtm@parsetimezn#2\@dtm@endparsetimezn |
| 8415 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 8416 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 8417 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 8418 |
\cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% |
| 8419 |
\cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% |
| 8420 |
\ifcsundef{@dtm@#1@year}{\csdef{@dtm@#1@year}{0}}{}% |
| 8421 |
\ifcsundef{@dtm@#1@month}{\csdef{@dtm@#1@month}{0}}{}% |
| 8422 |
\ifcsundef{@dtm@#1@day}{\csdef{@dtm@#1@day}{0}}{}% |
| 8423 |
\ifcsundef{@dtm@#1@dow}{\csdef{@dtm@#1@dow}{-1}}{}% |
| 8424 |
} |
| 8425 |
% \end{macrocode} |
| 8426 |
%\end{macro} |
| 8427 |
% |
| 8428 |
%\begin{macro}{\DTMsavetimestamp} |
| 8429 |
% Save the time (including zone) specified in the format |
| 8430 |
%\meta{YYYY}-\meta{MM}-\meta{DD}T\meta{hh}:\meta{mm}:\meta{ss}\meta{time |
| 8431 |
%zone} |
| 8432 |
% |
| 8433 |
%The first argument is the label. |
| 8434 |
% \begin{macrocode} |
| 8435 |
\newrobustcmd*{\DTMsavetimestamp}[2]{% |
| 8436 |
\expandafter\@dtm@parsetimestamp#2\@dtm@endparsetimestamp |
| 8437 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 8438 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 8439 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 8440 |
\cslet{@dtm@#1@dow}{\@dtm@dow}% |
| 8441 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 8442 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 8443 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 8444 |
\cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% |
| 8445 |
\cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% |
| 8446 |
} |
| 8447 |
% \end{macrocode} |
| 8448 |
%\end{macro} |
| 8449 |
% |
| 8450 |
%\begin{macro}{\DTMsavenow} |
| 8451 |
%\changes{1.5.3}{2018-07-20}{new} |
| 8452 |
%Save the date-time stamp in PDF format. |
| 8453 |
% \begin{macrocode} |
| 8454 |
\newrobustcmd*{\DTMsavepdftimestamp}[2]{% |
| 8455 |
\edef\@dtm@tmp{#2}% |
| 8456 |
\ifx\@dtm@tmp\empty |
| 8457 |
\cslet{@dtm@#1@year}{0}% |
| 8458 |
\cslet{@dtm@#1@month}{0}% |
| 8459 |
\cslet{@dtm@#1@day}{0}% |
| 8460 |
\cslet{@dtm@#1@dow}{0}% |
| 8461 |
\cslet{@dtm@#1@hour}{0}% |
| 8462 |
\cslet{@dtm@#1@minute}{0}% |
| 8463 |
\cslet{@dtm@#1@second}{0}% |
| 8464 |
\cslet{@dtm@#1@TZhour}{0}% |
| 8465 |
\cslet{@dtm@#1@TZminute}{0}% |
| 8466 |
\else |
| 8467 |
\expandafter\@dtm@parsepdfdatetime\@dtm@tmp\@dtm@endparsepdfdatetime |
| 8468 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 8469 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 8470 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 8471 |
\cslet{@dtm@#1@dow}{\@dtm@dow}% |
| 8472 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 8473 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 8474 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 8475 |
\cslet{@dtm@#1@TZhour}{\@dtm@timezonehour}% |
| 8476 |
\cslet{@dtm@#1@TZminute}{\@dtm@timezoneminute}% |
| 8477 |
\fi |
| 8478 |
} |
| 8479 |
% \end{macrocode} |
| 8480 |
%\end{macro} |
| 8481 |
% |
| 8482 |
%\begin{macro}{\DTMsavenow} |
| 8483 |
%Save the current time. |
| 8484 |
% \begin{macrocode} |
| 8485 |
\newrobustcmd{\DTMsavenow}[1]{% |
| 8486 |
\cslet{@dtm@#1@year}{\@dtm@currentyear}% |
| 8487 |
\cslet{@dtm@#1@month}{\@dtm@currentmonth}% |
| 8488 |
\cslet{@dtm@#1@day}{\@dtm@currentday}% |
| 8489 |
\cslet{@dtm@#1@dow}{\@dtm@currentdow}% |
| 8490 |
\cslet{@dtm@#1@hour}{\@dtm@currenthour}% |
| 8491 |
\cslet{@dtm@#1@minute}{\@dtm@currentminute}% |
| 8492 |
\cslet{@dtm@#1@second}{\@dtm@currentsecond}% |
| 8493 |
\cslet{@dtm@#1@TZhour}{\@dtm@currenttimezonehour}% |
| 8494 |
\cslet{@dtm@#1@TZminute}{\@dtm@currenttimezoneminute}% |
| 8495 |
} |
| 8496 |
% \end{macrocode} |
| 8497 |
%\end{macro} |
| 8498 |
% |
| 8499 |
%\begin{macro}{\DTMmakeglobal} |
| 8500 |
%Globally set the stored information. |
| 8501 |
% \begin{macrocode} |
| 8502 |
\newrobustcmd{\DTMmakeglobal}[1]{% |
| 8503 |
\global\csletcs{@dtm@#1@year}{@dtm@#1@year}% |
| 8504 |
\global\csletcs{@dtm@#1@month}{@dtm@#1@month}% |
| 8505 |
\global\csletcs{@dtm@#1@day}{@dtm@#1@day}% |
| 8506 |
\global\csletcs{@dtm@#1@dow}{@dtm@#1@dow}% |
| 8507 |
\global\csletcs{@dtm@#1@hour}{@dtm@#1@hour}% |
| 8508 |
\global\csletcs{@dtm@#1@minute}{@dtm@#1@minute}% |
| 8509 |
\global\csletcs{@dtm@#1@second}{@dtm@#1@second}% |
| 8510 |
\global\csletcs{@dtm@#1@TZhour}{@dtm@#1@TZhour}% |
| 8511 |
\global\csletcs{@dtm@#1@TZminute}{@dtm@#1@TZminute}% |
| 8512 |
} |
| 8513 |
% \end{macrocode} |
| 8514 |
%\end{macro} |
| 8515 |
% |
| 8516 |
% Expandable ways of fetching saved data. (No check for existence |
| 8517 |
% performed.) The argument is the label. |
| 8518 |
%\begin{macro}{\DTMfetchyear} |
| 8519 |
% \begin{macrocode} |
| 8520 |
\newcommand*{\DTMfetchyear}[1]{\csname @dtm@#1@year\endcsname} |
| 8521 |
% \end{macrocode} |
| 8522 |
%\end{macro} |
| 8523 |
%\begin{macro}{\DTMfetchmonth} |
| 8524 |
% \begin{macrocode} |
| 8525 |
\newcommand*{\DTMfetchmonth}[1]{\csname @dtm@#1@month\endcsname} |
| 8526 |
% \end{macrocode} |
| 8527 |
%\end{macro} |
| 8528 |
%\begin{macro}{\DTMfetchday} |
| 8529 |
% \begin{macrocode} |
| 8530 |
\newcommand*{\DTMfetchday}[1]{\csname @dtm@#1@day\endcsname} |
| 8531 |
% \end{macrocode} |
| 8532 |
%\end{macro} |
| 8533 |
%\begin{macro}{\DTMfetchdow} |
| 8534 |
% \begin{macrocode} |
| 8535 |
\newcommand*{\DTMfetchdow}[1]{\csname @dtm@#1@dow\endcsname} |
| 8536 |
% \end{macrocode} |
| 8537 |
%\end{macro} |
| 8538 |
%\begin{macro}{\DTMfetchhour} |
| 8539 |
% \begin{macrocode} |
| 8540 |
\newcommand*{\DTMfetchhour}[1]{\csname @dtm@#1@hour\endcsname} |
| 8541 |
% \end{macrocode} |
| 8542 |
%\end{macro} |
| 8543 |
%\begin{macro}{\DTMfetchminute} |
| 8544 |
% \begin{macrocode} |
| 8545 |
\newcommand*{\DTMfetchminute}[1]{\csname @dtm@#1@minute\endcsname} |
| 8546 |
% \end{macrocode} |
| 8547 |
%\end{macro} |
| 8548 |
%\begin{macro}{\DTMfetchsecond} |
| 8549 |
% \begin{macrocode} |
| 8550 |
\newcommand*{\DTMfetchsecond}[1]{\csname @dtm@#1@second\endcsname} |
| 8551 |
% \end{macrocode} |
| 8552 |
%\end{macro} |
| 8553 |
%\begin{macro}{\DTMfetchTZhour} |
| 8554 |
% \begin{macrocode} |
| 8555 |
\newcommand*{\DTMfetchTZhour}[1]{\csname @dtm@#1@TZhour\endcsname} |
| 8556 |
% \end{macrocode} |
| 8557 |
%\end{macro} |
| 8558 |
%\begin{macro}{\DTMfetchTZminute} |
| 8559 |
% \begin{macrocode} |
| 8560 |
\newcommand*{\DTMfetchTZminute}[1]{\csname @dtm@#1@TZminute\endcsname} |
| 8561 |
% \end{macrocode} |
| 8562 |
%\end{macro} |
| 8563 |
% |
| 8564 |
%\begin{macro}{\DTMusedate} |
| 8565 |
%\begin{definition} |
| 8566 |
%\cs{DTMusedate}\marg{label} |
| 8567 |
%\end{definition} |
| 8568 |
% Displays the previously saved date using \cs{DTMdisplaydate}. |
| 8569 |
% \begin{macrocode} |
| 8570 |
\newcommand*\DTMusedate[1]{% |
| 8571 |
\ifcsundef{@dtm@#1@year}% |
| 8572 |
{% |
| 8573 |
\PackageError{datetime2}{Undefined date `#1'}{}% |
| 8574 |
}% |
| 8575 |
{% |
| 8576 |
\DTMdisplaydate |
| 8577 |
{\csname @dtm@#1@year\endcsname}% |
| 8578 |
{\csname @dtm@#1@month\endcsname}% |
| 8579 |
{\csname @dtm@#1@day\endcsname}% |
| 8580 |
{\csname @dtm@#1@dow\endcsname}% |
| 8581 |
}% |
| 8582 |
}% |
| 8583 |
% \end{macrocode} |
| 8584 |
%\end{macro} |
| 8585 |
% |
| 8586 |
%\begin{macro}{\DTMUsedate} |
| 8587 |
%\begin{definition} |
| 8588 |
%\cs{DTMUsedate}\marg{label} |
| 8589 |
%\end{definition} |
| 8590 |
% Displays the previously saved date using \cs{DTMDisplaydate}. |
| 8591 |
% \begin{macrocode} |
| 8592 |
\newcommand*\DTMUsedate[1]{% |
| 8593 |
\ifcsundef{@dtm@#1@year}% |
| 8594 |
{% |
| 8595 |
\PackageError{datetime2}{Undefined date `#1'}{}% |
| 8596 |
}% |
| 8597 |
{% |
| 8598 |
\DTMDisplaydate |
| 8599 |
{\csname @dtm@#1@year\endcsname}% |
| 8600 |
{\csname @dtm@#1@month\endcsname}% |
| 8601 |
{\csname @dtm@#1@day\endcsname}% |
| 8602 |
{\csname @dtm@#1@dow\endcsname}% |
| 8603 |
}% |
| 8604 |
}% |
| 8605 |
% \end{macrocode} |
| 8606 |
%\end{macro} |
| 8607 |
% |
| 8608 |
%\begin{macro}{\DTMusetime} |
| 8609 |
%\begin{definition} |
| 8610 |
%\cs{DTMusetime}\marg{label} |
| 8611 |
%\end{definition} |
| 8612 |
% Displays the previously saved time using \cs{DTMdisplaytime}. |
| 8613 |
% \begin{macrocode} |
| 8614 |
\newcommand*\DTMusetime[1]{% |
| 8615 |
\ifcsundef{@dtm@#1@hour}% |
| 8616 |
{% |
| 8617 |
\PackageError{datetime2}{Undefined time `#1'}{}% |
| 8618 |
}% |
| 8619 |
{% |
| 8620 |
\DTMdisplaytime |
| 8621 |
{\csname @dtm@#1@hour\endcsname}% |
| 8622 |
{\csname @dtm@#1@minute\endcsname}% |
| 8623 |
{\csname @dtm@#1@second\endcsname}% |
| 8624 |
}% |
| 8625 |
}% |
| 8626 |
% \end{macrocode} |
| 8627 |
%\end{macro} |
| 8628 |
% |
| 8629 |
%\begin{macro}{\DTMusezone} |
| 8630 |
%\begin{definition} |
| 8631 |
%\cs{DTMusezone}\marg{label} |
| 8632 |
%\end{definition} |
| 8633 |
% Displays the previously saved date using \cs{DTMdisplayzone}. |
| 8634 |
% \begin{macrocode} |
| 8635 |
\newcommand*\DTMusezone[1]{% |
| 8636 |
\ifcsundef{@dtm@#1@TZhour}% |
| 8637 |
{% |
| 8638 |
\PackageError{datetime2}{Undefined time `#1'}{}% |
| 8639 |
}% |
| 8640 |
{% |
| 8641 |
\DTMdisplayzone |
| 8642 |
{\csname @dtm@#1@TZhour\endcsname}% |
| 8643 |
{\csname @dtm@#1@TZminute\endcsname}% |
| 8644 |
}% |
| 8645 |
}% |
| 8646 |
% \end{macrocode} |
| 8647 |
%\end{macro} |
| 8648 |
% |
| 8649 |
%\begin{macro}{\DTMuse} |
| 8650 |
%\begin{definition} |
| 8651 |
%\cs{DTMuse}\marg{label} |
| 8652 |
%\end{definition} |
| 8653 |
% Displays the previously saved date and time. |
| 8654 |
% \begin{macrocode} |
| 8655 |
\newcommand*\DTMuse[1]{% |
| 8656 |
\ifcsundef{@dtm@#1@year}% |
| 8657 |
{% |
| 8658 |
\PackageError{datetime2}{Undefined date-time `#1'}{}% |
| 8659 |
}% |
| 8660 |
{% |
| 8661 |
\DTMdisplay |
| 8662 |
{\csname @dtm@#1@year\endcsname}% |
| 8663 |
{\csname @dtm@#1@month\endcsname}% |
| 8664 |
{\csname @dtm@#1@day\endcsname}% |
| 8665 |
{\csname @dtm@#1@dow\endcsname}% |
| 8666 |
{\csname @dtm@#1@hour\endcsname}% |
| 8667 |
{\csname @dtm@#1@minute\endcsname}% |
| 8668 |
{\csname @dtm@#1@second\endcsname}% |
| 8669 |
{\csname @dtm@#1@TZhour\endcsname}% |
| 8670 |
{\csname @dtm@#1@TZminute\endcsname}% |
| 8671 |
}% |
| 8672 |
}% |
| 8673 |
% \end{macrocode} |
| 8674 |
%\end{macro} |
| 8675 |
% |
| 8676 |
%\begin{macro}{\DTMUse} |
| 8677 |
%\begin{definition} |
| 8678 |
%\cs{DTMUse}\marg{label} |
| 8679 |
%\end{definition} |
| 8680 |
% Displays the previously saved date and time. |
| 8681 |
% \begin{macrocode} |
| 8682 |
\newcommand*\DTMUse[1]{% |
| 8683 |
\ifcsundef{@dtm@#1@year}% |
| 8684 |
{% |
| 8685 |
\PackageError{datetime2}{Undefined date-time `#1'}{}% |
| 8686 |
}% |
| 8687 |
{% |
| 8688 |
\DTMDisplay |
| 8689 |
{\csname @dtm@#1@year\endcsname}% |
| 8690 |
{\csname @dtm@#1@month\endcsname}% |
| 8691 |
{\csname @dtm@#1@day\endcsname}% |
| 8692 |
{\csname @dtm@#1@dow\endcsname}% |
| 8693 |
{\csname @dtm@#1@hour\endcsname}% |
| 8694 |
{\csname @dtm@#1@minute\endcsname}% |
| 8695 |
{\csname @dtm@#1@second\endcsname}% |
| 8696 |
{\csname @dtm@#1@TZhour\endcsname}% |
| 8697 |
{\csname @dtm@#1@TZminute\endcsname}% |
| 8698 |
}% |
| 8699 |
}% |
| 8700 |
% \end{macrocode} |
| 8701 |
%\end{macro} |
| 8702 |
% |
| 8703 |
%\begin{macro}{\DTMifsaveddate} |
| 8704 |
% Determine if the given label has been assigned to a date, time and |
| 8705 |
% zone. |
| 8706 |
% \begin{macrocode} |
| 8707 |
\newcommand{\DTMifsaveddate}[3]{% |
| 8708 |
\ifcsundef{@dtm@#1@year}{#3}{#2}% |
| 8709 |
} |
| 8710 |
% \end{macrocode} |
| 8711 |
%\end{macro} |
| 8712 |
% |
| 8713 |
%\subsection{Language Module Loading} |
| 8714 |
% |
| 8715 |
% Define commands to load regional settings. |
| 8716 |
% |
| 8717 |
%\begin{macro}{\@dtm@requiremodule} |
| 8718 |
% Use \sty{tracklang} interface to find the associated file for the |
| 8719 |
% given dialect. |
| 8720 |
% \begin{macrocode} |
| 8721 |
\newcommand*{\@dtm@requiremodule}[1]{% |
| 8722 |
\IfTrackedLanguageFileExists{#1}% |
| 8723 |
{datetime2-}% prefix |
| 8724 |
{.ldf}% suffix |
| 8725 |
{% |
| 8726 |
\RequireDateTimeModule{\CurrentTrackedTag}% |
| 8727 |
}% |
| 8728 |
{% |
| 8729 |
\@dtm@warning{Date-Time Language Module `#1' not installed}% |
| 8730 |
}% |
| 8731 |
} |
| 8732 |
% \end{macrocode} |
| 8733 |
%\end{macro} |
| 8734 |
% |
| 8735 |
%\begin{macro}{\@dtm@loadedregions} |
| 8736 |
% List of loaded \styfmt{datetime2} language modules. |
| 8737 |
% \begin{macrocode} |
| 8738 |
\newcommand*{\@dtm@loadedregions}{} |
| 8739 |
% \end{macrocode} |
| 8740 |
%\end{macro} |
| 8741 |
% |
| 8742 |
%\begin{macro}{\RequireDateTimeModule} |
| 8743 |
% Input the language file, if not already loaded. |
| 8744 |
% Should only be used with \cs{@dtm@requiremodule} |
| 8745 |
% which sets commands like \cs{CurrentTrackedDialect}. |
| 8746 |
% Since the language modules are loaded within |
| 8747 |
% \cs{@dtm@requiremodule} they may use this command to load |
| 8748 |
% dependent modules. |
| 8749 |
% \begin{macrocode} |
| 8750 |
\newcommand*{\RequireDateTimeModule}[1]{% |
| 8751 |
\ifundef\CurrentTrackedDialect |
| 8752 |
{% |
| 8753 |
\PackageError{datetime2}% |
| 8754 |
{\string\RequireDateTimeModule\space not permitted here}% |
| 8755 |
{This command is only permitted inside datetime2 language |
| 8756 |
modules.}% |
| 8757 |
}% |
| 8758 |
{% |
| 8759 |
\ifcsundef{ver@datetime2-#1.ldf}% |
| 8760 |
{% |
| 8761 |
\input{datetime2-#1.ldf}% |
| 8762 |
\ifdefempty\@dtm@loadedregions |
| 8763 |
{% |
| 8764 |
\edef\@dtm@loadedregions{#1}% |
| 8765 |
}% |
| 8766 |
{% |
| 8767 |
\edef\@dtm@loadedregions{\@dtm@loadedregions,#1}% |
| 8768 |
}% |
| 8769 |
% \end{macrocode} |
| 8770 |
% In case a synonym is also used, add a mapping from the module name |
| 8771 |
% to the current tracked dialect. |
| 8772 |
%\changes{1.3}{2016-01-22}{added module to dialect map} |
| 8773 |
% \begin{macrocode} |
| 8774 |
\csedef{@dtm@moddialectmap@#1}{\CurrentTrackedDialect}% |
| 8775 |
}% |
| 8776 |
{% |
| 8777 |
% \end{macrocode} |
| 8778 |
% The module has already been loaded, but the current tracked |
| 8779 |
% dialect might be a synonym for a different language label that |
| 8780 |
% might've already loaded the module. If \cs{date\meta{dialect}} |
| 8781 |
% exists, this needs to be set. |
| 8782 |
% \begin{macrocode} |
| 8783 |
\ifcsdef{date\CurrentTrackedDialect} |
| 8784 |
{% |
| 8785 |
\letcs{\@dtm@otherdialect}{@dtm@moddialectmap@#1}% |
| 8786 |
\edef\@dtm@thisdialect{\CurrentTrackedDialect}% |
| 8787 |
\ifdefequal\@dtm@thisdialect\@dtm@otherdialect |
| 8788 |
{}% |
| 8789 |
{% |
| 8790 |
\ifcsdef{date\@dtm@otherdialect}% |
| 8791 |
{% |
| 8792 |
\csletcs{date\@dtm@thisdialect}{date\@dtm@otherdialect}% |
| 8793 |
}% |
| 8794 |
{}% |
| 8795 |
}% |
| 8796 |
}% |
| 8797 |
{}% |
| 8798 |
}% |
| 8799 |
% \end{macrocode} |
| 8800 |
% In case it's needed, create a mapping between the dialect name and |
| 8801 |
% the module name. |
| 8802 |
%\changes{1.3}{2016-01-22}{added dialect to module map} |
| 8803 |
% \begin{macrocode} |
| 8804 |
\csedef{@dtm@dialectmodmap@\CurrentTrackedDialect}{#1}% |
| 8805 |
}% |
| 8806 |
} |
| 8807 |
% \end{macrocode} |
| 8808 |
%\end{macro} |
| 8809 |
% |
| 8810 |
%\begin{macro}{\DTMdialecttomodulemap} |
| 8811 |
%\changes{1.3}{2016-01-22}{new} |
| 8812 |
%\begin{definition} |
| 8813 |
%\cs{DTMdialecttomodulemap}\marg{dialect} |
| 8814 |
%\end{definition} |
| 8815 |
% Expands to name of the module loaded with the given dialect name |
| 8816 |
% or \cs{relax} if no module has been loaded for the given dialect. |
| 8817 |
% \begin{macrocode} |
| 8818 |
\newcommand*{\DTMdialecttomodulemap}[1]{% |
| 8819 |
\ifcsdef{ver@datetime2-#1.ldf}% |
| 8820 |
{#1}% |
| 8821 |
{\csname @dtm@dialectmodmap@#1\endcsname}% |
| 8822 |
} |
| 8823 |
% \end{macrocode} |
| 8824 |
%\end{macro} |
| 8825 |
% |
| 8826 |
%\begin{macro}{\ProvidesDateTimeModule} |
| 8827 |
% For use in language module to identify itself. |
| 8828 |
% \begin{macrocode} |
| 8829 |
\newcommand*{\ProvidesDateTimeModule}[1]{% |
| 8830 |
\ProvidesFile{datetime2-#1.ldf}% |
| 8831 |
} |
| 8832 |
% \end{macrocode} |
| 8833 |
%\end{macro} |
| 8834 |
% |
| 8835 |
%\begin{macro}{\DTMusemodule} |
| 8836 |
%\changes{1.03}{2016-01-20}{new} |
| 8837 |
% Provided for packages or documents that need to load a module. |
| 8838 |
% This shouldn't be used inside the \texttt{.ldf} files. |
| 8839 |
% \begin{macrocode} |
| 8840 |
\newcommand*{\DTMusemodule}[2]{% |
| 8841 |
\ifcsdef{@tracklang@add@#1}% |
| 8842 |
{% |
| 8843 |
\TrackPredefinedDialect{#1}% |
| 8844 |
}% |
| 8845 |
{}% |
| 8846 |
\let\@dtm@org@dialect\CurrentTrackedDialect |
| 8847 |
\def\CurrentTrackedDialect{#1}% |
| 8848 |
\RequireDateTimeModule{#2}% |
| 8849 |
\let\CurrentTrackedDialect\@dtm@org@dialect |
| 8850 |
} |
| 8851 |
% \end{macrocode} |
| 8852 |
%\end{macro} |
| 8853 |
% |
| 8854 |
%\begin{macro}{\DTMdefkey} |
| 8855 |
%\begin{definition} |
| 8856 |
%\cs{DTMdefkey}\marg{region}\marg{key}\oarg{default}\marg{func} |
| 8857 |
%\end{definition} |
| 8858 |
% Used by language modules to define a key. |
| 8859 |
% \begin{macrocode} |
| 8860 |
\newcommand*{\DTMdefkey}[1]{\define@key[dtm]{#1}} |
| 8861 |
% \end{macrocode} |
| 8862 |
%\end{macro} |
| 8863 |
% |
| 8864 |
%\begin{macro}{\DTMdefchoicekey} |
| 8865 |
%\begin{definition} |
| 8866 |
%\cs{DTMdefchoicekey}\marg{region}\marg{key}\oarg{bin}\marg{choice |
| 8867 |
%list}\marg{default}\marg{func} |
| 8868 |
%\end{definition} |
| 8869 |
% Used by language modules to define a choice key. |
| 8870 |
% \begin{macrocode} |
| 8871 |
\newcommand*{\DTMdefchoicekey}[1]{\define@choicekey[dtm]{#1}} |
| 8872 |
% \end{macrocode} |
| 8873 |
%\end{macro} |
| 8874 |
% |
| 8875 |
%\begin{macro}{\DTMdefboolkey} |
| 8876 |
%\begin{definition} |
| 8877 |
%\cs{DTMdefboolkey}\marg{region}\oarg{mp}\marg{key}\oarg{default}\marg{func} |
| 8878 |
%\end{definition} |
| 8879 |
% Used by language modules to define a boolean key. |
| 8880 |
% \begin{macrocode} |
| 8881 |
\newcommand*{\DTMdefboolkey}[1]{\define@boolkey[dtm]{#1}} |
| 8882 |
% \end{macrocode} |
| 8883 |
%\end{macro} |
| 8884 |
% |
| 8885 |
%\begin{macro}{\DTMifbool} |
| 8886 |
%\begin{definition} |
| 8887 |
%\cs{DTMifbool}\marg{region}\marg{key}\marg{true}\marg{false} |
| 8888 |
%\end{definition} |
| 8889 |
% Test boolean key that was defined using \cs{DTMdefboolkey} |
| 8890 |
% \begin{macrocode} |
| 8891 |
\newcommand*{\DTMifbool}[4]{\ifbool{dtm@#1@#2}{#3}{#4}} |
| 8892 |
% \end{macrocode} |
| 8893 |
%\end{macro} |
| 8894 |
% |
| 8895 |
%\begin{macro}{\DTMsetbool} |
| 8896 |
%\begin{definition} |
| 8897 |
%\cs{DTMsetbool}\marg{region}\marg{key}\marg{value} |
| 8898 |
%\end{definition} |
| 8899 |
% Set boolean key that was defined using \cs{DTMdefboolkey} |
| 8900 |
% \begin{macrocode} |
| 8901 |
\newcommand*{\DTMsetbool}[3]{\setbool{dtm@#1@#2}{#3}} |
| 8902 |
% \end{macrocode} |
| 8903 |
%\end{macro} |
| 8904 |
% |
| 8905 |
%\begin{macro}{\DTMlangsetup} |
| 8906 |
% Set up options for language modules. The optional argument is a |
| 8907 |
% list of language/regions. If omitted all loaded regions are |
| 8908 |
% iterated over. (I'm not sure why \cs{setkeys} doesn't work |
| 8909 |
% if the same key is present in multiple families, so this iterates |
| 8910 |
% over the families instead.) |
| 8911 |
% The starred version doesn't warn on unknown keys. |
| 8912 |
%\changes{1.3}{2016-01-22}{added starred version} |
| 8913 |
% \begin{macrocode} |
| 8914 |
\newcommand*{\DTMlangsetup}{% |
| 8915 |
\@ifstar\s@DTMlangsetup\@DTMlangsetup} |
| 8916 |
% \end{macrocode} |
| 8917 |
% Unstarred version: |
| 8918 |
% \begin{macrocode} |
| 8919 |
\newcommand*{\@DTMlangsetup}[2][\@dtm@loadedregions]{% |
| 8920 |
\@for\@dtm@region:=#1\do{% |
| 8921 |
\setkeys*+[dtm]{\@dtm@region}{#2}% |
| 8922 |
\ifdefempty\XKV@rm{}% |
| 8923 |
{% |
| 8924 |
\@dtm@warning{Region `\@dtm@region' has ignored |
| 8925 |
\MessageBreak the following settings:\MessageBreak |
| 8926 |
\XKV@rm |
| 8927 |
^^J}% |
| 8928 |
}% |
| 8929 |
}% |
| 8930 |
} |
| 8931 |
% \end{macrocode} |
| 8932 |
% |
| 8933 |
% Starred version: |
| 8934 |
% \begin{macrocode} |
| 8935 |
\newcommand*{\s@DTMlangsetup}[2][\@dtm@loadedregions]{% |
| 8936 |
\@for\@dtm@region:=#1\do{% |
| 8937 |
\setkeys*+[dtm]{\@dtm@region}{#2}% |
| 8938 |
}% |
| 8939 |
} |
| 8940 |
% \end{macrocode} |
| 8941 |
%\end{macro} |
| 8942 |
% |
| 8943 |
% Now load all the required modules (if installed) using the |
| 8944 |
% \sty{tracklang} interface. (Language packages, such as \sty{babel} |
| 8945 |
% or \sty{polyglossia} must be loaded before this.) |
| 8946 |
% \begin{macrocode} |
| 8947 |
\AnyTrackedLanguages |
| 8948 |
{% |
| 8949 |
\ForEachTrackedDialect{\this@dialect}% |
| 8950 |
{% |
| 8951 |
\@dtm@requiremodule\this@dialect |
| 8952 |
}% |
| 8953 |
} |
| 8954 |
{% |
| 8955 |
% \end{macrocode} |
| 8956 |
% No tracked languages. The default is already set up, so nothing to |
| 8957 |
% do here. |
| 8958 |
% \begin{macrocode} |
| 8959 |
} |
| 8960 |
% \end{macrocode} |
| 8961 |
% |
| 8962 |
% Load \sty{datetime2-calc} if required. |
| 8963 |
% \begin{macrocode} |
| 8964 |
\@dtm@usecalc |
| 8965 |
% \end{macrocode} |
| 8966 |
% |
| 8967 |
% Use the \pkgopt{style} package option, if set. |
| 8968 |
% \begin{macrocode} |
| 8969 |
\ifdefempty\@dtm@initialstyle{}{\DTMsetstyle{\@dtm@initialstyle}} |
| 8970 |
% \end{macrocode} |
| 8971 |
%\iffalse |
| 8972 |
% \begin{macrocode} |
| 8973 |
%</datetime2.sty> |
| 8974 |
% \end{macrocode} |
| 8975 |
%\fi |
| 8976 |
%\iffalse |
| 8977 |
% \begin{macrocode} |
| 8978 |
%<*datetime2-calc.sty> |
| 8979 |
% \end{macrocode} |
| 8980 |
%\fi |
| 8981 |
%\section{datetime2-calc.sty code} |
| 8982 |
% \begin{macrocode} |
| 8983 |
\NeedsTeXFormat{LaTeX2e} |
| 8984 |
\ProvidesPackage{datetime2-calc}[2021/03/21 v1.5.7 (NLCT)] |
| 8985 |
% \end{macrocode} |
| 8986 |
% Load other required packages |
| 8987 |
% \begin{macrocode} |
| 8988 |
\RequirePackage{pgfkeys} |
| 8989 |
\RequirePackage{pgfcalendar} |
| 8990 |
% \end{macrocode} |
| 8991 |
% |
| 8992 |
%\subsection{Conversions and Calculations} |
| 8993 |
%\begin{macro}{\@dtm@julianday} |
| 8994 |
% Register for storing Julian day number. |
| 8995 |
% \begin{macrocode} |
| 8996 |
\newcount\@dtm@julianday |
| 8997 |
% \end{macrocode} |
| 8998 |
%\end{macro} |
| 8999 |
% |
| 9000 |
%\begin{macro}{\@dtm@parsedate} |
| 9001 |
% Redefine \cs{@dtm@parsedate} so that it uses \sty{pgfcalendar} to |
| 9002 |
% compute the required information. This allows for offsets, the use |
| 9003 |
% of \texttt{last} and also determine the day of week. |
| 9004 |
% \begin{macrocode} |
| 9005 |
\def\@dtm@parsedate#1-#2-#3\@dtm@endparsedate{% |
| 9006 |
\pgfcalendardatetojulian{#1-#2-#3}{\@dtm@julianday}% |
| 9007 |
\pgfcalendarjuliantodate{\@dtm@julianday}{\@dtm@year}{\@dtm@month}{\@dtm@day}% |
| 9008 |
\pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}% |
| 9009 |
\edef\@dtm@dow{\number\count@}% |
| 9010 |
} |
| 9011 |
% \end{macrocode} |
| 9012 |
%\end{macro} |
| 9013 |
% |
| 9014 |
% Set the current day of week |
| 9015 |
%\begin{macro}{\@dtm@currentdow} |
| 9016 |
% \begin{macrocode} |
| 9017 |
\pgfcalendardatetojulian |
| 9018 |
{\@dtm@currentyear-\@dtm@currentmonth-\@dtm@currentday}% |
| 9019 |
{\@dtm@julianday}% |
| 9020 |
\pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}% |
| 9021 |
\edef\@dtm@currentdow{\number\count@}% |
| 9022 |
% \end{macrocode} |
| 9023 |
%\end{macro} |
| 9024 |
% |
| 9025 |
%\begin{macro}{\DTMsavejulianday} |
| 9026 |
% Save the date obtained from the Julian day number. |
| 9027 |
% \begin{macrocode} |
| 9028 |
\newrobustcmd*{\DTMsavejulianday}[2]{% |
| 9029 |
\pgfcalendarjuliantodate{#2}{\@dtm@year}{\@dtm@month}{\@dtm@day}% |
| 9030 |
\pgfcalendarjuliantoweekday{#2}{\count@}% |
| 9031 |
\csedef{@dtm@#1@dow}{\number\count@}% |
| 9032 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 9033 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 9034 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 9035 |
\ifcsundef{@dtm@#1@hour}{\csdef{@dtm@#1@hour}{0}}{}% |
| 9036 |
\ifcsundef{@dtm@#1@minute}{\csdef{@dtm@#1@minute}{0}}{}% |
| 9037 |
\ifcsundef{@dtm@#1@second}{\csdef{@dtm@#1@second}{0}}{}% |
| 9038 |
\ifcsundef{@dtm@#1@TZhour}{\csdef{@dtm@#1@TZhour}{0}}{}% |
| 9039 |
\ifcsundef{@dtm@#1@TZminute}{\csdef{@dtm@#1@TZminute}{0}}{}% |
| 9040 |
} |
| 9041 |
% \end{macrocode} |
| 9042 |
%\end{macro} |
| 9043 |
% |
| 9044 |
%\begin{macro}{\DTMsaveddatetojulianday} |
| 9045 |
% Converts a saved date to a Julian day number. The first argument |
| 9046 |
% is the name referencing the saved date, the second is a count |
| 9047 |
% register in which to store the result. |
| 9048 |
% \begin{macrocode} |
| 9049 |
\newrobustcmd*{\DTMsaveddatetojulianday}[2]{% |
| 9050 |
\ifcsundef{@dtm@#1@year}% |
| 9051 |
{% |
| 9052 |
\PackageError{datetime2-calc}{Unknown date `#1'}{}% |
| 9053 |
}% |
| 9054 |
{% |
| 9055 |
\pgfcalendardatetojulian |
| 9056 |
{\csname @dtm@#1@year\endcsname |
| 9057 |
-\csname @dtm@#1@month\endcsname |
| 9058 |
-\csname @dtm@#1@day\endcsname}% |
| 9059 |
{#2}% |
| 9060 |
}% |
| 9061 |
} |
| 9062 |
% \end{macrocode} |
| 9063 |
%\end{macro} |
| 9064 |
% |
| 9065 |
%\begin{macro}{\DTMsaveddateoffsettojulianday} |
| 9066 |
% Converts an offset from the saved date to a Julian day number. |
| 9067 |
% The first argument is the name referencing the saved date, |
| 9068 |
% the second is the offset increment and the third is a count register |
| 9069 |
% in which to store the result. |
| 9070 |
% \begin{macrocode} |
| 9071 |
\newrobustcmd*{\DTMsaveddateoffsettojulianday}[3]{% |
| 9072 |
\ifcsundef{@dtm@#1@year}% |
| 9073 |
{% |
| 9074 |
\PackageError{datetime2-calc}{Unknown date `#1'}{}% |
| 9075 |
}% |
| 9076 |
{% |
| 9077 |
\pgfcalendardatetojulian |
| 9078 |
{\csname @dtm@#1@year\endcsname |
| 9079 |
-\csname @dtm@#1@month\endcsname |
| 9080 |
-\csname @dtm@#1@day\endcsname |
| 9081 |
+#2}% |
| 9082 |
{#3}% |
| 9083 |
}% |
| 9084 |
} |
| 9085 |
% \end{macrocode} |
| 9086 |
%\end{macro} |
| 9087 |
% |
| 9088 |
%\begin{macro}{\DTMifdate} |
| 9089 |
% Test a saved date using \cs{pgfcalendarifdate} |
| 9090 |
% \begin{macrocode} |
| 9091 |
\newrobustcmd*{\DTMifdate}[4]{% |
| 9092 |
\ifcsundef{@dtm@#1@year}% |
| 9093 |
{% |
| 9094 |
\PackageError{datetime2-calc}{Unknown date `#1'}{}% |
| 9095 |
}% |
| 9096 |
{% |
| 9097 |
\pgfcalendarifdate |
| 9098 |
{\csname @dtm@#1@year\endcsname |
| 9099 |
-\csname @dtm@#1@month\endcsname |
| 9100 |
-\csname @dtm@#1@day\endcsname}% |
| 9101 |
{#2}{#3}{#4}% |
| 9102 |
}% |
| 9103 |
} |
| 9104 |
% \end{macrocode} |
| 9105 |
%\end{macro} |
| 9106 |
% |
| 9107 |
%\begin{macro}{\DTMsaveddatediff} |
| 9108 |
% Computes the difference between two saved dates. The result is |
| 9109 |
% stored in the third argument, which should be a count register. |
| 9110 |
%\changes{1.5.7}{2021-03-21}{removed spurious space} |
| 9111 |
% \begin{macrocode} |
| 9112 |
\newrobustcmd*{\DTMsaveddatediff}[3]{% |
| 9113 |
\ifcsundef{@dtm@#1@year}% |
| 9114 |
{% |
| 9115 |
\PackageError{datetime2-calc}{Unknown date `#1'}{}% |
| 9116 |
}% |
| 9117 |
{% |
| 9118 |
\ifcsundef{@dtm@#2@year}% |
| 9119 |
{% |
| 9120 |
\PackageError{datetime2-calc}{Unknown date `#1'}{}% |
| 9121 |
}% |
| 9122 |
{% |
| 9123 |
\pgfcalendardatetojulian |
| 9124 |
{\csname @dtm@#1@year\endcsname |
| 9125 |
-\csname @dtm@#1@month\endcsname |
| 9126 |
-\csname @dtm@#1@day\endcsname}% |
| 9127 |
{#3}% |
| 9128 |
\pgfcalendardatetojulian |
| 9129 |
{\csname @dtm@#2@year\endcsname |
| 9130 |
-\csname @dtm@#2@month\endcsname |
| 9131 |
-\csname @dtm@#2@day\endcsname}% |
| 9132 |
{\@dtm@julianday}% |
| 9133 |
\advance#3 by -\@dtm@julianday\relax |
| 9134 |
}% |
| 9135 |
}% |
| 9136 |
} |
| 9137 |
% \end{macrocode} |
| 9138 |
%\end{macro} |
| 9139 |
% |
| 9140 |
%\begin{macro}{\DTMtozulu} |
| 9141 |
% Converts the datetime data referenced by the first argument into |
| 9142 |
% Zulu time and saves it to data referenced by the second argument. |
| 9143 |
% \begin{macrocode} |
| 9144 |
\newrobustcmd*{\DTMtozulu}[2]{% |
| 9145 |
\ifcsundef{@dtm@#1@year}% |
| 9146 |
{% |
| 9147 |
\PackageError{datetime2-calc}{Unknown date `#1'}{}% |
| 9148 |
}% |
| 9149 |
{% |
| 9150 |
\DTMsaveaszulutime{#2}% |
| 9151 |
{\DTMfetchyear{#1}}% |
| 9152 |
{\DTMfetchmonth{#1}}% |
| 9153 |
{\DTMfetchday{#1}}% |
| 9154 |
{\DTMfetchhour{#1}}% |
| 9155 |
{\DTMfetchminute{#1}}% |
| 9156 |
{\DTMfetchsecond{#1}}% |
| 9157 |
{\DTMfetchTZhour{#1}}% |
| 9158 |
{\DTMfetchTZminute{#1}}% |
| 9159 |
}% |
| 9160 |
} |
| 9161 |
% \end{macrocode} |
| 9162 |
%\end{macro} |
| 9163 |
% |
| 9164 |
%\begin{macro}{\DTMsaveaszulutime} |
| 9165 |
% Converts the given datetime into Zulu (+00:00) and saves |
| 9166 |
% the result. |
| 9167 |
%\changes{1.1}{2015-09-15}{fixed bug in incorrect conversion} |
| 9168 |
%\begin{definition} |
| 9169 |
%\cs{DTMsavetozulutime}\marg{name}\marg{year}\marg{month}\marg{day}\marg{hour}\newline\marg{minute}\marg{second}\marg{tzh}\marg{tzm} |
| 9170 |
%\end{definition} |
| 9171 |
% \begin{macrocode} |
| 9172 |
\newrobustcmd*{\DTMsaveaszulutime}[9]{% |
| 9173 |
\edef\@dtm@year{\number#2}% |
| 9174 |
\edef\@dtm@month{\number#3}% |
| 9175 |
\edef\@dtm@day{\number#4}% |
| 9176 |
\edef\@dtm@hour{\number#5}% |
| 9177 |
\edef\@dtm@minute{\number#6}% |
| 9178 |
\edef\@dtm@second{\number#7}% |
| 9179 |
\edef\@dtm@TZhour{\number#8}% |
| 9180 |
\edef\@dtm@TZminute{\number#9}% |
| 9181 |
\pgfcalendardatetojulian{\@dtm@year-\@dtm@month-\@dtm@day}{\@dtm@julianday}% |
| 9182 |
% \end{macrocode} |
| 9183 |
% First adjust the minute offset if non-zero |
| 9184 |
% \begin{macrocode} |
| 9185 |
\ifnum\@dtm@TZminute=0\relax |
| 9186 |
\else |
| 9187 |
\count@=\@dtm@minute\relax |
| 9188 |
% \end{macrocode} |
| 9189 |
% Add or subtract the offset minute |
| 9190 |
% \begin{macrocode} |
| 9191 |
\ifnum\@dtm@TZhour<0\relax |
| 9192 |
\advance\count@ by \@dtm@TZminute\relax |
| 9193 |
\else |
| 9194 |
\advance\count@ by -\@dtm@TZminute\relax |
| 9195 |
\fi |
| 9196 |
\edef\@dtm@minute{\number\count@}% |
| 9197 |
% \end{macrocode} |
| 9198 |
% Does the hour need adjusting? |
| 9199 |
% \begin{macrocode} |
| 9200 |
\ifnum\count@<0\relax |
| 9201 |
\advance\count@ by 60\relax |
| 9202 |
\edef\@dtm@minute{\number\count@}% |
| 9203 |
% \end{macrocode} |
| 9204 |
% Need to subtract 1 from the hour |
| 9205 |
% but does the day need adjusting? |
| 9206 |
% \begin{macrocode} |
| 9207 |
\ifnum\@dtm@hour=0\relax |
| 9208 |
\def\@dtm@hour{23}% |
| 9209 |
% \end{macrocode} |
| 9210 |
% Day needs adjusting. |
| 9211 |
% \begin{macrocode} |
| 9212 |
\advance\@dtm@julianday by -1\relax |
| 9213 |
\else |
| 9214 |
% \end{macrocode} |
| 9215 |
% Subtract 1 from the hour |
| 9216 |
% \begin{macrocode} |
| 9217 |
\count@ = \@dtm@hour\relax |
| 9218 |
\advance\count@ by -1\relax |
| 9219 |
\edef\@dtm@hour{\number\count@}% |
| 9220 |
\fi |
| 9221 |
\else |
| 9222 |
% \end{macrocode} |
| 9223 |
% Minute isn't negative. Is it $\ge 60$? |
| 9224 |
% \begin{macrocode} |
| 9225 |
\ifnum\count@>59\relax |
| 9226 |
\advance\count@ by -60\relax |
| 9227 |
\edef\@dtm@minute{\number\count@}% |
| 9228 |
% \end{macrocode} |
| 9229 |
% Add 1 to the hour |
| 9230 |
% \begin{macrocode} |
| 9231 |
\count@ = \@dtm@hour\relax |
| 9232 |
\advance\count@ by 1\relax |
| 9233 |
\edef\@dtm@hour{\number\count@}% |
| 9234 |
% \end{macrocode} |
| 9235 |
% Does the day need adjusting? |
| 9236 |
%\changes{1.1}{2015-09-15}{fixed bug in misnamed \cs{@dtm@hour}} |
| 9237 |
% \begin{macrocode} |
| 9238 |
\ifnum\@dtm@hour=24\relax |
| 9239 |
\def\@dtm@hour{00}% |
| 9240 |
\advance\@dtm@julianday by 1\relax |
| 9241 |
\fi |
| 9242 |
\fi |
| 9243 |
\fi |
| 9244 |
\fi |
| 9245 |
% \end{macrocode} |
| 9246 |
% Now adjust the hour offset if non-zero |
| 9247 |
% \begin{macrocode} |
| 9248 |
\ifnum\@dtm@TZhour=0\relax |
| 9249 |
\else |
| 9250 |
\count@=\@dtm@hour\relax |
| 9251 |
\advance\count@ by -\@dtm@TZhour\relax |
| 9252 |
% \end{macrocode} |
| 9253 |
% Does the day need adjusting? |
| 9254 |
% \begin{macrocode} |
| 9255 |
\ifnum\count@<0\relax |
| 9256 |
\advance\count@ by 24\relax |
| 9257 |
\edef\@dtm@hour{\number\count@}% |
| 9258 |
\advance\@dtm@julianday by -1\relax |
| 9259 |
\else |
| 9260 |
\ifnum\count@>23\relax |
| 9261 |
\advance\count@ by -24\relax |
| 9262 |
\edef\@dtm@hour{\number\count@}% |
| 9263 |
\advance\@dtm@julianday by 1\relax |
| 9264 |
\else |
| 9265 |
\edef\@dtm@hour{\number\count@}% |
| 9266 |
\fi |
| 9267 |
\fi |
| 9268 |
\fi |
| 9269 |
\pgfcalendarjuliantodate{\@dtm@julianday}{\@dtm@year}{\@dtm@month}{\@dtm@day}% |
| 9270 |
\pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}% |
| 9271 |
% \end{macrocode} |
| 9272 |
% Save the results. |
| 9273 |
% \begin{macrocode} |
| 9274 |
\csedef{@dtm@#1@dow}{\number\count@}% |
| 9275 |
\cslet{@dtm@#1@year}{\@dtm@year}% |
| 9276 |
\cslet{@dtm@#1@month}{\@dtm@month}% |
| 9277 |
\cslet{@dtm@#1@day}{\@dtm@day}% |
| 9278 |
\cslet{@dtm@#1@hour}{\@dtm@hour}% |
| 9279 |
\cslet{@dtm@#1@minute}{\@dtm@minute}% |
| 9280 |
\cslet{@dtm@#1@second}{\@dtm@second}% |
| 9281 |
\csdef{@dtm@#1@TZhour}{0}% |
| 9282 |
\csdef{@dtm@#1@TZminute}{0}% |
| 9283 |
} |
| 9284 |
% \end{macrocode} |
| 9285 |
%\end{macro} |
| 9286 |
% |
| 9287 |
%\subsection{Month and Weekday Names} |
| 9288 |
%These commands \emph{should not} be used in date styles. One of the |
| 9289 |
%reasons for replacing \sty{datetime} with \sty{datetime2} was |
| 9290 |
%caused by styles using language-variable names in language-specific |
| 9291 |
%syntax resulting in a mismatch with the syntax of one language (or |
| 9292 |
%region) with a translation of the month (and possibly weekday) name. |
| 9293 |
%These commands are provided for standalone use outside of styles. |
| 9294 |
%(Additionally, they're not expandable, which also makes them |
| 9295 |
%inappropriate for the styles that are expected to provide |
| 9296 |
%expandable dates.) |
| 9297 |
% |
| 9298 |
%\begin{macro}{\dtm@ifdianameexists} |
| 9299 |
%\changes{1.3}{2016-01-22}{new} |
| 9300 |
% \begin{macrocode} |
| 9301 |
\newcommand*{\dtm@ifdianameexists}[3]{% |
| 9302 |
\IfTrackedDialect{\languagename}% |
| 9303 |
{% |
| 9304 |
\ifcsdef{DTM\TrackedLanguageFromDialect{\languagename}#1}% |
| 9305 |
{#2}% |
| 9306 |
{#3}% |
| 9307 |
}% |
| 9308 |
{#3}% |
| 9309 |
} |
| 9310 |
% \end{macrocode} |
| 9311 |
%\end{macro} |
| 9312 |
% |
| 9313 |
%\begin{macro}{\DTMmonthname} |
| 9314 |
%\changes{1.3}{2016-01-22}{new} |
| 9315 |
% \begin{macrocode} |
| 9316 |
\newrobustcmd{\DTMmonthname}[1]{% |
| 9317 |
% \end{macrocode} |
| 9318 |
% First check if \cs{DTM\meta{language}monthname} exists. |
| 9319 |
% \begin{macrocode} |
| 9320 |
\ifcsdef{DTM\languagename monthname}% |
| 9321 |
{% |
| 9322 |
% \end{macrocode} |
| 9323 |
% It exists, so use it. |
| 9324 |
% \begin{macrocode} |
| 9325 |
\csuse{DTM\languagename monthname}{#1}% |
| 9326 |
}% |
| 9327 |
{% |
| 9328 |
% \end{macrocode} |
| 9329 |
% Try obtaining the language name from the dialect using |
| 9330 |
% \sty{tracklang}'s interface. |
| 9331 |
% \begin{macrocode} |
| 9332 |
\dtm@ifdianameexists{monthname}% |
| 9333 |
{% |
| 9334 |
% \end{macrocode} |
| 9335 |
% It exists, so use it. |
| 9336 |
% \begin{macrocode} |
| 9337 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}monthname}{#1}% |
| 9338 |
}% |
| 9339 |
{% |
| 9340 |
% \end{macrocode} |
| 9341 |
% Can't determine the language name macro. This may be because the |
| 9342 |
% actual name can't be determined or it could be because the |
| 9343 |
% relevant language module can't be loaded so use \sty{pgf}'s |
| 9344 |
% command instead, which also has limited language support. |
| 9345 |
% \begin{macrocode} |
| 9346 |
\dtmnamewarning{\DTMmonthname}% |
| 9347 |
\pgfcalendarmonthname{#1}% |
| 9348 |
}% |
| 9349 |
}% |
| 9350 |
} |
| 9351 |
% \end{macrocode} |
| 9352 |
%\end{macro} |
| 9353 |
% |
| 9354 |
%\begin{macro}{\DTMMonthname} |
| 9355 |
%\changes{1.3}{2016-01-22}{new} |
| 9356 |
% \begin{macrocode} |
| 9357 |
\newrobustcmd{\DTMMonthname}[1]{% |
| 9358 |
% \end{macrocode} |
| 9359 |
% First check if \cs{DTM\meta{language}Monthname} exists. |
| 9360 |
% \begin{macrocode} |
| 9361 |
\ifcsdef{DTM\languagename Monthname}% |
| 9362 |
{% |
| 9363 |
% \end{macrocode} |
| 9364 |
% It exists, so use it. |
| 9365 |
% \begin{macrocode} |
| 9366 |
\csuse{DTM\languagename Monthname}{#1}% |
| 9367 |
}% |
| 9368 |
{% |
| 9369 |
% \end{macrocode} |
| 9370 |
% Try obtaining the language name from the dialect using |
| 9371 |
% \sty{tracklang}'s interface. |
| 9372 |
% \begin{macrocode} |
| 9373 |
\dtm@ifdianameexists{Monthname}% |
| 9374 |
{% |
| 9375 |
% \end{macrocode} |
| 9376 |
% It exists, so use it. |
| 9377 |
% \begin{macrocode} |
| 9378 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}Monthname}{#1}% |
| 9379 |
}% |
| 9380 |
{% |
| 9381 |
% \end{macrocode} |
| 9382 |
% Can't determine the language name macro. This could be because |
| 9383 |
% there's no upper case macro as the names always start with a |
| 9384 |
% capital (like English). |
| 9385 |
% \begin{macrocode} |
| 9386 |
\ifcsdef{DTM\languagename monthname}% |
| 9387 |
{% |
| 9388 |
\csuse{DTM\languagename monthname}{#1}% |
| 9389 |
}% |
| 9390 |
{% |
| 9391 |
\dtm@ifdianameexists{monthname}% |
| 9392 |
{% |
| 9393 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}monthname}{#1}% |
| 9394 |
}% |
| 9395 |
{% |
| 9396 |
% \end{macrocode} |
| 9397 |
% Can't find no-case change version either, so use \sty{pgfcalendar} |
| 9398 |
% command instead (which will need a case-change applied). |
| 9399 |
% \begin{macrocode} |
| 9400 |
\dtmnamewarning{\DTMMonthname}% |
| 9401 |
% \end{macrocode} |
| 9402 |
% If \sty{mfirstuc} has been loaded, use it. |
| 9403 |
% \begin{macrocode} |
| 9404 |
\ifdef\emakefirstuc |
| 9405 |
{% |
| 9406 |
\emakefirstuc{\pgfcalendarmonthname{#1}}% |
| 9407 |
}% |
| 9408 |
{% |
| 9409 |
% \end{macrocode} |
| 9410 |
% Hasn't been loaded, so just expand and apply \cs{MakeUppercase}: |
| 9411 |
% \begin{macrocode} |
| 9412 |
\protected@edef\dtm@tmp@monthname{\pgfcalendarmonthname{#1}}% |
| 9413 |
\expandafter\MakeUppercase\dtm@tmp@monthname |
| 9414 |
}% |
| 9415 |
}% |
| 9416 |
}% |
| 9417 |
}% |
| 9418 |
}% |
| 9419 |
} |
| 9420 |
% \end{macrocode} |
| 9421 |
%\end{macro} |
| 9422 |
% |
| 9423 |
%\begin{macro}{\DTMshortmonthname} |
| 9424 |
%\changes{1.3}{2016-01-22}{new} |
| 9425 |
% \begin{macrocode} |
| 9426 |
\newrobustcmd{\DTMshortmonthname}[1]{% |
| 9427 |
% \end{macrocode} |
| 9428 |
% First check if \cs{DTM\meta{language}shortmonthname} exists. |
| 9429 |
% \begin{macrocode} |
| 9430 |
\ifcsdef{DTM\languagename shortmonthname}% |
| 9431 |
{% |
| 9432 |
% \end{macrocode} |
| 9433 |
% It exists, so use it. |
| 9434 |
% \begin{macrocode} |
| 9435 |
\csuse{DTM\languagename shortmonthname}{#1}% |
| 9436 |
}% |
| 9437 |
{% |
| 9438 |
% \end{macrocode} |
| 9439 |
% Try obtaining the language name from the dialect using |
| 9440 |
% \sty{tracklang}'s interface. |
| 9441 |
% \begin{macrocode} |
| 9442 |
\dtm@ifdianameexists{shortmonthname}% |
| 9443 |
{% |
| 9444 |
% \end{macrocode} |
| 9445 |
% It exists, so use it. |
| 9446 |
% \begin{macrocode} |
| 9447 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}shortmonthname}{#1}% |
| 9448 |
}% |
| 9449 |
{% |
| 9450 |
% \end{macrocode} |
| 9451 |
% Can't determine the language name macro. This may be because the |
| 9452 |
% actual name can't be determined or it could be because the |
| 9453 |
% relevant language module can't be loaded so use \sty{pgf}'s |
| 9454 |
% command instead, which also has limited language support. |
| 9455 |
% \begin{macrocode} |
| 9456 |
\dtmnamewarning{\DTMshortmonthname}% |
| 9457 |
\pgfcalendarmonthshortname{#1}% |
| 9458 |
}% |
| 9459 |
}% |
| 9460 |
} |
| 9461 |
% \end{macrocode} |
| 9462 |
%\end{macro} |
| 9463 |
% |
| 9464 |
%\begin{macro}{\DTMshortMonthname} |
| 9465 |
%\changes{1.3}{2016-01-22}{new} |
| 9466 |
% \begin{macrocode} |
| 9467 |
\newrobustcmd{\DTMshortMonthname}[1]{% |
| 9468 |
% \end{macrocode} |
| 9469 |
% First check if \cs{DTM\meta{language}shortMonthname} exists. |
| 9470 |
% \begin{macrocode} |
| 9471 |
\ifcsdef{DTM\languagename shortMonthname}% |
| 9472 |
{% |
| 9473 |
% \end{macrocode} |
| 9474 |
% It exists, so use it. |
| 9475 |
% \begin{macrocode} |
| 9476 |
\csuse{DTM\languagename shortMonthname}{#1}% |
| 9477 |
}% |
| 9478 |
{% |
| 9479 |
% \end{macrocode} |
| 9480 |
% Try obtaining the language name from the dialect using |
| 9481 |
% \sty{tracklang}'s interface. |
| 9482 |
% \begin{macrocode} |
| 9483 |
\dtm@ifdianameexists{shortMonthname}% |
| 9484 |
{% |
| 9485 |
% \end{macrocode} |
| 9486 |
% It exists, so use it. |
| 9487 |
% \begin{macrocode} |
| 9488 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}shortMonthname}{#1}% |
| 9489 |
}% |
| 9490 |
{% |
| 9491 |
% \end{macrocode} |
| 9492 |
% Can't determine the language name macro. This could be because |
| 9493 |
% there's no upper case macro as the names always start with a |
| 9494 |
% capital (like English). |
| 9495 |
% \begin{macrocode} |
| 9496 |
\ifcsdef{DTM\languagename shortmonthname}% |
| 9497 |
{% |
| 9498 |
\csuse{DTM\languagename shortmonthname}{#1}% |
| 9499 |
}% |
| 9500 |
{% |
| 9501 |
\dtm@ifdianameexists{shortmonthname}% |
| 9502 |
{% |
| 9503 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}shortmonthname}% |
| 9504 |
{#1}% |
| 9505 |
}% |
| 9506 |
{% |
| 9507 |
% \end{macrocode} |
| 9508 |
% Can't find no-case change version either, so use \sty{pgfcalendar} |
| 9509 |
% command instead (which will need a case-change applied). |
| 9510 |
% \begin{macrocode} |
| 9511 |
\dtmnamewarning{\DTMshortMonthname}% |
| 9512 |
% \end{macrocode} |
| 9513 |
% If \sty{mfirstuc} has been loaded, use it. |
| 9514 |
% \begin{macrocode} |
| 9515 |
\ifdef\emakefirstuc |
| 9516 |
{% |
| 9517 |
\emakefirstuc{\pgfcalendarmonthshortname{#1}}% |
| 9518 |
}% |
| 9519 |
{% |
| 9520 |
% \end{macrocode} |
| 9521 |
% Hasn't been loaded, so just expand and apply \cs{MakeUppercase}: |
| 9522 |
% \begin{macrocode} |
| 9523 |
\protected@edef\dtm@tmp@monthname{\pgfcalendarmonthshortname{#1}}% |
| 9524 |
\expandafter\MakeUppercase\dtm@tmp@monthname |
| 9525 |
}% |
| 9526 |
}% |
| 9527 |
}% |
| 9528 |
}% |
| 9529 |
}% |
| 9530 |
} |
| 9531 |
% \end{macrocode} |
| 9532 |
%\end{macro} |
| 9533 |
% |
| 9534 |
%\begin{macro}{\DTMcomputedayofweekindex} |
| 9535 |
%\begin{definition} |
| 9536 |
%\cs{DTMcomputedayofweekindex}\marg{date}\marg{cs} |
| 9537 |
%\end{definition} |
| 9538 |
% This is for standalone use and shouldn't be used in any date |
| 9539 |
% styles (since the day of week index is already supplied). |
| 9540 |
% The result is stored in the supplied control sequence. |
| 9541 |
%\changes{1.4}{2016-02-11}{new} |
| 9542 |
% \begin{macrocode} |
| 9543 |
\newrobustcmd*{\DTMcomputedayofweekindex}[2]{% |
| 9544 |
\pgfcalendardatetojulian{#1}{\@dtm@julianday}% |
| 9545 |
\pgfcalendarjuliantoweekday{\@dtm@julianday}{\count@}% |
| 9546 |
\edef#2{\number\count@}% |
| 9547 |
} |
| 9548 |
% \end{macrocode} |
| 9549 |
%\end{macro} |
| 9550 |
% |
| 9551 |
%These are shared with the \sty{locale} package, so they may already |
| 9552 |
%be defined. |
| 9553 |
%\begin{macro}{\dtmMondayIndex} |
| 9554 |
%\changes{1.5.3}{2018-07-20}{new} |
| 9555 |
% \begin{macrocode} |
| 9556 |
\def\dtmMondayIndex{0} |
| 9557 |
% \end{macrocode} |
| 9558 |
%\end{macro} |
| 9559 |
% |
| 9560 |
%\begin{macro}{\dtmTuesdayIndex} |
| 9561 |
%\changes{1.5.3}{2018-07-20}{new} |
| 9562 |
% \begin{macrocode} |
| 9563 |
\def\dtmTuesdayIndex{1} |
| 9564 |
% \end{macrocode} |
| 9565 |
%\end{macro} |
| 9566 |
% |
| 9567 |
%\begin{macro}{\dtmWednesdayIndex} |
| 9568 |
%\changes{1.5.3}{2018-07-20}{new} |
| 9569 |
% \begin{macrocode} |
| 9570 |
\def\dtmWednesdayIndex{2} |
| 9571 |
% \end{macrocode} |
| 9572 |
%\end{macro} |
| 9573 |
% |
| 9574 |
%\begin{macro}{\dtmThursdayIndex} |
| 9575 |
%\changes{1.5.3}{2018-07-20}{new} |
| 9576 |
% \begin{macrocode} |
| 9577 |
\def\dtmThursdayIndex{3} |
| 9578 |
% \end{macrocode} |
| 9579 |
%\end{macro} |
| 9580 |
% |
| 9581 |
%\begin{macro}{\dtmFridayIndex} |
| 9582 |
%\changes{1.5.3}{2018-07-20}{new} |
| 9583 |
% \begin{macrocode} |
| 9584 |
\def\dtmFridayIndex{4} |
| 9585 |
% \end{macrocode} |
| 9586 |
%\end{macro} |
| 9587 |
% |
| 9588 |
%\begin{macro}{\dtmSaturdayIndex} |
| 9589 |
%\changes{1.5.3}{2018-07-20}{new} |
| 9590 |
% \begin{macrocode} |
| 9591 |
\def\dtmSaturdayIndex{5} |
| 9592 |
% \end{macrocode} |
| 9593 |
%\end{macro} |
| 9594 |
% |
| 9595 |
%\begin{macro}{\dtmSundayIndex} |
| 9596 |
%\changes{1.5.3}{2018-07-20}{new} |
| 9597 |
% \begin{macrocode} |
| 9598 |
\def\dtmSundayIndex{6} |
| 9599 |
% \end{macrocode} |
| 9600 |
%\end{macro} |
| 9601 |
% |
| 9602 |
%\begin{macro}{\DTMweekdayname} |
| 9603 |
%\changes{1.3}{2016-01-22}{new} |
| 9604 |
% \begin{macrocode} |
| 9605 |
\newrobustcmd{\DTMweekdayname}[1]{% |
| 9606 |
% \end{macrocode} |
| 9607 |
% First check if \cs{DTM\meta{language}weekdayname} exists. |
| 9608 |
% \begin{macrocode} |
| 9609 |
\ifcsdef{DTM\languagename weekdayname}% |
| 9610 |
{% |
| 9611 |
% \end{macrocode} |
| 9612 |
% It exists, so use it. |
| 9613 |
% \begin{macrocode} |
| 9614 |
\csuse{DTM\languagename weekdayname}{#1}% |
| 9615 |
}% |
| 9616 |
{% |
| 9617 |
% \end{macrocode} |
| 9618 |
% Try obtaining the language name from the dialect using |
| 9619 |
% \sty{tracklang}'s interface. |
| 9620 |
% \begin{macrocode} |
| 9621 |
\dtm@ifdianameexists{weekdayname}% |
| 9622 |
{% |
| 9623 |
% \end{macrocode} |
| 9624 |
% It exists, so use it. |
| 9625 |
% \begin{macrocode} |
| 9626 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}weekdayname}{#1}% |
| 9627 |
}% |
| 9628 |
{% |
| 9629 |
% \end{macrocode} |
| 9630 |
% Can't determine the language name macro. This may be because the |
| 9631 |
% actual name can't be determined or it could be because the |
| 9632 |
% relevant language module can't be loaded so use \sty{pgf}'s |
| 9633 |
% command instead, which also has limited language support. |
| 9634 |
% \begin{macrocode} |
| 9635 |
\dtmnamewarning{\DTMweekdayname}% |
| 9636 |
\pgfcalendarweekdayname{#1}% |
| 9637 |
}% |
| 9638 |
}% |
| 9639 |
} |
| 9640 |
% \end{macrocode} |
| 9641 |
%\end{macro} |
| 9642 |
% |
| 9643 |
%\begin{macro}{\DTMWeekdayname} |
| 9644 |
%\changes{1.3}{2016-01-22}{new} |
| 9645 |
% \begin{macrocode} |
| 9646 |
\newrobustcmd{\DTMWeekdayname}[1]{% |
| 9647 |
% \end{macrocode} |
| 9648 |
% First check if \cs{DTM\meta{language}Weekdayname} exists. |
| 9649 |
% \begin{macrocode} |
| 9650 |
\ifcsdef{DTM\languagename Weekdayname}% |
| 9651 |
{% |
| 9652 |
% \end{macrocode} |
| 9653 |
% It exists, so use it. |
| 9654 |
% \begin{macrocode} |
| 9655 |
\csuse{DTM\languagename Weekdayname}{#1}% |
| 9656 |
}% |
| 9657 |
{% |
| 9658 |
% \end{macrocode} |
| 9659 |
% Try obtaining the language name from the dialect using |
| 9660 |
% \sty{tracklang}'s interface. |
| 9661 |
% \begin{macrocode} |
| 9662 |
\dtm@ifdianameexists{Weekdayname}% |
| 9663 |
{% |
| 9664 |
% \end{macrocode} |
| 9665 |
% It exists, so use it. |
| 9666 |
% \begin{macrocode} |
| 9667 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}Weekdayname}{#1}% |
| 9668 |
}% |
| 9669 |
{% |
| 9670 |
% \end{macrocode} |
| 9671 |
% Can't determine the language name macro. This could be because |
| 9672 |
% there's no upper case macro as the names always start with a |
| 9673 |
% capital (like English). |
| 9674 |
% \begin{macrocode} |
| 9675 |
\ifcsdef{DTM\languagename weekdayname}% |
| 9676 |
{% |
| 9677 |
\csuse{DTM\languagename weekdayname}{#1}% |
| 9678 |
}% |
| 9679 |
{% |
| 9680 |
\dtm@ifdianameexists{weekdayname}% |
| 9681 |
{% |
| 9682 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}weekdayname}{#1}% |
| 9683 |
}% |
| 9684 |
{% |
| 9685 |
% \end{macrocode} |
| 9686 |
% Can't find no-case change version either, so use \sty{pgfcalendar} |
| 9687 |
% command instead (which will need a case-change applied). |
| 9688 |
% \begin{macrocode} |
| 9689 |
\dtmnamewarning{\DTMWeekdayname}% |
| 9690 |
% \end{macrocode} |
| 9691 |
% If \sty{mfirstuc} has been loaded, use it. |
| 9692 |
% \begin{macrocode} |
| 9693 |
\ifdef\emakefirstuc |
| 9694 |
{% |
| 9695 |
\emakefirstuc{\pgfcalendarweekdayname{#1}}% |
| 9696 |
}% |
| 9697 |
{% |
| 9698 |
% \end{macrocode} |
| 9699 |
% Hasn't been loaded, so just expand and apply \cs{MakeUppercase}: |
| 9700 |
% \begin{macrocode} |
| 9701 |
\protected@edef\dtm@tmp@weekdayname{\pgfcalendarweekdayname{#1}}% |
| 9702 |
\expandafter\MakeUppercase\dtm@tmp@weekdayname |
| 9703 |
}% |
| 9704 |
}% |
| 9705 |
}% |
| 9706 |
}% |
| 9707 |
}% |
| 9708 |
} |
| 9709 |
% \end{macrocode} |
| 9710 |
%\end{macro} |
| 9711 |
% |
| 9712 |
%\begin{macro}{\DTMshortweekdayname} |
| 9713 |
%\changes{1.3}{2016-01-22}{new} |
| 9714 |
% \begin{macrocode} |
| 9715 |
\newrobustcmd{\DTMshortweekdayname}[1]{% |
| 9716 |
% \end{macrocode} |
| 9717 |
% First check if \cs{DTM\meta{language}shortweekdayname} exists. |
| 9718 |
% \begin{macrocode} |
| 9719 |
\ifcsdef{DTM\languagename shortweekdayname}% |
| 9720 |
{% |
| 9721 |
% \end{macrocode} |
| 9722 |
% It exists, so use it. |
| 9723 |
% \begin{macrocode} |
| 9724 |
\csuse{DTM\languagename shortweekdayname}{#1}% |
| 9725 |
}% |
| 9726 |
{% |
| 9727 |
% \end{macrocode} |
| 9728 |
% Try obtaining the language name from the dialect using |
| 9729 |
% \sty{tracklang}'s interface. |
| 9730 |
% \begin{macrocode} |
| 9731 |
\dtm@ifdianameexists{shortweekdayname}% |
| 9732 |
{% |
| 9733 |
% \end{macrocode} |
| 9734 |
% It exists, so use it. |
| 9735 |
% \begin{macrocode} |
| 9736 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}shortweekdayname}{#1}% |
| 9737 |
}% |
| 9738 |
{% |
| 9739 |
% \end{macrocode} |
| 9740 |
% Can't determine the language name macro. This may be because the |
| 9741 |
% actual name can't be determined or it could be because the |
| 9742 |
% relevant language module can't be loaded so use \sty{pgf}'s |
| 9743 |
% command instead, which also has limited language support. |
| 9744 |
% \begin{macrocode} |
| 9745 |
\dtmnamewarning{\DTMshortweekdayname}% |
| 9746 |
\pgfcalendarweekdayshortname{#1}% |
| 9747 |
}% |
| 9748 |
}% |
| 9749 |
} |
| 9750 |
% \end{macrocode} |
| 9751 |
%\end{macro} |
| 9752 |
% |
| 9753 |
%\begin{macro}{\DTMshortWeekdayname} |
| 9754 |
%\changes{1.3}{2016-01-22}{new} |
| 9755 |
% \begin{macrocode} |
| 9756 |
\newrobustcmd{\DTMshortWeekdayname}[1]{% |
| 9757 |
% \end{macrocode} |
| 9758 |
% First check if \cs{DTM\meta{language}shortWeekdayname} exists. |
| 9759 |
% \begin{macrocode} |
| 9760 |
\ifcsdef{DTM\languagename shortWeekdayname}% |
| 9761 |
{% |
| 9762 |
% \end{macrocode} |
| 9763 |
% It exists, so use it. |
| 9764 |
% \begin{macrocode} |
| 9765 |
\csuse{DTM\languagename shortWeekdayname}{#1}% |
| 9766 |
}% |
| 9767 |
{% |
| 9768 |
% \end{macrocode} |
| 9769 |
% Try obtaining the language name from the dialect using |
| 9770 |
% \sty{tracklang}'s interface. |
| 9771 |
% \begin{macrocode} |
| 9772 |
\dtm@ifdianameexists{shortWeekdayname}% |
| 9773 |
{% |
| 9774 |
% \end{macrocode} |
| 9775 |
% It exists, so use it. |
| 9776 |
% \begin{macrocode} |
| 9777 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}shortWeekdayname}{#1}% |
| 9778 |
}% |
| 9779 |
{% |
| 9780 |
% \end{macrocode} |
| 9781 |
% Can't determine the language name macro. This could be because |
| 9782 |
% there's no upper case macro as the names always start with a |
| 9783 |
% capital (like English). |
| 9784 |
% \begin{macrocode} |
| 9785 |
\ifcsdef{DTM\languagename shortweekdayname}% |
| 9786 |
{% |
| 9787 |
\csuse{DTM\languagename shortweekdayname}{#1}% |
| 9788 |
}% |
| 9789 |
{% |
| 9790 |
\dtm@ifdianameexists{shortweekdayname}% |
| 9791 |
{% |
| 9792 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}shortweekdayname}% |
| 9793 |
{#1}% |
| 9794 |
}% |
| 9795 |
{% |
| 9796 |
% \end{macrocode} |
| 9797 |
% Can't find no-case change version either, so use \sty{pgfcalendar} |
| 9798 |
% command instead (which will need a case-change applied). |
| 9799 |
% \begin{macrocode} |
| 9800 |
\dtmnamewarning{\DTMshortWeekdayname}% |
| 9801 |
% \end{macrocode} |
| 9802 |
% If \sty{mfirstuc} has been loaded, use it. |
| 9803 |
% \begin{macrocode} |
| 9804 |
\ifdef\emakefirstuc |
| 9805 |
{% |
| 9806 |
\emakefirstuc{\pgfcalendarweekdayshortname{#1}}% |
| 9807 |
}% |
| 9808 |
{% |
| 9809 |
% \end{macrocode} |
| 9810 |
% Hasn't been loaded, so just expand and apply \cs{MakeUppercase}: |
| 9811 |
% \begin{macrocode} |
| 9812 |
\protected@edef\dtm@tmp@weekdayname{% |
| 9813 |
\pgfcalendarweekdayshortname{#1}}% |
| 9814 |
\expandafter\MakeUppercase\dtm@tmp@weekdayname |
| 9815 |
}% |
| 9816 |
}% |
| 9817 |
}% |
| 9818 |
}% |
| 9819 |
}% |
| 9820 |
} |
| 9821 |
% \end{macrocode} |
| 9822 |
%\end{macro} |
| 9823 |
% |
| 9824 |
%\begin{macro}{\DTMordinal} |
| 9825 |
%\changes{1.3}{2016-01-22}{new} |
| 9826 |
% \begin{macrocode} |
| 9827 |
\newrobustcmd{\DTMordinal}[1]{% |
| 9828 |
% \end{macrocode} |
| 9829 |
% First check if \cs{DTM\meta{language}ordinal} exists. |
| 9830 |
% \begin{macrocode} |
| 9831 |
\ifcsdef{DTM\languagename ordinal}% |
| 9832 |
{% |
| 9833 |
% \end{macrocode} |
| 9834 |
% It exists, so use it. |
| 9835 |
% \begin{macrocode} |
| 9836 |
\csuse{DTM\languagename ordinal}{#1}% |
| 9837 |
}% |
| 9838 |
{% |
| 9839 |
% \end{macrocode} |
| 9840 |
% Try obtaining the language name from the dialect using |
| 9841 |
% \sty{tracklang}'s interface. |
| 9842 |
% \begin{macrocode} |
| 9843 |
\dtm@ifdianameexists{ordinal}% |
| 9844 |
{% |
| 9845 |
% \end{macrocode} |
| 9846 |
% It exists, so use it. |
| 9847 |
% \begin{macrocode} |
| 9848 |
\csuse{DTM\TrackedLanguageFromDialect{\languagename}ordinal}{#1}% |
| 9849 |
}% |
| 9850 |
{% |
| 9851 |
% \end{macrocode} |
| 9852 |
% Can't determine the language name macro. This may be because the |
| 9853 |
% actual name can't be determined or it could be because the |
| 9854 |
% relevant language module can't be loaded so just display the |
| 9855 |
% number. |
| 9856 |
% \begin{macrocode} |
| 9857 |
\number#1 |
| 9858 |
}% |
| 9859 |
}% |
| 9860 |
} |
| 9861 |
% \end{macrocode} |
| 9862 |
%\end{macro} |
| 9863 |
% |
| 9864 |
%\begin{macro}{\dtmnamewarning} |
| 9865 |
%\changes{1.3}{2016-01-22}{new} |
| 9866 |
% Issue warning unless warnings have been suppressed. |
| 9867 |
% \begin{macrocode} |
| 9868 |
\newcommand*{\dtmnamewarning}[1]{% |
| 9869 |
\if@dtm@warn |
| 9870 |
\PackageWarning{datetime2-calc}% |
| 9871 |
{Can't find underlying language macro for \MessageBreak |
| 9872 |
\string#1\space(language: \languagename); \MessageBreak |
| 9873 |
using pgfcalendar macro instead}% |
| 9874 |
\fi |
| 9875 |
} |
| 9876 |
% \end{macrocode} |
| 9877 |
%\end{macro} |
| 9878 |
%\iffalse |
| 9879 |
% \begin{macrocode} |
| 9880 |
%</datetime2-calc.sty> |
| 9881 |
% \end{macrocode} |
| 9882 |
%\fi |
| 9883 |
%\Finale |
| 9884 |
\endinput |