File: comma.plt

package info (click to toggle)
tralics 2.14.4-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch, wheezy
  • size: 17,152 kB
  • ctags: 8,260
  • sloc: cpp: 49,403; xml: 18,145; sh: 140; makefile: 118
file content (54 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%% -*- latex -*-
\ProvidesPackage{comma}
      [2007/12/29 v1.0 Insert commas every three digits (DPC)]

%% $Id: comma.plt,v 2.1 2008/02/19 16:21:17 grimm Exp $
%% TRALICS, copyright (C) INRIA/apics (Jose' Grimm) 2007
%% Licensed under the CeCILL free software license 
%% (See the file COPYING in the main directory for details)
%% Original Copyright LPPL, by
%%% David Carlisle david@dcarlisle.demon.co.uk
%%%

% #1 is the name of a LaTeX counter.
\def\commaform#1{%
  \expandafter\@commaform\csname c@#1\endcsname}

\def\commaformtoken{,}

\def\@commaform#1{%
  \expandafter\@commaaux
    \expandafter{\expandafter}%
    \number\@comma@ux#1%
    \relax\@empty\@empty}
\def\@comma@ux#1{#1 }


\def\@commaaux#1#2#3#4{%
  \ifx\relax#2%
    \addcomma#1\relax
  \else
    \ifx\relax#3%
      \addcomma\@empty\@empty#1#2\relax
    \else
      \ifx\relax#4%
        \addcomma\@empty#1#2#3\relax
      \else
         \@commaauxafterfi{#1#2#3#4}%
      \fi
    \fi
  \fi}


\def\@commaauxafterfi#1\fi\fi\fi{%
  \fi\fi\fi\@commaaux{#1}}

\def\addcomma#1#2#3#4{%
  #1#2#3%
  \if#4\relax
  \else
    \commaformtoken
    \expandafter\addcomma\expandafter#4%
  \fi}
 
\endinput