From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/comma/README | 6 +++ macros/latex/contrib/comma/comma.pdf | Bin 0 -> 157472 bytes macros/latex/contrib/comma/comma.sty | 101 +++++++++++++++++++++++++++++++++++ macros/latex/contrib/comma/comma.tex | 49 +++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 macros/latex/contrib/comma/README create mode 100644 macros/latex/contrib/comma/comma.pdf create mode 100644 macros/latex/contrib/comma/comma.sty create mode 100644 macros/latex/contrib/comma/comma.tex (limited to 'macros/latex/contrib/comma') diff --git a/macros/latex/contrib/comma/README b/macros/latex/contrib/comma/README new file mode 100644 index 0000000000..9f6d92f5e3 --- /dev/null +++ b/macros/latex/contrib/comma/README @@ -0,0 +1,6 @@ +comma.sty: + Adds a new possibility for printing counter values in addition + to \arabic, \roman, etc. + \commaform inserts a comma every three digits, as in 12,345. + It may be easily customised to insert any other TeX command + (such as a thin space `\,') instead of a comma. diff --git a/macros/latex/contrib/comma/comma.pdf b/macros/latex/contrib/comma/comma.pdf new file mode 100644 index 0000000000..8a9e930d34 Binary files /dev/null and b/macros/latex/contrib/comma/comma.pdf differ diff --git a/macros/latex/contrib/comma/comma.sty b/macros/latex/contrib/comma/comma.sty new file mode 100644 index 0000000000..26f6c4ac62 --- /dev/null +++ b/macros/latex/contrib/comma/comma.sty @@ -0,0 +1,101 @@ + +%%% comma.sty +%%% +%%% Copyright 1996 1997 David Carlisle +%%% +%%% This file may be distributed under the terms of the LPPL. +%%% See 00readme.txt for details. +%%% +%%% David Carlisle david@dcarlisle.demon.co.uk +%%% +\ProvidesPackage{comma} + [1997/12/15 v1.2 Insert commas every three digits (DPC)] + +%% This package provides a means of producing numbers with a separator +%% (by default a comma) every three digits. +%% +%% Given a LaTeX counter (eg section) +%% +%% \renewcommand\thesection{\commaform{section}} +%% +%% If section is 12345, \thesection will now print as 12,345 +%% +%% If you want something other than a comma, for instance a thin +%% space, or a full word space, redefine \commaformtoken, for instance +%% \renewcommand\commaformtoken{\,} +%% \renewcommand\commaformtoken{ } +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% v1.0 1996/09/05 +% v1.1 1997/07/10 +% v1.2 1997/12/15 + + +% #1 is the name of a LaTeX counter. +\def\commaform#1{% + \expandafter\@commaform\csname c@#1\endcsname} + +% The token to place every three digits. +\def\commaformtoken{,} + +% Internal version. +% #1 is the number. It may be a TeX count register, eg \count@ +% or an explicit number such as `1234'. +% v1.1 use \relax not empty so explicit digits need not end with a space +% token. +% (This \relax will be eaten by the parser, second two must be \@empty) +% v1.2 add \@comma@ux for very long digit strings (requested on c.t.t) +\def\@commaform#1{% + \expandafter\@commaaux + \expandafter{\expandafter}% + \number\@comma@ux#1% + \relax\@empty\@empty} + + +% If \@commaform is given a very long digit string then it may be +% too large for \number, so make sure \number only applies to the first +% token. This may leave a spurious space token, but it will be eaten +% by the \@commaaux parsing, which uses non delimited arguments, and +% so skips space tokens. +% Added in v1.2. +\def\@comma@ux#1{#1 } + +% Wander down to the end of the number and then see where +% \relax turns up. +% #1 List of digits already seen (initially {} ) +% #2#3#4 next three digits (or \@empty) in list. +\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} + + +% Get out of the nested \if before recursing down the list of digits. +% #1 list of digits seen so far. +\def\@commaauxafterfi#1\fi\fi\fi{% + \fi\fi\fi\@commaaux{#1}} + +% Go down adding a `comma' every three tokens. The list will have +% been padded with 0 1 or 2 \@empty at the start so there is +% definitely a multiple of three tokens before the \relax. +% #1#2#3 are next three digits +% #4 is next digit, or \relax to stop +\def\addcomma#1#2#3#4{% + #1#2#3% + \if#4\relax + \else + \commaformtoken + \expandafter\addcomma\expandafter#4% + \fi} + diff --git a/macros/latex/contrib/comma/comma.tex b/macros/latex/contrib/comma/comma.tex new file mode 100644 index 0000000000..41760a7b54 --- /dev/null +++ b/macros/latex/contrib/comma/comma.tex @@ -0,0 +1,49 @@ +\documentclass[DIV=9, fontsize=14pt, parskip=full, pagesize=auto]{scrartcl} + +\usepackage{fixltx2e} +\usepackage{etex} +\usepackage{xspace} +\usepackage{lmodern} +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\usepackage{microtype} +\usepackage[unicode=true]{hyperref} + +\newcommand*{\pkg}[1]{\textsf{#1}} +\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} +\makeatletter +\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} +\makeatother + +\addtokomafont{title}{\rmfamily} +\topsep=\dimexpr0.8ex - \parskip\relax + +\title{The \pkg{comma} package\thanks{This manual corresponds to \pkg{comma}~v1.2, dated~1997/12/15.}} +\author{David Carlisle} +\date{1997/12/15} + + +\begin{document} + +\maketitle + +This package provides a means of producing numbers with a separator +(by default a comma) every three digits. + +Given a \LaTeX\ counter (eg \texttt{section}) +% +\begin{verbatim} +\renewcommand\thesection{\commaform{section}} +\end{verbatim} +% +If \texttt{section} is 12345, \cmd{\thesection} will now print as 12,345 + +If you want something other than a comma, for instance a thin +space, or a full word space, redefine \cmd{\commaformtoken}, for instance +% +\begin{verbatim} +\renewcommand\commaformtoken{\,} +\renewcommand\commaformtoken{ } +\end{verbatim} + +\end{document} -- cgit v1.2.3