From 5ca3facf87a90c246e0525fadbc9b7831a86bf34 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Nov 2020 22:02:29 +0000 Subject: numspell (11nov20) git-svn-id: svn://tug.org/texlive/trunk@56912 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/numspell/numspell.pdf | Bin 234703 -> 223145 bytes Master/texmf-dist/doc/latex/numspell/numspell.tex | 113 +++++++++------------ .../tex/latex/numspell/numspell-english.sty | 13 ++- Master/texmf-dist/tex/latex/numspell/numspell.sty | 40 +++----- 4 files changed, 72 insertions(+), 94 deletions(-) diff --git a/Master/texmf-dist/doc/latex/numspell/numspell.pdf b/Master/texmf-dist/doc/latex/numspell/numspell.pdf index 76152b5074a..b3878a16506 100644 Binary files a/Master/texmf-dist/doc/latex/numspell/numspell.pdf and b/Master/texmf-dist/doc/latex/numspell/numspell.pdf differ diff --git a/Master/texmf-dist/doc/latex/numspell/numspell.tex b/Master/texmf-dist/doc/latex/numspell/numspell.tex index c28766044db..99128819f99 100644 --- a/Master/texmf-dist/doc/latex/numspell/numspell.tex +++ b/Master/texmf-dist/doc/latex/numspell/numspell.tex @@ -30,10 +30,14 @@ \setlength{\parskip}{6pt} \lstnewenvironment{examplelst}{\lstset{ -belowskip=\bigskipamount, +%belowskip=\bigskipamount, basicstyle=\ttfamily, backgroundcolor=\color{black!10}, +frame=trbl, +framesep=3pt, columns=fullflexible, +xleftmargin=3.4pt, +xrightmargin=3.4pt, keepspaces}}{} \newcommand{\commandinline}{\lstinline[ @@ -52,7 +56,7 @@ keepspaces]} \begin{document} -\title{The {\bfseries\sffamily numspell} package\\{\large v1.3 (2020/11/07)}} +\title{The {\bfseries\sffamily numspell} package\\{\large v1.4 (2020/11/11)}} \author{Tibor Tómács\\{\normalsize\url{tomacs.tibor@uni-eszterhazy.hu}}} \date{} \maketitle @@ -63,7 +67,7 @@ The aim of the \texttt{numspell} package is to spell the cardinal and ordinal nu The supported languages are English (British and American), French, German, Hungarian and Italian. The spelling will happen in the current language. -The \texttt{numspell} package requires the services of the following packages: \texttt{xstring}, \texttt{etoolbox}, \texttt{iflang}. +The \texttt{numspell} package requires the services of the \texttt{xstring} and \texttt{iflang} packages. Load the package as usual, with \begin{flushleft} @@ -231,6 +235,15 @@ For example \thenumspellMyNum \end{description} +\section{Commands for English language} +If the \texttt{english}, \texttt{british}, \texttt{ukenglish} or \texttt{UKenglish} language is active, then the number spelling will happen in British English. But it will be in American English, if the \texttt{american}, \texttt{usenglish} or \texttt{USenglish} language is active. +\begin{description} +\item\commandinline|\numspellUS|\\ +Using British English, you can rechange the number spelling to American English by this command. +\item\commandinline|\numspellGB|\\ +Using American English, you can rechange the number spelling to British English by this command. +\end{description} + \section{Commands for French language} The following commands only work, if \texttt{french} language is active. \begin{description} @@ -246,7 +259,7 @@ but \verb|\numspellpremiere\ordnumspell{1}| $\to$ {\numspellpremiere\ordnumspell \end{description} \section{Commands for Hungarian language} -The following commands only work, if \texttt{magyar} language is active. +The following commands only work, if \texttt{magyar} or \texttt{hungarian} language is active. \begin{description} \item\commandinline|\anumspell[!!]{!!}|\\ It works like \verb|\numspell|, but the number spelling will start with Hungarian definite article. For example @@ -337,10 +350,9 @@ The ordinal numbers will be printed in feminine form. For example\\ \end{description} \section{Examples} -\subsection*{Example \stepcounter{subsection}\arabic{subsection}} + \begin{examplelst} \documentclass{article} -\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[magyar,italian,ngerman,french,english]{babel} \usepackage{numspell} @@ -349,80 +361,56 @@ The ordinal numbers will be printed in feminine form. For example\\ \def\mynum{123456789} \noindent In British English the spelling of \num{\mynum} is -\emph{``\numspell{\mynum}''}. +\emph{\numspell{\mynum}}. \par\smallskip\noindent In American English the spelling of \num{\mynum} is -{\selectlanguage{american}\emph{``\numspell{\mynum}''}}. +\foreignlanguage{american}{\em\numspell{\mynum}}. \par\smallskip\noindent In French the spelling of \num{\mynum} is -{\selectlanguage{french}\emph{``\numspell{\mynum}''}}. +\foreignlanguage{french}{\em\numspell{\mynum}}. \par\smallskip\noindent In German the spelling of \num{\mynum} is -{\selectlanguage{ngerman}\emph{``\numspell{\mynum}''}}. +\foreignlanguage{ngerman}{\em\numspell{\mynum}}. \par\smallskip\noindent In Hungarian the spelling of \num{\mynum} is -{\selectlanguage{magyar}\emph{`'\numspell{\mynum}''}}. +\foreignlanguage{magyar}{\em\numspell{\mynum}}. \par\smallskip\noindent In Italian the spelling of \num{\mynum} is -{\selectlanguage{italian}\emph{``\numspell{\mynum}''}}. +\foreignlanguage{italian}{\em\numspell{\mynum}}. \end{document} \end{examplelst} - \def\mynum{123456789} - \noindent In British English the spelling of \num{\mynum} is -\emph{``\numspell{\mynum}''}. - -\smallskip\noindent +\emph{\numspell{\mynum}}. +\par\smallskip\noindent In American English the spelling of \num{\mynum} is -{\selectlanguage{american}\emph{``\numspell{\mynum}''}}. - -\smallskip\noindent +\foreignlanguage{american}{\em\numspell{\mynum}}. +\par\smallskip\noindent In French the spelling of \num{\mynum} is -{\selectlanguage{french}\emph{``\numspell{\mynum}''}}. - -\smallskip\noindent +\foreignlanguage{french}{\em\numspell{\mynum}}. +\par\smallskip\noindent In German the spelling of \num{\mynum} is -{\selectlanguage{ngerman}\emph{``\numspell{\mynum}''}}. - -\smallskip\noindent +\foreignlanguage{ngerman}{\em\numspell{\mynum}}. +\par\smallskip\noindent In Hungarian the spelling of \num{\mynum} is -{\selectlanguage{magyar}\emph{`'\numspell{\mynum}''}}. - -\smallskip\noindent +\foreignlanguage{magyar}{\em\numspell{\mynum}}. +\par\smallskip\noindent In Italian the spelling of \num{\mynum} is -{\selectlanguage{italian}\emph{``\numspell{\mynum}''}}. +\foreignlanguage{italian}{\em\numspell{\mynum}}. -\bigskip -\subsection*{Example \stepcounter{subsection}\arabic{subsection}} -\begin{examplelst} -\documentclass{article} -\usepackage{numspell} -\usepackage[group-separator={,}]{siunitx} -\begin{document} -\def\mynum{123456789012345678901234567890123456789012345678901234567890123456} -\Numspell{\mynum}, that is \num{\mynum}. -\end{document} -\end{examplelst} - -\def\mynum{123456789012345678901234567890123456789012345678901234567890123456} -\Numspell{\mynum}, that is \num{\mynum}. - -\bigskip -\subsection*{Example \stepcounter{subsection}\arabic{subsection}} \begin{examplelst} \documentclass{article} \usepackage{numspell} \newcounter{mycount} -\makeatletter \begin{document} The +\makeatletter \@whilenum\value{mycount}<51 \do{\ordnumspell{\themycount}\stepcounter{mycount},\ }\dots +\makeatother \end{document} \end{examplelst} - \makeatletter \newcounter{mycount} The @@ -430,21 +418,19 @@ The \do{\ordnumspell{\themycount}\stepcounter{mycount},\ }\dots \makeatother -\bigskip -\subsection*{Example \stepcounter{subsection}\arabic{subsection}} \begin{examplelst} \documentclass{article} \usepackage{numspell} \newcounter{mycount} \def\themycount{\numspell{\arabic{mycount}}} -\makeatletter \begin{document} \Numspell{0}, +\makeatletter \@whilenum\value{mycount}<30 \do{\stepcounter{mycount}\themycount,\ }\dots +\makeatother \end{document} \end{examplelst} - \def\themycount{\numspell{\arabic{mycount}}} \setcounter{mycount}{0} \makeatletter @@ -453,7 +439,6 @@ The \do{\stepcounter{mycount}\themycount,\ }\dots \makeatother -\bigskip \section{Limitations} Do not use the \verb|\numspell|, \verb|\numspell*|, \verb|\Numspell|, \verb|\Numspell*|, etc.\ commands inside sectioning commands and \verb|\MakeUppercase|. An example for the illustration of the problem: @@ -469,24 +454,20 @@ An example for the illustration of the problem: Text \end{document} \end{examplelst} -\noindent -\textbf{The bugs} + +The following mistakes occur: \begin{enumerate} \setlength{\labelsep}{5pt} -\item -On the page 1: ``\numspell{123}''\\ +\item On the page 1: ``\numspell{123}''\\ Required: \numspell*{123}\MakeUppercase{``\thenumspell''} - -\item -On the heading: \emph{``THE \ordnumspell{123} FACTOR''}\\ +\item On the heading: \emph{``THE \ordnumspell{123} FACTOR''}\\ Required: \ordnumspell*{123}\MakeUppercase{\em``The \thenumspell\ factor''} - -\item -On the pdf bookmark: ``The 123 factor''\\ +\item On the pdf bookmark: ``The 123 factor''\\ Required: ``The \ordnumspell{123} factor'' \end{enumerate} -\noindent -\textbf{The solution} + +\subsubsection*{The solution} + \begin{examplelst} \documentclass{article} \usepackage{hyperref} diff --git a/Master/texmf-dist/tex/latex/numspell/numspell-english.sty b/Master/texmf-dist/tex/latex/numspell/numspell-english.sty index a3120e3ca85..4ad8bf476d2 100644 --- a/Master/texmf-dist/tex/latex/numspell/numspell-english.sty +++ b/Master/texmf-dist/tex/latex/numspell/numspell-english.sty @@ -16,24 +16,31 @@ %% The Current Maintainer of this work is Tibor Tomacs. %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{numspell-english}[2020/11/07 v1.1 English language package for numspell] +\ProvidesPackage{numspell-english}[2020/11/11 v1.2 English language package for numspell] + +\def\numspell@and@en{\numspell@{ and }} +\def\numspell@and@@en{\numspell@{, }}% It was 'and' in v1.0 %% ----------- -%% \numspellGB (Default) +%% \numspellGB %% ----------- %% It changes to British English %% \def\numspellGB{% + \def\numspell@US{}% \def\numspell@and@en{\numspell@{ and }}% \def\numspell@and@@en{\numspell@{, }}% It was 'and' in v1.0 } -\numspellGB %% ----------- %% \numspellUS %% ----------- %% It changes to American English %% +\def\numspell@US{% + \def\numspell@and@en{\numspell@{ }}% + \def\numspell@and@@en{\numspell@{, }}% +} \def\numspellUS{% \def\numspell@and@en{\numspell@{ }}% \def\numspell@and@@en{\numspell@{, }}% diff --git a/Master/texmf-dist/tex/latex/numspell/numspell.sty b/Master/texmf-dist/tex/latex/numspell/numspell.sty index c74912b8d15..ccd615f3963 100644 --- a/Master/texmf-dist/tex/latex/numspell/numspell.sty +++ b/Master/texmf-dist/tex/latex/numspell/numspell.sty @@ -17,12 +17,10 @@ %% %% The Current Maintainer of this work is Tibor Tomacs. %% -\NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{numspell}[2020/11/07 v1.3 Package for spelling cardinal and ordinal numbers] +\NeedsTeXFormat{LaTeX2e}[2020/10/01] +\ProvidesPackage{numspell}[2020/11/11 v1.4 Package for spelling cardinal and ordinal numbers] -\RequirePackage{xstring} -\RequirePackage{iflang} -\RequirePackage{etoolbox} +\RequirePackage{xstring,iflang} \newcounter{numspell@counter@tempa} \newcounter{numspell@counter@tempb} @@ -235,38 +233,30 @@ \IfLanguageName{british}{\@numspell@lang@notsupported@false}{}% \IfLanguageName{ukenglish}{\@numspell@lang@notsupported@false}{}% \IfLanguageName{UKenglish}{\@numspell@lang@notsupported@false}{}% - \IfLanguageName{american}{\@numspell@lang@notsupported@false\numspellUS}{}% - \IfLanguageName{usenglish}{\@numspell@lang@notsupported@false\numspellUS}{}% - \IfLanguageName{USenglish}{\@numspell@lang@notsupported@false\numspellUS}{}% + \IfLanguageName{american}{\@numspell@lang@notsupported@false\numspell@US}{}% + \IfLanguageName{usenglish}{\@numspell@lang@notsupported@false\numspell@US}{}% + \IfLanguageName{USenglish}{\@numspell@lang@notsupported@false\numspell@US}{}% \IfLanguageName{magyar}{\@numspell@lang@notsupported@false\def\numspell@langname{hu}}{}% \IfLanguageName{hungarian}{\@numspell@lang@notsupported@false\def\numspell@langname{hu}}{}% \IfLanguageName{german}{\@numspell@lang@notsupported@false\def\numspell@langname{de}}{}% \IfLanguageName{ngerman}{\@numspell@lang@notsupported@false\def\numspell@langname{de}}{}% \IfLanguageName{french}{\@numspell@lang@notsupported@false\def\numspell@langname{fr}}{}% \IfLanguageName{italian}{\@numspell@lang@notsupported@false\def\numspell@langname{it}}{}% - \if@numspell@lang@notsupported@\PackageWarning{numspell}{Not supported language: \languagename}\fi% + \if@numspell@lang@notsupported@\PackageWarning{numspell}{\languagename\space is not supported language in numspell}\fi% } %% ------------------------- %% Loading language packages %% ------------------------- %% -\AtEndPreamble{% -\newif\if@numspell@lang@loaded@ -\ifdefined\dateenglish\RequirePackage{numspell-english}\@numspell@lang@loaded@true\fi% -\ifdefined\datebritish\RequirePackage{numspell-english}\@numspell@lang@loaded@true\fi% -\ifdefined\dateukenglish\RequirePackage{numspell-english}\@numspell@lang@loaded@true\fi% -\ifdefined\dateUKenglish\RequirePackage{numspell-english}\@numspell@lang@loaded@true\fi% -\ifdefined\dateamerican\RequirePackage{numspell-english}\@numspell@lang@loaded@true\fi% -\ifdefined\dateusenglish\RequirePackage{numspell-english}\@numspell@lang@loaded@true\fi% -\ifdefined\dateUSenglish\RequirePackage{numspell-english}\@numspell@lang@loaded@true\fi% -\ifdefined\datemagyar\RequirePackage{numspell-magyar}\@numspell@lang@loaded@true\fi% -\ifdefined\datehungarian\RequirePackage{numspell-magyar}\@numspell@lang@loaded@true\fi% -\ifdefined\dategerman\RequirePackage{numspell-german}\@numspell@lang@loaded@true\fi% -\ifdefined\datengerman\RequirePackage{numspell-german}\@numspell@lang@loaded@true\fi% -\ifdefined\datefrench\RequirePackage{numspell-french}\@numspell@lang@loaded@true\fi% -\ifdefined\dateitalian\RequirePackage{numspell-italian}\@numspell@lang@loaded@true\fi% -\if@numspell@lang@loaded@\else\RequirePackage{numspell-english}\fi% +\AddToHook{begindocument/before}{ +\RequirePackage{numspell-english} +\ifdefined\datemagyar\RequirePackage{numspell-magyar}\fi% +\ifdefined\datehungarian\RequirePackage{numspell-magyar}\fi% +\ifdefined\dategerman\RequirePackage{numspell-german}\fi% +\ifdefined\datengerman\RequirePackage{numspell-german}\fi% +\ifdefined\datefrench\RequirePackage{numspell-french}\fi% +\ifdefined\dateitalian\RequirePackage{numspell-italian}\fi% } %% --------------------------------- -- cgit v1.2.3