diff options
author | Norbert Preining <norbert@preining.info> | 2023-12-29 03:01:31 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-12-29 03:01:31 +0000 |
commit | a5ae3453af00d8ec9eb8bf64151fc4c8bcb18021 (patch) | |
tree | 49722f55b01f8ce69a0cd1c783383e40bdb53473 /macros/latex/contrib/decimalcomma | |
parent | 8806b2d6c55426cb0ba19311d2acf7c4f522a291 (diff) |
CTAN sync 202312290301
Diffstat (limited to 'macros/latex/contrib/decimalcomma')
-rw-r--r-- | macros/latex/contrib/decimalcomma/decimalcomma.dtx | 61 | ||||
-rw-r--r-- | macros/latex/contrib/decimalcomma/decimalcomma.pdf | bin | 95558 -> 102789 bytes |
2 files changed, 42 insertions, 19 deletions
diff --git a/macros/latex/contrib/decimalcomma/decimalcomma.dtx b/macros/latex/contrib/decimalcomma/decimalcomma.dtx index 087e63bde5..5ee720ea2c 100644 --- a/macros/latex/contrib/decimalcomma/decimalcomma.dtx +++ b/macros/latex/contrib/decimalcomma/decimalcomma.dtx @@ -20,10 +20,12 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{decimalcomma} - [2023/12/20 v1.2 .dtx decimalcomma file] + [2023/12/28 v1.3 .dtx Comma for decimal numbers] %</package> %<*driver> \documentclass{ltxdoc} +%\usepackage{doc} +%\MakeShortVerb| \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} @@ -58,7 +60,7 @@ %</driver> % \fi % -% \CheckSum{36} +% \CheckSum{24} % % \CharacterTable % {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 @@ -79,6 +81,7 @@ % \changes{v1.0}{2023/12/06}{Initial version} % \changes{v1.1}{2023/12/19}{Error message when unicode-math loaded after decimalcomma} % \changes{v1.2}{2023/12/20}{Bug correction: bad typo for the boolean DC@unicodemath} +% \changes{v1.3}{2023/12/28}{Loading icomma to avoid babel-french + numprint problems} % % \GetFileInfo{decimalcomma.sty} % @@ -89,7 +92,7 @@ % % \section{Why this package?} % -% In many countries, except notably in Anglo-Saxon countries, +% In many countries, except notably in the English-speaking countries, % the comma is used as the decimal separator for numbers. % However, in the math mode of \LaTeX, the comma is always, by default, % treated as a punctuation symbol and therefore is followed by a space. @@ -150,7 +153,7 @@ % % \section{Implementation} % -% This first peace of code aims to generate an appropriate error message, if you load +% This first piece of code aims to generate an appropriate error message, if you load % \textsf{unicode-math} \emph{after} \textsf{decimalcomma}. % To achieve this, first we check if \textsf{unicode-math} has been loaded before. % In that case, the boolean "DC@unicodemath" will be set to true. @@ -174,36 +177,56 @@ } % \end{macrocode} -% We have taken up Walter Schmidt's fundamental idea for looking up the next character, +% We have taken up Walter Schmidt's code for looking up the next character, +% and define the comma as active in math mode, % but with an execution loop to test all the digits from 0 to 9 instead of "\space". % We could have also used ten nested "\if" \ldots "\else" \ldots "\fi" structures % and that works very well. -% -% At |\begin{document}|, we store the original "\mathcode" of the comma, -% in the |\mathcomma| macro, and then we make the comma active in math mode. +% +%We chose to directly load \textsf{icomma} instead of transcribing +% the beginning portion of its code. +% This avoids potential conflicts with an extension +% that also uses \textsf{icomma}\footnote{The loading of \textsf{icomma} ensures also +% proper functioning when using \textsf{babel-french} and \textsf{numprint} +% with its \texttt{autolanguage} option +% (an issue that does not arise with \textsf{babel-spanish}, for example).}. % \begin{macrocode} -\AtBeginDocument{% - \mathchardef\mathcomma\mathcode`\,% - \mathcode`\,="8000% -} +\RequirePackage{icomma} % \end{macrocode} -% The active comma checks the next input character. If the next character is in -% the list 0123456789, +% +% First we introduce what \textsf{icomma} does. +% At |\begin{document}|, the original "\mathcode" of the comma is stored, +% in the |\mathcomma| macro, and then the comma is defined as active in math mode. +% The active comma checks the next input character. +% \begin{verbatim} +%\AtBeginDocument{% +% \mathchardef\mathcomma\mathcode`\,% +% \mathcode`\,="8000 % +%} +%{\catcode`,=\active +% \gdef,{\futurelet\@let@token\sm@rtcomma} +%} +% \end{verbatim} +% +% Then \textsf{icomma} defines the |\sm@rtcomma| macro, but this macro +% is redefined here to match the expected behavior. +% If the next character is in the list 0123456789, % the active comma returns |\mathord| with the saved |\mathcomma|, % so that no space will be added after the comma. % Otherwise, |\mathcomma| is returned without |\mathord|, thus the comma behaves % by default as a |\mathpunct|. +% Note that |\@decimal@digit| must be called before |\@let@token| after |\ifx|. % \begin{macrocode} -{\catcode`,=\active - \gdef,{\futurelet\@next\sm@rtcomma}} - \def\sm@rtcomma{% - \@tfor\@let@token:=0123456789% - \do{\expandafter\ifx\@let@token\@next\mathord\@break@tfor\fi}% + \@tfor\decimal@digit:=0123456789% + \do{\expandafter\ifx\decimal@digit\@let@token\mathord% + \@break@tfor\fi}% \mathcomma} % \end{macrocode} +% Special thanks to J.F. Burnol for his insightful remarks and valuable advice +% and let us pay tribute to Walter Schmidt, who is regrettably deceased. % % \begin{thebibliography}{5} % % \begin{raggedright} diff --git a/macros/latex/contrib/decimalcomma/decimalcomma.pdf b/macros/latex/contrib/decimalcomma/decimalcomma.pdf Binary files differindex 398a9e61d0..a7c42c84b7 100644 --- a/macros/latex/contrib/decimalcomma/decimalcomma.pdf +++ b/macros/latex/contrib/decimalcomma/decimalcomma.pdf |