From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 macros/latex/contrib/numspell/numspell-french.sty | 335 ++++++++++++++++++++++
 1 file changed, 335 insertions(+)
 create mode 100644 macros/latex/contrib/numspell/numspell-french.sty

(limited to 'macros/latex/contrib/numspell/numspell-french.sty')

diff --git a/macros/latex/contrib/numspell/numspell-french.sty b/macros/latex/contrib/numspell/numspell-french.sty
new file mode 100644
index 0000000000..00426043bf
--- /dev/null
+++ b/macros/latex/contrib/numspell/numspell-french.sty
@@ -0,0 +1,335 @@
+%%
+%% `numspell-french.sty' French language package for 'numspell.sty'
+%%
+%% Copyright 2017- by Tibor Tomacs
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Tibor Tomacs.
+%%
+\NeedsTeXFormat{LaTeX2e}[1999/12/01]
+\ProvidesPackage{numspell-french}[2017/02/09 v1.0 French language package for numspell]
+
+%% For 'cent' or 'cents'
+\newif\if@numspell@fr@firstgroup@
+
+%% 'premier' or 'premiere'
+\def\numspellpremier{\def\numspell@fr@premier{\numspell@{premier}}}
+\def\numspellpremiere{\def\numspell@fr@premier{\numspell@{premi\`{e}re}}}
+\numspellpremier
+
+%% GROUP NAMES
+\def\numspell@group@ii@fr@name{\numspell@{mille}}
+\def\numspell@group@iii@fr@name{\numspell@{million}}
+\def\numspell@group@iv@fr@name{\numspell@{milliard}}
+\def\numspell@group@v@fr@name{\numspell@{billion}}
+\def\numspell@group@vi@fr@name{\numspell@{billiard}}
+\def\numspell@group@vii@fr@name{\numspell@{trillion}}
+\def\numspell@group@viii@fr@name{\numspell@{trilliard}}
+\def\numspell@group@ix@fr@name{\numspell@{quadrillion}}
+\def\numspell@group@x@fr@name{\numspell@{quadrilliard}}
+\def\numspell@group@xi@fr@name{\numspell@{quintilion}}
+\def\numspell@group@xii@fr@name{\numspell@{quintilliard}}
+\def\numspell@group@xiii@fr@name{\numspell@{sextillion}}
+\def\numspell@group@xiv@fr@name{\numspell@{sextilliard}}
+\def\numspell@group@xv@fr@name{\numspell@{septillion}}
+\def\numspell@group@xvi@fr@name{\numspell@{septilliard}}
+\def\numspell@group@xvii@fr@name{\numspell@{octillion}}
+\def\numspell@group@xviii@fr@name{\numspell@{octilliard}}
+\def\numspell@group@xix@fr@name{\numspell@{nonillion}}
+\def\numspell@group@xx@fr@name{\numspell@{nonilliard}}
+\def\numspell@group@xxi@fr@name{\numspell@{d\'{e}cillion}}
+\def\numspell@group@xxii@fr@name{\numspell@{d\'{e}cilliard}}
+
+%% SPELLING CARDINAL NUMBER GROUP
+%% ---------------------------------
+%% \numspell@group@spell@fr{<group>} (<group>=000,001,...,999)
+%% ---------------------------------
+%% \numspell@group@digits{<group>}
+%% Adding the <group> spelling to \thenumspell
+%%
+\def\numspell@group@spell@fr#1{%
+    \numspell@group@digits{#1}%
+    \ifcase\numspell@group@digit@i%
+        \or\or\numspell@{deux }\or\numspell@{trois }\or\numspell@{quatre }\or\numspell@{cinq }%
+        \or\numspell@{six }\or\numspell@{sept }\or\numspell@{huit }\or\numspell@{neuf }%
+    \fi%
+    \ifnum\numspell@group@digit@i>0%
+        \numspell@{cent}%
+        \if@numspell@fr@firstgroup@%
+            \ifnum\number\numexpr\numspell@group@digit@ii+\numspell@group@digit@iii=0%
+                \ifnum\numspell@group@digit@i>1%
+                    \numspell@{s}%
+                \fi%
+            \fi%
+        \fi%
+        \ifnum\number\numexpr\numspell@group@digit@ii+\numspell@group@digit@iii>0%
+            \numspell@{ }%
+        \fi%
+        \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii=1%
+            \numspell@{un}%
+        \fi%
+    \fi%
+    \ifcase\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii%
+        \or\or\numspell@{deux}\or\numspell@{trois}\or\numspell@{quatre}\or\numspell@{cinq}%
+        \or\numspell@{six}\or\numspell@{sept}\or\numspell@{huit}\or\numspell@{neuf}%
+        \or\numspell@{dix}\or\numspell@{onze}\or\numspell@{douze}\or\numspell@{treize}%
+        \or\numspell@{quatorze}\or\numspell@{quinze}\or\numspell@{seize}\or\numspell@{dix}\numspell@dash@\numspell@{sept}%
+        \or\numspell@{dix}\numspell@dash@\numspell@{huit}\or\numspell@{dix}\numspell@dash@\numspell@{neuf}%
+    \fi%
+    \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii>19%
+        \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii<70%
+            \ifcase\numspell@group@digit@ii%
+                \or\or\numspell@{vingt}\or\numspell@{trente}\or\numspell@{quarante}\or\numspell@{cinquante}\or\numspell@{soixante}%
+            \fi%
+            \ifcase\numspell@group@digit@iii%
+                \or\numspell@{ et un}\or\numspell@dash@\numspell@{deux}\or\numspell@dash@\numspell@{trois}%
+                \or\numspell@dash@\numspell@{quatre}\or\numspell@dash@\numspell@{cinq}\or\numspell@dash@\numspell@{six}%
+                \or\numspell@dash@\numspell@{sept}\or\numspell@dash@\numspell@{huit}\or\numspell@dash@\numspell@{neuf}%
+            \fi%
+        \fi%
+    \fi%
+    \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii>69%
+        \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii<80%
+            \numspell@{soixante}%
+            \ifcase\numspell@group@digit@iii%
+                \numspell@dash@\numspell@{dix}\or\numspell@{ et onze}\or\numspell@dash@\numspell@{douze}\or\numspell@dash@\numspell@{treize}%
+                \or\numspell@dash@\numspell@{quatorze}\or\numspell@dash@\numspell@{quinze}\or\numspell@dash@\numspell@{seize}%
+                \or\numspell@dash@\numspell@{dix}\numspell@dash@\numspell@{sept}\or\numspell@dash@\numspell@{dix}\numspell@dash@\numspell@{huit}%
+                \or\numspell@dash@\numspell@{dix}\numspell@dash@\numspell@{neuf}%
+            \fi%
+        \fi%
+    \fi%
+    \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii>79%
+        \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii<90%
+            \numspell@{quatre}\numspell@dash@\numspell@{vingt}%
+            \ifcase\numspell@group@digit@iii%
+                \numspell@{s}\or\numspell@dash@\numspell@{un}\or\numspell@dash@\numspell@{deux}\or\numspell@dash@\numspell@{trois}%
+                \or\numspell@dash@\numspell@{quatre}\or\numspell@dash@\numspell@{cinq}\or\numspell@dash@\numspell@{six}%
+                \or\numspell@dash@\numspell@{sept}\or\numspell@dash@\numspell@{huit}\or\numspell@dash@\numspell@{neuf}%
+            \fi%
+        \fi%
+    \fi%
+    \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii>89%
+        \numspell@{quatre}\numspell@dash@\numspell@{vingt}\numspell@dash@%
+        \ifcase\numspell@group@digit@iii%
+            \numspell@{dix}\or\numspell@{onze}\or\numspell@{douze}\or\numspell@{treize}%
+            \or\numspell@{quatorze}\or\numspell@{quinze}\or\numspell@{seize}%
+            \or\numspell@{dix}\numspell@dash@\numspell@{sept}\or\numspell@{dix}\numspell@dash@\numspell@{huit}%
+            \or\numspell@{dix}\numspell@dash@\numspell@{neuf}%
+        \fi%
+    \fi%
+}
+
+%% SPELLING ORDINAL NUMBER GROUP
+%% ------------------------------------
+%% \numspell@ordgroup@spell@fr{<group>} (<group>=000,001,...,999)
+%% ------------------------------------
+%% \numspell@group@digits{<group>}
+%% Adding the <group> ordinal spelling to \thenumspell
+%%
+\def\numspell@ordgroup@spell@fr#1{%
+    \numspell@group@digits{#1}%
+    \ifcase\numspell@group@digit@i%
+        \or\or\numspell@{deux }\or\numspell@{trois }\or\numspell@{quatre }\or\numspell@{cinq }%
+        \or\numspell@{six }\or\numspell@{sept }\or\numspell@{huit }\or\numspell@{neuf }%
+    \fi%
+    \ifnum\numspell@group@digit@i>0%
+        \numspell@{cent}%
+        \ifnum\number\numexpr\numspell@group@digit@ii+\numspell@group@digit@iii=0%
+            \numspell@{i\`{e}me}%
+        \else%
+            \numspell@{ }%
+        \fi%
+        \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii=1%
+            \numspell@{uni\`{e}me}%
+        \fi%
+    \fi%
+    \ifcase\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii%
+        \or\or\numspell@{deuxi\`{e}me}\or\numspell@{troisi\`{e}me}\or\numspell@{quatri\`{e}me}\or\numspell@{cinqui\`{e}me}%
+        \or\numspell@{sixi\`{e}me}\or\numspell@{septi\`{e}me}\or\numspell@{huiti\`{e}me}\or\numspell@{neuvi\`{e}me}%
+        \or\numspell@{dixi\`{e}me}\or\numspell@{onzi\`{e}me}\or\numspell@{douzi\`{e}me}\or\numspell@{treizi\`{e}me}%
+        \or\numspell@{quatorzi\`{e}me}\or\numspell@{quinzi\`{e}me}\or\numspell@{seizi\`{e}me}%
+        \or\numspell@{dix}\numspell@dash@\numspell@{septi\`{e}me}\or\numspell@{dix}\numspell@dash@\numspell@{huiti\`{e}me}%
+        \or\numspell@{dix}\numspell@dash@\numspell@{neuvi\`{e}me}%
+    \fi%
+    \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii>19%
+        \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii<70%
+            \ifnum\numspell@group@digit@iii=0%
+                \ifcase\numspell@group@digit@ii%
+                    \or\or\numspell@{vingti\`{e}me}\or\numspell@{trenti\`{e}me}\or\numspell@{quaranti\`{e}me}%
+                    \or\numspell@{cinquanti\`{e}me}\or\numspell@{soixanti\`{e}me}%
+                \fi%
+            \else%
+                \ifcase\numspell@group@digit@ii%
+                    \or\or\numspell@{vingt}\or\numspell@{trente}\or\numspell@{quarante}\or\numspell@{cinquante}\or\numspell@{soixante}%
+                \fi%
+            \fi%
+            \ifcase\numspell@group@digit@iii%
+                \or\numspell@{ et uni\`{e}me}\or\numspell@dash@\numspell@{deuxi\`{e}me}\or\numspell@dash@\numspell@{troisi\`{e}me}%
+                \or\numspell@dash@\numspell@{quatri\`{e}me}\or\numspell@dash@\numspell@{cinqui\`{e}me}\or\numspell@dash@\numspell@{sixi\`{e}me}%
+                \or\numspell@dash@\numspell@{septi\`{e}me}\or\numspell@dash@\numspell@{huiti\`{e}me}\or\numspell@dash@\numspell@{neuvi\`{e}me}%
+            \fi%
+        \fi%
+    \fi%
+    \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii>69%
+        \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii<80%
+            \numspell@{soixante}%
+            \ifcase\numspell@group@digit@iii%
+                \numspell@dash@\numspell@{dixi\`{e}me}\or\numspell@{ et onzi\`{e}me}\or\numspell@dash@\numspell@{douzi\`{e}me}\or\numspell@dash@\numspell@{treizi\`{e}me}%
+                \or\numspell@dash@\numspell@{quatorzi\`{e}me}\or\numspell@dash@\numspell@{quinzi\`{e}me}%
+                \or\numspell@dash@\numspell@{seizi\`{e}me}\or\numspell@dash@\numspell@{dix}\numspell@dash@\numspell@{septi\`{e}me}%
+                \or\numspell@dash@\numspell@{dix}\numspell@dash@\numspell@{huiti\`{e}me}%
+                \or\numspell@dash@\numspell@{dix}\numspell@dash@\numspell@{neuvi\`{e}me}%
+            \fi%
+        \fi%
+    \fi%
+    \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii>79%
+        \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii<90%
+            \numspell@{quatre}\numspell@dash@\numspell@{vingt}%
+            \ifcase\numspell@group@digit@iii%
+                \numspell@{i\`{e}me}\or\numspell@dash@\numspell@{uni\`{e}me}\or\numspell@dash@\numspell@{deuxi\`{e}me}%
+                \or\numspell@dash@\numspell@{troisi\`{e}me}%
+                \or\numspell@dash@\numspell@{quatri\`{e}me}\or\numspell@dash@\numspell@{cinqui\`{e}me}\or\numspell@dash@\numspell@{sixi\`{e}me}%
+                \or\numspell@dash@\numspell@{septi\`{e}me}\or\numspell@dash@\numspell@{huiti\`{e}me}\or\numspell@dash@\numspell@{neuvi\`{e}me}%
+            \fi%
+        \fi%
+    \fi%
+    \ifnum\number\numexpr10*\numspell@group@digit@ii+\numspell@group@digit@iii>89%
+        \numspell@{quatre}\numspell@dash@\numspell@{vingt}\numspell@dash@%
+        \ifcase\numspell@group@digit@iii%
+            \numspell@{dixi\`{e}me}\or\numspell@{onzi\`{e}me}\or\numspell@{douzi\`{e}me}\or\numspell@{treizi\`{e}me}%
+            \or\numspell@{quatorzi\`{e}me}\or\numspell@{quinzi\`{e}me}\or\numspell@{seizi\`{e}me}%
+            \or\numspell@{dix}\numspell@dash@\numspell@{septi\`{e}me}\or\numspell@{dix}\numspell@dash@\numspell@{huiti\`{e}me}%
+            \or\numspell@{dix}\numspell@dash@\numspell@{neuvi\`{e}me}%
+        \fi%
+    \fi%
+}
+
+%% SPELLING CARDINAL NUMBER
+%% --------------------------------------
+%% \numspell@num@spell@fr{<num1>}{<num2>}
+%% --------------------------------------
+%% \numspell@groups{<num1>}{<num2>}
+%% Adding the \numspell@num spelling to \thenumspell
+%%
+\def\numspell@num@spell@fr#1#2{%
+    \gdef\thenumspell{}%
+    \@numspell@fr@firstgroup@false%
+    \numspell@groups{#1}{#2}%
+    \setcounter{numspell@groupcount}{22}%
+    \@whilenum\value{numspell@groupcount}>2%
+    \do{%
+        \IfEq{\csname numspell@group@\roman{numspell@groupcount}\endcsname}{0}{}{%
+            \IfEq{\csname numspell@group@\roman{numspell@groupcount}\endcsname}{1}{\numspell@{un}}{}%
+            \numspell@group@spell@fr{\csname numspell@group@\roman{numspell@groupcount}\endcsname}%
+            \numspell@{ }%
+            \csname numspell@group@\roman{numspell@groupcount}@fr@name\endcsname%
+            \IfEq{\csname numspell@group@\roman{numspell@groupcount}\endcsname}{1}{}{\numspell@{s}}%
+            \ifnum\csname numspell@group@\roman{numspell@groupcount}@before\endcsname>0\numspell@{ }\fi%
+        }%
+        \addtocounter{numspell@groupcount}{-1}%
+    }%
+    \IfEq{\numspell@group@ii}{0}{}{%
+        \IfEq{\numspell@group@ii}{1}{\numspell@group@ii@fr@name}{%
+            \numspell@group@spell@fr{\numspell@group@ii}%
+            \numspell@{ }%
+            \numspell@group@ii@fr@name%
+        }%
+        \ifnum\numspell@group@ii@before>0\numspell@{ }\fi%
+    }%
+    \IfEq{\numspell@group@i}{0}{}{%
+        \@numspell@fr@firstgroup@true%
+        \IfEq{\numspell@group@i}{1}{\numspell@{un}}{}%
+        \numspell@group@spell@fr{\numspell@group@i}%
+    }%
+    \ifnum\numspell@group@max=0\numspell@{z\'{e}ro}\fi%
+}
+
+%% SPELLING ORDINAL NUMBER
+%% -----------------------------------------
+%% \numspell@ordnum@spell@fr{<num1>}{<num2>}
+%% -----------------------------------------
+%% \numspell@groups{<num1>}{<num2>}
+%% Adding the \numspell@num ordinal spelling to \thenumspell
+%%
+\def\numspell@ordnum@spell@fr#1#2{%
+    \gdef\thenumspell{}%
+    \numspell@groups{#1}{#2}%
+    \setcounter{numspell@groupcount}{22}%
+    \@whilenum\value{numspell@groupcount}>2%
+    \do{%
+        \IfEq{\csname numspell@group@\roman{numspell@groupcount}\endcsname}{0}{}{%
+            \IfEq{\csname numspell@group@\roman{numspell@groupcount}\endcsname}{1}{\numspell@{un}}{}%
+            \numspell@group@spell@fr{\csname numspell@group@\roman{numspell@groupcount}\endcsname}%
+            \numspell@{ }%
+            \csname numspell@group@\roman{numspell@groupcount}@fr@name\endcsname%
+            \ifnum\csname numspell@group@\roman{numspell@groupcount}@before\endcsname>0%
+                \IfEq{\csname numspell@group@\roman{numspell@groupcount}\endcsname}{1}{\numspell@{ }}{\numspell@{s }}%
+            \else%
+                \numspell@{i\`{e}me}%
+            \fi%
+        }%
+        \addtocounter{numspell@groupcount}{-1}%
+    }%
+    \IfEq{\numspell@group@ii}{0}{}{%
+        \numspell@group@spell@fr{\numspell@group@ii}%
+        \IfEq{\numspell@group@ii}{1}{}{\numspell@{ }}%
+        \ifnum\numspell@group@ii@before>0%
+            \numspell@{mille }%
+        \else%
+            \numspell@{milli\`{e}me}%
+        \fi%
+    }%
+    \IfEq{\numspell@group@i}{0}{}{%
+        \numspell@ordgroup@spell@fr{\numspell@group@i}%
+        \IfEq{\numspell@group@i}{1}{%
+            \ifnum\numspell@group@max=1%
+                \numspell@fr@premier%
+            \else%
+                \numspell@{uni\`{e}me}%
+            \fi%
+        }{}%
+    }%
+    \ifnum\numspell@group@max=0\numspell@{z\'{e}roi\`{e}me}\fi%
+}
+
+%% ----------------------
+%% \numspell@uppercase@fr
+%% ----------------------
+%% E.g. \def\thenumspell{un}\numspell@uppercase\thenumspell --> 'Un'
+%% \MakeUppercase does not work on pdf bookmark (see hyperref), so using another effective macro.
+%%
+\def\numspell@uppercase@fr{%
+    \fullexpandarg%
+    \StrChar{\thenumspell}{1}[\numspell@firstletter]%
+    \expandarg%
+    \StrGobbleLeft{\thenumspell}{1}[\numspell@trunc]%
+    \fullexpandarg%
+    \def\numspell@the{}%
+    \IfStrEq{\numspell@firstletter}{z}{\g@addto@macro\numspell@the{Z}}{}% z\'{e}ro
+    \IfStrEq{\numspell@firstletter}{u}{\g@addto@macro\numspell@the{U}}{}% un
+    \IfStrEq{\numspell@firstletter}{p}{\g@addto@macro\numspell@the{P}}{}% premier
+    \IfStrEq{\numspell@firstletter}{d}{\g@addto@macro\numspell@the{D}}{}% deux
+    \IfStrEq{\numspell@firstletter}{t}{\g@addto@macro\numspell@the{T}}{}% trois
+    \IfStrEq{\numspell@firstletter}{q}{\g@addto@macro\numspell@the{Q}}{}% quatre
+    \IfStrEq{\numspell@firstletter}{c}{\g@addto@macro\numspell@the{C}}{}% cinq
+    \IfStrEq{\numspell@firstletter}{s}{\g@addto@macro\numspell@the{S}}{}% six
+    \IfStrEq{\numspell@firstletter}{h}{\g@addto@macro\numspell@the{H}}{}% huit
+    \IfStrEq{\numspell@firstletter}{n}{\g@addto@macro\numspell@the{N}}{}% neuf
+    \IfStrEq{\numspell@firstletter}{v}{\g@addto@macro\numspell@the{V}}{}% vingt
+    \IfStrEq{\numspell@firstletter}{m}{\g@addto@macro\numspell@the{M}}{}% mille
+    \ifx\numspell@the\@empty\@latexerr{'numspell.sty' error! There is not '\numspell@firstletter' in uppercase!}{}\fi%
+    \g@addto@macro\numspell@the{\numspell@trunc}%
+    \def\thenumspell{\numspell@the}%
+}
+
+\endinput
\ No newline at end of file
-- 
cgit v1.2.3

