summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/datetime2-french/datetime2-french.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/datetime2-french/datetime2-french.dtx')
-rw-r--r--Master/texmf-dist/source/latex/datetime2-french/datetime2-french.dtx536
1 files changed, 471 insertions, 65 deletions
diff --git a/Master/texmf-dist/source/latex/datetime2-french/datetime2-french.dtx b/Master/texmf-dist/source/latex/datetime2-french/datetime2-french.dtx
index 96f0075eb53..ffcce39e15d 100644
--- a/Master/texmf-dist/source/latex/datetime2-french/datetime2-french.dtx
+++ b/Master/texmf-dist/source/latex/datetime2-french/datetime2-french.dtx
@@ -20,7 +20,7 @@
% \iffalse
% Doc-Source file to use with LaTeX2e
% Copyright (C) 2015 Nicola Talbot, all rights reserved.
-% (New maintainer add relevant lines here.)
+% Copyright (C) 2017 Paul A. Patience <pap@papatience.com>, all rights reserved.
% \fi
% \iffalse
%<*driver>
@@ -33,11 +33,11 @@
\usepackage[colorlinks,
bookmarks,
hyperindex=false,
- pdfauthor={Nicola L.C. Talbot},
+ pdfauthor={Nicola L.C. Talbot and Paul A. Patience},
pdftitle={datetime2.sty French Module}]{hyperref}
-\CheckSum{333}
+\CheckSum{580}
\renewcommand*{\usage}[1]{\hyperpage{#1}}
\renewcommand*{\main}[1]{\hyperpage{#1}}
@@ -60,14 +60,11 @@
%\MakeShortVerb{"}
%
%\title{French Module for datetime2 Package}
-%\author{Nicola L. C. Talbot (inactive)}
-%\date{2015-03-27 (v1.0)}
+%\author{Nicola L. C. Talbot (inactive) \\
+% Paul A. Patience\thanks{E-mail: pap@papatience.com}}
+%\date{2017-04-08 (v1.02)}
%\maketitle
%
-%This module is currently unmaintained and may be subject to change.
-%If you want to volunteer to take over maintanance, contact me at
-%\url{http://www.dickimaw-books.com/contact.html}
-%
%\begin{abstract}
%This is the French language module for the \sty{datetime2}
%package. If you want to use the settings in this module you must
@@ -81,27 +78,6 @@
% depending on the value of the \opt{useregional} setting.
%\end{abstract}
%
-%I've copied the date style from \texttt{babel-french}'s \cs{today}.
-%
-%I don't know if these settings are correct.
-%In particular, I don't know if the "french" time style is
-%correct. Currently this just uses the "default" time style. Please
-%be aware that this may change. Whoever takes over maintanance
-%of this module may can change it as appropriate.
-%
-%The new maintainer should add the line:
-%\begin{verbatim}
-% The Current Maintainer of this work is Name.
-%\end{verbatim}
-%to the preamble part in \texttt{datetime2-french.ins} where Name
-%is the name of the maintainer(s) and replace
-%the `inactive' status to `maintained'.
-%
-%Currently there is only a regionless style. New maintainers may
-%want to add regional variants such as "fr-FR"\slash"fr-FR-numeric"
-%or "fr-BE"\slash"fr-BE-numeric". This style currently doesn't check the
-%\opt{showdow} setting.
-%
%\StopEventually{%
%\clearpage
%\phantomsection
@@ -122,7 +98,7 @@
%\changes{1.0}{2015-03-27}{Initial release}
% Identify module
% \begin{macrocode}
-\ProvidesDateTimeModule{french-utf8}[2015/03/27 v1.0]
+\ProvidesDateTimeModule{french-utf8}[2017/04/08 v1.02]
% \end{macrocode}
%\begin{macro}{\DTMfrenchordinal}
% \begin{macrocode}
@@ -210,11 +186,77 @@
% \end{macrocode}
%\end{macro}
%
-%If abbreviated dates are supported, short month names should be
-%likewise provided.
+%\begin{macro}{\DTMfrenchshortmonthname}
+% Abbreviated French month names.
+%\changes{1.01}{2017-04-08}{Add abbreviated month names}
+% \begin{macrocode}
+\newcommand*{\DTMfrenchshortmonthname}[1]{%
+ \ifcase#1
+ \or
+ janv.%
+ \or
+ févr.%
+ \or
+ mars%
+ \or
+ avr.%
+ \or
+ mai%
+ \or
+ juin%
+ \or
+ juill.%
+ \or
+ août%
+ \or
+ sept.%
+ \or
+ oct.%
+ \or
+ nov.%
+ \or
+ déc.%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchshortMonthname}
+% As above but start with a capital.
+% \begin{macrocode}
+\newcommand*{\DTMfrenchshortMonthname}[1]{%
+ \ifcase#1
+ \or
+ Janv.%
+ \or
+ Févr.%
+ \or
+ Mars%
+ \or
+ Avr.%
+ \or
+ Mai%
+ \or
+ Juin%
+ \or
+ Juill.%
+ \or
+ Août%
+ \or
+ Sept.%
+ \or
+ Oct.%
+ \or
+ Nov.%
+ \or
+ Déc.%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
%
%\begin{macro}{\DTMfrenchweekdayname}
-%These are provided here but not currently used in the date format.
+% French day of week names.
% \begin{macrocode}
\newcommand*{\DTMfrenchweekdayname}[1]{%
\ifcase#1
@@ -237,7 +279,7 @@
%\end{macro}
%
%\begin{macro}{\DTMfrenchWeekdayname}
-%As above but start with a capital.
+% As above but start with a capital.
% \begin{macrocode}
\newcommand*{\DTMfrenchWeekdayname}[1]{%
\ifcase#1
@@ -259,6 +301,112 @@
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\DTMfrenchshortweekdayname}
+% French abbreviated day of week names.
+%\changes{1.01}{2017-04-08}{Add abbreviated day of week names}
+% \begin{macrocode}
+\newcommand*{\DTMfrenchshortweekdayname}[1]{%
+ \ifcase#1
+ lun.%
+ \or
+ mar.%
+ \or
+ mer.%
+ \or
+ jeu.%
+ \or
+ ven.%
+ \or
+ sam.%
+ \or
+ dim.%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchshortWeekdayname}
+% As above but start with a capital.
+% \begin{macrocode}
+\newcommand*{\DTMfrenchshortWeekdayname}[1]{%
+ \ifcase#1
+ Lun.%
+ \or
+ Mar.%
+ \or
+ Mer.%
+ \or
+ Jeu.%
+ \or
+ Ven.%
+ \or
+ Sam.%
+ \or
+ Dim.%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchmidnight}
+% \begin{macrocode}
+\newcommand*\DTMfrenchmidnight{minuit}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchnoon}
+% \begin{macrocode}
+\newcommand*\DTMfrenchnoon{midi}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchtimesymsep}
+% \begin{macrocode}
+\newcommand*\DTMfrenchtimesymsep{\,}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchhoursym}
+% \begin{macrocode}
+\newcommand*\DTMfrenchhoursym{h}%
+% \end{macrocode}
+%\end{macro}
+%
+% This style ignores seconds.
+%\changes{1.01}{2017-04-08}{Add frenchalpha time style}
+% \begin{macrocode}
+\DTMnewtimestyle
+ {frenchalpha}% label
+ {%
+ \renewcommand*\DTMdisplaytime[3]{%
+ \ifnum##2=0
+ \ifnum##1=12
+ \DTMfrenchnoon
+ \else
+ \ifnum##1=0
+ \DTMfrenchmidnight
+ \else
+ \ifnum##1=24
+ \DTMfrenchmidnight
+ \else
+ \number##1
+ \DTMfrenchtimesymsep\DTMfrenchhoursym
+ \fi
+ \fi
+ \fi
+ \else
+ \ifnum##1=24
+ 0%
+ \else
+ \number##1
+ \fi
+ \DTMfrenchtimesymsep\DTMfrenchhoursym
+ \DTMfrenchtimesymsep\DTMtwodigits{##2}%
+ \fi
+ }%
+ }%
+% \end{macrocode}
+%
%\iffalse
% \begin{macrocode}
%</datetime2-french-utf8.ldf>
@@ -280,11 +428,9 @@
%\changes{1.0}{2015-03-27}{Initial release}
% Identify module
% \begin{macrocode}
-\ProvidesDateTimeModule{french-ascii}[2015/03/27 v1.0]
+\ProvidesDateTimeModule{french-ascii}[2017/04/08 v1.02]
% \end{macrocode}
%
-%If abbreviated dates are supported, short month names should be
-%likewise provided.
%\begin{macro}{\DTMfrenchordinal}
% \begin{macrocode}
\ifdef\ier
@@ -371,8 +517,77 @@
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\DTMfrenchshortmonthname}
+% Abbreviated French month names.
+%\changes{1.01}{2017-04-08}{Add abbreviated month names}
+% \begin{macrocode}
+\newcommand*{\DTMfrenchshortmonthname}[1]{%
+ \ifcase#1
+ \or
+ janv.%
+ \or
+ f\protect\'evr.%
+ \or
+ mars%
+ \or
+ avr.%
+ \or
+ mai%
+ \or
+ juin%
+ \or
+ juill.%
+ \or
+ ao\protect\^ut%
+ \or
+ sept.%
+ \or
+ oct.%
+ \or
+ nov.%
+ \or
+ d\protect\'ec.%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchshortMonthname}
+% As above but start with a capital.
+% \begin{macrocode}
+\newcommand*{\DTMfrenchshortMonthname}[1]{%
+ \ifcase#1
+ \or
+ Janv.%
+ \or
+ F\protect\'evr.%
+ \or
+ Mars%
+ \or
+ Avr.%
+ \or
+ Mai%
+ \or
+ Juin%
+ \or
+ Juill.%
+ \or
+ Ao\protect\^ut%
+ \or
+ Sept.%
+ \or
+ Oct.%
+ \or
+ Nov.%
+ \or
+ D\protect\'ec.%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\DTMfrenchweekdayname}
-%These are provided here but not currently used in the date format.
+% French day of week names.
% \begin{macrocode}
\newcommand*{\DTMfrenchweekdayname}[1]{%
\ifcase#1
@@ -395,7 +610,7 @@
%\end{macro}
%
%\begin{macro}{\DTMfrenchWeekdayname}
-%As above but start with a capital.
+% As above but start with a capital.
% \begin{macrocode}
\newcommand*{\DTMfrenchWeekdayname}[1]{%
\ifcase#1
@@ -417,6 +632,111 @@
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\DTMfrenchshortweekdayname}
+% French abbreviated day of week names.
+%\changes{1.01}{2017-04-08}{Add abbreviated day of week names}
+% \begin{macrocode}
+\newcommand*{\DTMfrenchshortweekdayname}[1]{%
+ \ifcase#1
+ lun.%
+ \or
+ mar.%
+ \or
+ mer.%
+ \or
+ jeu.%
+ \or
+ ven.%
+ \or
+ sam.%
+ \or
+ dim.%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchshortWeekdayname}
+% As above but start with a capital.
+% \begin{macrocode}
+\newcommand*{\DTMfrenchshortWeekdayname}[1]{%
+ \ifcase#1
+ Lun.%
+ \or
+ Mar.%
+ \or
+ Mer.%
+ \or
+ Jeu.%
+ \or
+ Ven.%
+ \or
+ Sam.%
+ \or
+ Dim.%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchmidnight}
+% \begin{macrocode}
+\newcommand*\DTMfrenchmidnight{minuit}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchnoon}
+% \begin{macrocode}
+\newcommand*\DTMfrenchnoon{midi}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchtimesymsep}
+% \begin{macrocode}
+\newcommand*\DTMfrenchtimesymsep{\,}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTMfrenchhoursym}
+% \begin{macrocode}
+\newcommand*\DTMfrenchhoursym{h}%
+% \end{macrocode}
+%\end{macro}
+%
+% This style ignores seconds.
+%\changes{1.01}{2017-04-08}{Add frenchalpha time style}
+% \begin{macrocode}
+\DTMnewtimestyle
+ {frenchalpha}% label
+ {%
+ \renewcommand*\DTMdisplaytime[3]{%
+ \ifnum##2=0
+ \ifnum##1=12
+ \DTMfrenchnoon
+ \else
+ \ifnum##1=0
+ \DTMfrenchmidnight
+ \else
+ \ifnum##1=24
+ \DTMfrenchmidnight
+ \else
+ \number##1
+ \DTMfrenchtimesymsep\DTMfrenchhoursym
+ \fi
+ \fi
+ \fi
+ \else
+ \ifnum##1=24
+ 0%
+ \else
+ \number##1
+ \fi
+ \DTMfrenchtimesymsep\DTMfrenchhoursym
+ \DTMfrenchtimesymsep\DTMtwodigits{##2}%
+ \fi
+ }%
+ }%
+% \end{macrocode}
%
%\iffalse
% \begin{macrocode}
@@ -435,7 +755,7 @@
%
% Identify Module
% \begin{macrocode}
-\ProvidesDateTimeModule{french}[2015/03/27 v1.0]
+\ProvidesDateTimeModule{french}[2017/04/08 v1.02]
% \end{macrocode}
% Need to find out if XeTeX or LuaTeX are being used.
% \begin{macrocode}
@@ -458,16 +778,29 @@
%
% Define the \texttt{french} style.
% The time style is the same as the "default" style
-% provided by \sty{datetime2}. This may need correcting.
+% provided by \sty{datetime2}. This may need correcting.
%
% Allow the user a way of configuring the "french" and
% "french-numeric" styles. This doesn't use the package wide
% separators such as
% \cs{dtm@datetimesep} in case other date formats are also required.
+%
+%\begin{macro}{\DTMfrenchdowdaysep}
+% The separator between the day of week name and the day of month
+% number for the text format.
+%\changes{1.01}{2017-04-08}{Add support for showdow}
+% \begin{macrocode}
+\newcommand*{\DTMfrenchdowdaysep}{\space}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\DTMfrenchdaymonthsep}
% The separator between the day and month for the text format.
+%\changes{1.02}{2017-04-08}{Use non-breaking space}
% \begin{macrocode}
-\newcommand*{\DTMfrenchdaymonthsep}{\space}
+\newcommand*{\DTMfrenchdaymonthsep}{%
+ \DTMtexorpdfstring{\protect~}{\space}%
+}
% \end{macrocode}
%\end{macro}
%
@@ -482,7 +815,7 @@
% The separator between the date and time blocks in the full format
% (either text or numeric).
% \begin{macrocode}
-\newcommand*{\DTMfrenchdatetimesep}{\space}
+\newcommand*{\DTMfrenchdatetimesep}{,\space}
% \end{macrocode}
%\end{macro}
%
@@ -511,6 +844,7 @@
%Provide keys that can be used in \cs{DTMlangsetup} to set these
%separators.
% \begin{macrocode}
+\DTMdefkey{french}{dowdaysep}{\renewcommand*{\DTMfrenchdowdaysep}{#1}}
\DTMdefkey{french}{daymonthsep}{\renewcommand*{\DTMfrenchdaymonthsep}{#1}}
\DTMdefkey{french}{monthyearsep}{\renewcommand*{\DTMfrenchmonthyearsep}{#1}}
\DTMdefkey{french}{datetimesep}{\renewcommand*{\DTMfrenchdatetimesep}{#1}}
@@ -519,9 +853,16 @@
\DTMdefkey{french}{timesep}{\renewcommand*{\DTMfrenchtimesep}{#1}}
% \end{macrocode}
%
-% TODO: provide a boolean key to switch between full and abbreviated
-% formats if appropriate. (I don't know how the date should be
-% abbreviated.)
+% Define a boolean key that can switch between full and abbreviated
+% formats for the month and day of week names in the text format.
+%\changes{1.01}{2017-04-08}{Add support for abbr}
+% \begin{macrocode}
+\DTMdefboolkey{french}{abbr}[true]{}
+% \end{macrocode}
+% The default is the full name.
+% \begin{macrocode}
+\DTMsetbool{french}{abbr}{false}
+% \end{macrocode}
%
% Define a boolean key that determines if the time zone mappings
% should be used.
@@ -553,30 +894,30 @@
\DTMsetbool{french}{showyear}{true}
% \end{macrocode}
%
-% Define the "french" style. (TODO: implement day of week?)
+% Define the "french" style.
+%\changes{1.01}{2017-04-08}{Add support for abbr and showdow}
% \begin{macrocode}
\DTMnewstyle
{french}% label
{% date style
\renewcommand*\DTMdisplaydate[4]{%
- \DTMifbool{french}{showdayofmonth}
- {\DTMfrenchordinal{##3}\DTMfrenchdaymonthsep}%
- {}%
- \DTMfrenchmonthname{##2}%
- \DTMifbool{french}{showyear}%
+ \ifDTMshowdow
+ \ifnum##4>-1
+ \DTMifbool{french}{abbr}%
+ {\DTMfrenchshortweekdayname{##4}}%
+ {\DTMfrenchweekdayname{##4}}%
+ \DTMfrenchdowdaysep
+ \fi
+ \fi
+ \DTMifbool{french}{showdayofmonth}%
{%
- \DTMfrenchmonthyearsep
- \number##1 % space intended
+ \DTMfrenchordinal{##3}%
+ \DTMfrenchdaymonthsep
}%
{}%
- }%
- \renewcommand*\DTMDisplaydate[4]{%
- \DTMifbool{french}{showdayofmonth}
- {%
- \DTMfrenchordinal{##3}\DTMfrenchdaymonthsep
- \DTMfrenchmonthname{##2}%
- }%
- {\DTMfrenchMonthname{##2}}%
+ \DTMifbool{french}{abbr}%
+ {\DTMfrenchshortmonthname{##2}}%
+ {\DTMfrenchmonthname{##2}}%
\DTMifbool{french}{showyear}%
{%
\DTMfrenchmonthyearsep
@@ -584,9 +925,74 @@
}%
{}%
}%
+ \renewcommand*\DTMDisplaydate[4]{%
+ \ifDTMshowdow
+ \ifnum##4>-1
+ \DTMifbool{french}{abbr}%
+ {\DTMfrenchshortWeekdayname{##4}}%
+ {\DTMfrenchWeekdayname{##4}}%
+ \DTMfrenchdowdaysep
+ \DTMifbool{french}{showdayofmonth}%
+ {%
+ \DTMfrenchordinal{##3}%
+ \DTMfrenchdaymonthsep
+ }%
+ {}%
+ \DTMifbool{french}{abbr}%
+ {\DTMfrenchshortmonthname{##2}}%
+ {\DTMfrenchmonthname{##2}}%
+ \DTMifbool{french}{showyear}%
+ {%
+ \DTMfrenchmonthyearsep
+ \number##1 % space intended
+ }%
+ {}%
+ \else
+ \DTMifbool{french}{showdayofmonth}
+ {%
+ \DTMfrenchordinal{##3}%
+ \DTMfrenchdaymonthsep
+ \DTMifbool{french}{abbr}%
+ {\DTMfrenchshortmonthname{##2}}%
+ {\DTMfrenchmonthname{##2}}%
+ }%
+ {%
+ \DTMifbool{french}{abbr}%
+ {\DTMfrenchshortMonthname{##2}}%
+ {\DTMfrenchMonthname{##2}}%
+ }%
+ \DTMifbool{french}{showyear}%
+ {%
+ \DTMfrenchmonthyearsep
+ \number##1 % space intended
+ }%
+ {}%
+ \fi
+ \else
+ \DTMifbool{french}{showdayofmonth}
+ {%
+ \DTMfrenchordinal{##3}%
+ \DTMfrenchdaymonthsep
+ \DTMifbool{french}{abbr}%
+ {\DTMfrenchshortmonthname{##2}}%
+ {\DTMfrenchmonthname{##2}}%
+ }%
+ {%
+ \DTMifbool{french}{abbr}%
+ {\DTMfrenchshortMonthname{##2}}%
+ {\DTMfrenchMonthname{##2}}%
+ }%
+ \DTMifbool{french}{showyear}%
+ {%
+ \DTMfrenchmonthyearsep
+ \number##1 % space intended
+ }%
+ {}%
+ \fi
+ }%
}%
- {% time style (use default)
- \DTMsettimestyle{default}%
+ {% time style
+ \DTMsettimestyle{frenchalpha}%
}%
{% zone style
\DTMresetzones