summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/sepnum/sepnum-doc.tex
blob: 0a5ce06bb4ca5b0442c2397acb5d3a0c93ce7d3a (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
\documentclass[pagesize=auto, fontsize=12pt, DIV=11, parskip=half]{scrartcl}

\usepackage{fixltx2e}
\usepackage{etex}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[svgnames]{xcolor}
\usepackage{listings}
\usepackage{microtype}
\usepackage{hyperref}

\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}}
\newcommand*{\pkg}[1]{\textsf{#1}}
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}}
\makeatletter
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}}
\makeatother
\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle}
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}}

\addtokomafont{title}{\rmfamily}

\lstset{%
  language=[LaTeX]TeX,%
  columns=flexible,%
  upquote=true,%
  numbers=left,%
  basicstyle=\ttfamily,%
  keywordstyle=\color{Navy},%
  commentstyle=\color{DimGray},%
  stringstyle=\color{SeaGreen},%
  numberstyle=\scriptsize\color{SlateGray}%
}

\title{The \pkg{sepnum} package\thanks{This manual corresponds to \pkg{sepnum}~v2.0, dated~1996/09/05.}}
\subtitle{Separated numbers}
\author{Bernd Raichle\thanks{\mail{Raichle@Informatik.Uni-Stuttgart.de}}}
\date{1996/09/05}


\begin{document}

\maketitle

\begin{abstract}
  \noindent
  This package provides a means of formatting numbers
  with (a) a decimal separator different of the default (`.')
  and (b) a separator (default `,') every three digits.

  First version of this package was posted to the newsgroup
  `\texttt{de.comp.tex}' November 6th, 1995 (as `\pkg{printnum.sty}').
\end{abstract}


\section{Licensing condition}

This program may be redistributed and/or modified under the terms
of the \LaTeX\ Project Public License, either version~1.0 of this
license, or (at your option) any later version.
The latest version of this license is in \href{http://ctan.org/macros/latex/base/lppl.txt}{\texttt{CTAN:macros/latex/base/lppl.txt}}.


\section{Usage}

The macro
%
\begin{quote}
  \cmd{\sepnum}\marg{c}\marg{sbc}\marg{sac}\marg{number}
\end{quote}
%
produces the \meta{number} with the decimal point replaced by \meta{c}
and the separator \meta{sbc} every three digits in the integer part,
the separator \meta{sac} every three digits in the fractional part
of \meta{number}.  \cmd{\sepnum} is \emph{fully expandable} and \emph{not} fragile,
unless one of \meta{c}, \meta{sbc}, or \meta{sac} is.

\minisec{Example:}
%
\begin{itemize}
\item a non realistic example to show the capabilities of \cmd{\sepnum} \\
  \verb|\sepnum{,}{*}{-}{1234.5678}| $\Rightarrow$ 1*234,567-8
\item to print a number inserting small spaces each three digits \\
  \verb|\sepnum{.}{\,}{\,}{1234.5678}| $\Rightarrow$ 1\,234.567\,8
\end{itemize}


Additionally this package provides
%
\begin{quote}
  \cmd{\sepnumform}\marg{c}\marg{sbc}\marg{sac}\marg{\LaTeX-counter}
\end{quote}
%
to use \cmd{\sepnum} with a \LaTeX\ counter.


\minisec{Example (with a decimal comma in the print form \cmd{\the\meta{counter}}):}
%
\begin{lstlisting}
\newcounter{money}
\renewcommand{\themoney}{\sepnumform{,}{.}{}{money}}

\setcounter{money}{-1000}
You have \themoney{} left.
\end{lstlisting}
%
(For compatibility with `\pkg{printnum.sty}', the macros
\cmd{\printnum}\marg{number} and \cmd{\print\-numKomma}\slash\cmd{\printnumTrenner}
still exist.)


\section{See also}

\begin{itemize}
\item Package ``\pkg{comma.sty}'' by David Carlisle which provides
  similar features for integers only, i.\,e.\ it misses support
  for the decimal point/comma in fixed point numbers.
\item Package ``\pkg{numprint.sty}'' by Harald Harders supporting
  formatting of numbers given as \texttt{1234e5} in addition.
\end{itemize}

\end{document}