texlive[69175] Master/texmf-dist: decimalcomma (19dec23)
commits+karl at tug.org
commits+karl at tug.org
Wed Dec 20 21:53:41 CET 2023
Revision: 69175
https://tug.org/svn/texlive?view=revision&revision=69175
Author: karl
Date: 2023-12-20 21:53:41 +0100 (Wed, 20 Dec 2023)
Log Message:
-----------
decimalcomma (19dec23)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/decimalcomma/README.md
trunk/Master/texmf-dist/doc/latex/decimalcomma/decimalcomma.pdf
trunk/Master/texmf-dist/source/latex/decimalcomma/decimalcomma.dtx
trunk/Master/texmf-dist/tex/latex/decimalcomma/decimalcomma.sty
Modified: trunk/Master/texmf-dist/doc/latex/decimalcomma/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/decimalcomma/README.md 2023-12-20 20:53:32 UTC (rev 69174)
+++ trunk/Master/texmf-dist/doc/latex/decimalcomma/README.md 2023-12-20 20:53:41 UTC (rev 69175)
@@ -3,7 +3,7 @@
## Presentation
-Many countries use a comma instead of a dot as a decimal separator.
+Many countries use a comma instead of a period as the decimal separator.
This small package offers a new definition of the comma `,` as an active character.
It ensures the correct spacing in mathematical mode when using the comma either
as decimal separator or as list separator.
Modified: trunk/Master/texmf-dist/doc/latex/decimalcomma/decimalcomma.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/decimalcomma/decimalcomma.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/decimalcomma/decimalcomma.dtx 2023-12-20 20:53:32 UTC (rev 69174)
+++ trunk/Master/texmf-dist/source/latex/decimalcomma/decimalcomma.dtx 2023-12-20 20:53:41 UTC (rev 69175)
@@ -20,7 +20,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{decimalcomma}
- [2023/12/06 v1.0 .dtx decimalcomma file]
+ [2023/12/20 v1.2 .dtx decimalcomma file]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -32,6 +32,7 @@
\usepackage{sectsty}
\usepackage{xcolor}
\usepackage{centeredline}
+\usepackage{metalogo}
\definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
\allsectionsfont{\color{darkbrown}}
@@ -57,7 +58,7 @@
%</driver>
% \fi
%
-% \CheckSum{26}
+% \CheckSum{36}
%
% \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
@@ -76,6 +77,8 @@
% Right brace \} Tilde \~}
%
% \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 at unicodemath}
%
% \GetFileInfo{decimalcomma.sty}
%
@@ -87,7 +90,7 @@
% \section{Why this package?}
%
% In many countries, except notably in Anglo-Saxon countries,
-% the comma is used as a decimal separator for numbers.
+% 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.
% This is appropriate in intervals: "$[a,b]$" results in $[a,b]$,
@@ -111,23 +114,28 @@
% especially when used with \textsf{babel}
% in conjunction with \textsf{numprint}~\cite{NUMP} and its \texttt{autolanguage} option
% (at least for certain languages such as French and Spanish).
-% Another issue with \textsf{ncccomma} is that compiling with Lua\LaTeX,
-% \textsf{unicode-math}, and "\setmathfont" fails.
+% Another issue with \textsf{ncccomma} is that compiling with \LuaLaTeX\ or \XeLaTeX\
+% fails when using \textsf{unicode-math} and "\setmathfont".
%
% Let it be noted that a code proposed by Claudio Beccari~\cite{BECC},
% similar to that of \textsf{ncccomma}, presents the same type of issues.
%
% \medskip
-% Therefore, we propose a new package, functionally identical to that
-% of \textsf{ncccomma} but with lighter code and without the
+% Therefore, we propose a new package, functionally identical to
+% \textsf{ncccomma} but with lighter code, and without the
% aforementioned incompatibilities.
%
% \section{Bugs and problems}
+%
+% When \textsf{unicode-math} is used, it must be loaded \emph{before}
+% \textsf{decimalcomma}\footnote{This is also true for \textsf{icomma}.}.
+%
% Here, we are revisiting what Walter Schmidt wrote in the documentation of his
% \textsf{icomma} package:
%
-% In case the \textsf{decimalcomma} is used together with the \textsf{dcolumn} package,
-% a comma to be printed as the decimal separator in a column of type \texttt{D}
+% In case \textsf{decimalcomma} is used together with the \textsf{dcolumn}
+% package~\cite{DCOL}, a comma to be printed as the decimal separator
+% in a column of type \texttt{D}
% is to be specified as "{\mathord\mathcomma}", rather than "{,}",
% since the latter leads to an error.
% For instance:
@@ -141,6 +149,31 @@
% \StopEventually{}
%
% \section{Implementation}
+%
+% This first peace 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 at unicodemath" will be set to true.
+% Then, at the end of the preamble, when all the packages have been loaded,
+% we perform a new verification. If \textsf{unicode-math} has been loaded after
+% but not before, the appropriate error message is displayed.
+% Without this code, the compilation would produce an error message mentioning
+% a problem on "\futurelet", incomprehensible for the novice.
+%
+% \begin{macrocode}
+
+\newif\ifDC at unicodemath
+\@ifpackageloaded{unicode-math}{\DC at unicodemathtrue}
+\AtBeginDocument{\@ifpackageloaded{unicode-math}{
+ \ifDC at unicodemath\else
+ \PackageError{decimalcomma}{decimalcomma must be loaded
+ after unicode-math}{If you didn't load decimalcomma
+ yourself, check which package uses it.}
+ \fi
+ }{}
+}
+
+% \end{macrocode}
% We have taken up Walter Schmidt's fundamental idea for looking up the next character,
% 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
@@ -172,7 +205,7 @@
% \end{macrocode}
%
-% \begin{thebibliography}{4}
+% \begin{thebibliography}{5}
% % \begin{raggedright}
% \bibitem{ICOMMA} \emph{The \textsf{icomma} package for \LaTeXe}.
% Walter Schmidt, CTAN, v2.0 2002/03/10.
@@ -183,6 +216,8 @@
% \url{https://tug.org/pracjourn/2011-1/beccari/Intcomma.pdf}
% \bibitem{NUMP} \emph{The \textsf{numprint} package}. Harald Harders,
% CTAN, v1.39 2012/08/20.
+% \bibitem{DCOL} \emph{The \textsf{dcolumn} package}, David Carlisle.
+% CTAN, v1.06 2023/07/08.
% \end{raggedright}
% \end{thebibliography}
% \Finale
Modified: trunk/Master/texmf-dist/tex/latex/decimalcomma/decimalcomma.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/decimalcomma/decimalcomma.sty 2023-12-20 20:53:32 UTC (rev 69174)
+++ trunk/Master/texmf-dist/tex/latex/decimalcomma/decimalcomma.sty 2023-12-20 20:53:41 UTC (rev 69175)
@@ -22,7 +22,19 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{decimalcomma}
- [2023/12/06 v1.0 .dtx decimalcomma file]
+ [2023/12/20 v1.2 .dtx decimalcomma file]
+
+\newif\ifDC at unicodemath
+\@ifpackageloaded{unicode-math}{\DC at unicodemathtrue}
+\AtBeginDocument{\@ifpackageloaded{unicode-math}{
+ \ifDC at unicodemath\else
+ \PackageError{decimalcomma}{decimalcomma must be loaded
+ after unicode-math}{If you didn't load decimalcomma
+ yourself, check which package uses it.}
+ \fi
+ }{}
+}
+
\AtBeginDocument{%
\mathchardef\mathcomma\mathcode`\,%
\mathcode`\,="8000%
More information about the tex-live-commits
mailing list.