2

I found this link Using one group separator for integer part and another for decimal part (siunitx) the code from jfbu is almost perfect, except I need grouping of three on each side of the decimal.

So This code

    %% GROUPING BY FOUR GOING FROM THE LEFT TO THE RIGHT
    %% 1234567-->{1234}{567}

    \def\aegroupbyfourR #1{\romannumeral0\expandafter\aegroupbyfourR@a
                    \romannumeral-`0#1\relax\relax\relax\relax\dummy }

    % we first check here if "short", for technical reasons
    \def\aegroupbyfourR@a #1#2#3#4{\ifx #4\relax
        \expandafter\@firstoftwo
        \else\expandafter\@secondoftwo
        \fi
        {\aegroupbyfourR@short #1#2#3#4}{\aegroupbyfourR@b {{#1#2#3#4}}}}

    % space to feed the \romannumeral0. We need to check for emptiness
    %  
    \def\aegroupbyfourR@short #1\relax #2\dummy {\if\relax #1\relax
        \expandafter\@firstoftwo 
        \else\expandafter\@secondoftwo
        \fi { }{{#1}}}

    \def\aegroupbyfourR@b #1#2#3#4#5{\ifx #5\relax
        \expandafter\@firstoftwo
        \else\expandafter\@secondoftwo
        \fi
        {\aegroupbyfourR@c {#1}#2#3#4#5}{\aegroupbyfourR@b {#1{#2#3#4#5}}}}

    \def\aegroupbyfourR@c #1#2\relax #3\dummy {\if\relax #2\relax
        \expandafter\@firstoftwo 
        \else\expandafter\@secondoftwo
        \fi % Notice that #1 is never empty in this branch
        {#1}{#1{#2}}}

Needs to be modified to only three spaces.

$\aenum{+12504.312423593}$ --> +12,504.312 423 593

Mike
  • 31

0 Answers0