From f853d14edaf7b35865289ce85961df9790cf91e9 Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Wed, 3 Aug 2011 13:06:34 +0000 Subject: ionumbers 2011/06/15 v0.3.1-alpha git-svn-id: svn://tug.org/texlive/trunk@23380 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/ionumbers/ionumbers.sty | 77 ++++++++++++++++++++-- 1 file changed, 71 insertions(+), 6 deletions(-) (limited to 'Master/texmf-dist/tex/latex/ionumbers') diff --git a/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty b/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty index 9aff9a3e856..90242c8c834 100644 --- a/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty +++ b/Master/texmf-dist/tex/latex/ionumbers/ionumbers.sty @@ -39,10 +39,19 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{ionumbers} - [2009/07/18 v0.2.4-alpha restyle numbers in math mode] + [2011/06/15 v0.3.1-alpha restyle numbers in math mode] \RequirePackage{keyval} \newif\ifion@autothousands \newif\ifion@autothousandths +\newcount\ion@grplenthousands +\newcount\ion@grplenthousandths +\newcommand*{\ion@grplencheck}[1]{% + \ifnum#1>9% + \PackageError{ionumbers}% + {Group length argument too large (#1).\MessageBreak% + Grouping lengths must be smaller than 10.}{}% + \fi% +} \newcommand*\ion@defpackopts{\define@key{ion@packopts}} \newcommand*\ion@setpackopts{\setkeys{ion@packopts}} \ion@defpackopts{comma}{% @@ -63,9 +72,15 @@ \csname ion@autothousands#1\endcsname}\ion@autothousandsreset} \ion@defpackopts{autothousandths}[true]{\def\ion@autothousandthsreset{% \csname ion@autothousandths#1\endcsname}\ion@autothousandthsreset} +\ion@defpackopts{grplenthousands}{\ion@grplencheck{#1}% + \def\ion@grplenthousandsreset{\ion@grplenthousands=#1}% + \ion@grplenthousandsreset} +\ion@defpackopts{grplenthousandths}{\ion@grplencheck{#1}% + \def\ion@grplenthousandthsreset{\ion@grplenthousandths=#1}% + \ion@grplenthousandthsreset} \ion@setpackopts{comma=default,point=default,thousands=default,% decimal=default,thousandths=default,exponent=default,autothousands=false,% - autothousandths=false} + autothousandths=false,grplenthousands=3,grplenthousandths=3} \DeclareOption*{\expandafter\ion@setpackopts\expandafter{\CurrentOption}} \ProcessOptions\relax \newcommand*\ion@deflocopts{\define@key{ion@locopts}} @@ -86,10 +101,30 @@ \csname ion@exponent@#1\endcsname}} \ion@deflocopts{autothousands}[true]{\csname ion@autothousands#1\endcsname} \ion@deflocopts{autothousandths}[true]{\csname ion@autothousandths#1\endcsname} +\ion@deflocopts{grplenthousands}{% + \def\@tempa{#1}% + \def\@tempb{reset}% + \ifx\@tempa\@tempb% + \ion@grplenthousandsreset% + \else% + \ion@grplencheck{#1}% + \ion@grplenthousands=#1% + \fi% +} +\ion@deflocopts{grplenthousandths}{% + \def\@tempa{#1}% + \def\@tempb{reset}% + \ifx\@tempa\@tempb% + \ion@grplenthousandthsreset% + \else% + \ion@grplencheck{#1}% + \ion@grplenthousandths=#1% + \fi% +} \newcommand*\ionumbersresetstyle{% \ionumbersstyle{comma=reset,point=reset,thousands=reset,% decimal=reset,thousandths=reset,exponent=reset,autothousands=reset,% - autothousandths=reset}} + autothousandths=reset,grplenthousands=reset,grplenthousandths=reset}} \AtEndOfPackage{\ionumbersresetstyle} \newcommand*\newionumbersthousands[2]{\expandafter\newcommand% \expandafter*\csname ion@thousands@#1\endcsname{\ionumbersoff{#2}}} @@ -655,6 +690,12 @@ \def\ion@thousands@sepa{} \def\ion@thousands@sepb{} \def\ion@thousands@sepc{} +\def\ion@thousands@sepd{} +\def\ion@thousands@sepe{} +\def\ion@thousands@sepf{} +\def\ion@thousands@sepg{} +\def\ion@thousands@seph{} +\def\ion@thousands@sepi{} \def\ion@thousandths@sep{} \newcommand{\ion@currnum@append}{% \ion@currnum@firstcharfalse% @@ -674,22 +715,34 @@ \ion@addto@macro{\ion@currnum}{\ion@thousands@sepb#1}% \or% \ion@addto@macro{\ion@currnum}{\ion@thousands@sepc#1}% + \or% + \ion@addto@macro{\ion@currnum}{\ion@thousands@sepd#1}% + \or% + \ion@addto@macro{\ion@currnum}{\ion@thousands@sepe#1}% + \or% + \ion@addto@macro{\ion@currnum}{\ion@thousands@sepf#1}% + \or% + \ion@addto@macro{\ion@currnum}{\ion@thousands@sepg#1}% + \or% + \ion@addto@macro{\ion@currnum}{\ion@thousands@seph#1}% + \or% + \ion@addto@macro{\ion@currnum}{\ion@thousands@sepi#1}% \fi% %% advance thousands counter \advance\ion@thousands@currpos by1\relax% - \ifnum\ion@thousands@currpos>3% + \ifnum\ion@thousands@currpos>\ion@grplenthousands% \ion@thousands@currpos=1% \fi% \else% %% push back (empty) separator and character - \ifnum\ion@thousandths@currpos=3% + \ifnum\ion@thousandths@currpos=\ion@grplenthousandths% \ion@addto@macro{\ion@currnum}{\ion@thousandths@sep#1}% \else% \ion@addto@macro{\ion@currnum}{#1}% \fi% %% advance thousandths counter \advance\ion@thousandths@currpos by1\relax% - \ifnum\ion@thousandths@currpos>3% + \ifnum\ion@thousandths@currpos>\ion@grplenthousandths% \ion@thousandths@currpos=1% \fi% \fi% @@ -707,6 +760,18 @@ \def\ion@thousands@sepb{\ion@thousands@curr}% \or% \def\ion@thousands@sepc{\ion@thousands@curr}% + \or% + \def\ion@thousands@sepd{\ion@thousands@curr}% + \or% + \def\ion@thousands@sepe{\ion@thousands@curr}% + \or% + \def\ion@thousands@sepf{\ion@thousands@curr}% + \or% + \def\ion@thousands@sepg{\ion@thousands@curr}% + \or% + \def\ion@thousands@seph{\ion@thousands@curr}% + \or% + \def\ion@thousands@sepi{\ion@thousands@curr}% \fi% \fi% \fi% -- cgit v1.2.3