| 1 |
\documentclass[pagesize=auto, fontsize=12pt, DIV=11, parskip=half]{scrartcl} |
| 2 |
|
| 3 |
\usepackage{fixltx2e} |
| 4 |
\usepackage{etex} |
| 5 |
\usepackage{lmodern} |
| 6 |
\usepackage[T1]{fontenc} |
| 7 |
\usepackage{textcomp} |
| 8 |
\usepackage[svgnames]{xcolor} |
| 9 |
\usepackage{listings} |
| 10 |
\usepackage{microtype} |
| 11 |
\usepackage{hyperref} |
| 12 |
|
| 13 |
\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} |
| 14 |
\newcommand*{\pkg}[1]{\textsf{#1}} |
| 15 |
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} |
| 16 |
\makeatletter |
| 17 |
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} |
| 18 |
\makeatother |
| 19 |
\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle} |
| 20 |
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}} |
| 21 |
|
| 22 |
\addtokomafont{title}{\rmfamily} |
| 23 |
|
| 24 |
\lstset{% |
| 25 |
language=[LaTeX]TeX,% |
| 26 |
columns=flexible,% |
| 27 |
upquote=true,% |
| 28 |
numbers=left,% |
| 29 |
basicstyle=\ttfamily,% |
| 30 |
keywordstyle=\color{Navy},% |
| 31 |
commentstyle=\color{DimGray},% |
| 32 |
stringstyle=\color{SeaGreen},% |
| 33 |
numberstyle=\scriptsize\color{SlateGray}% |
| 34 |
} |
| 35 |
|
| 36 |
\title{The \pkg{sepnum} package\thanks{This manual corresponds to \pkg{sepnum}~v2.0, dated~1996/09/05.}} |
| 37 |
\subtitle{Separated numbers} |
| 38 |
\author{Bernd Raichle\thanks{\mail{[email protected]}}} |
| 39 |
\date{1996/09/05} |
| 40 |
|
| 41 |
|
| 42 |
\begin{document} |
| 43 |
|
| 44 |
\maketitle |
| 45 |
|
| 46 |
\begin{abstract} |
| 47 |
\noindent |
| 48 |
This package provides a means of formatting numbers |
| 49 |
with (a) a decimal separator different of the default (`.') |
| 50 |
and (b) a separator (default `,') every three digits. |
| 51 |
|
| 52 |
First version of this package was posted to the newsgroup |
| 53 |
`\texttt{de.comp.tex}' November 6th, 1995 (as `\pkg{printnum.sty}'). |
| 54 |
\end{abstract} |
| 55 |
|
| 56 |
|
| 57 |
\section{Licensing condition} |
| 58 |
|
| 59 |
This program may be redistributed and/or modified under the terms |
| 60 |
of the \LaTeX\ Project Public License, either version~1.0 of this |
| 61 |
license, or (at your option) any later version. |
| 62 |
The latest version of this license is in \href{http://ctan.org/macros/latex/base/lppl.txt}{\texttt{CTAN:macros/latex/base/lppl.txt}}. |
| 63 |
|
| 64 |
|
| 65 |
\section{Usage} |
| 66 |
|
| 67 |
The macro |
| 68 |
% |
| 69 |
\begin{quote} |
| 70 |
\cmd{\sepnum}\marg{c}\marg{sbc}\marg{sac}\marg{number} |
| 71 |
\end{quote} |
| 72 |
% |
| 73 |
produces the \meta{number} with the decimal point replaced by \meta{c} |
| 74 |
and the separator \meta{sbc} every three digits in the integer part, |
| 75 |
the separator \meta{sac} every three digits in the fractional part |
| 76 |
of \meta{number}. \cmd{\sepnum} is \emph{fully expandable} and \emph{not} fragile, |
| 77 |
unless one of \meta{c}, \meta{sbc}, or \meta{sac} is. |
| 78 |
|
| 79 |
\minisec{Example:} |
| 80 |
% |
| 81 |
\begin{itemize} |
| 82 |
\item a non realistic example to show the capabilities of \cmd{\sepnum} \\ |
| 83 |
\verb|\sepnum{,}{*}{-}{1234.5678}| $\Rightarrow$ 1*234,567-8 |
| 84 |
\item to print a number inserting small spaces each three digits \\ |
| 85 |
\verb|\sepnum{.}{\,}{\,}{1234.5678}| $\Rightarrow$ 1\,234.567\,8 |
| 86 |
\end{itemize} |
| 87 |
|
| 88 |
|
| 89 |
Additionally this package provides |
| 90 |
% |
| 91 |
\begin{quote} |
| 92 |
\cmd{\sepnumform}\marg{c}\marg{sbc}\marg{sac}\marg{\LaTeX-counter} |
| 93 |
\end{quote} |
| 94 |
% |
| 95 |
to use \cmd{\sepnum} with a \LaTeX\ counter. |
| 96 |
|
| 97 |
|
| 98 |
\minisec{Example (with a decimal comma in the print form \cmd{\the\meta{counter}}):} |
| 99 |
% |
| 100 |
\begin{lstlisting} |
| 101 |
\newcounter{money} |
| 102 |
\renewcommand{\themoney}{\sepnumform{,}{.}{}{money}} |
| 103 |
|
| 104 |
\setcounter{money}{-1000} |
| 105 |
You have \themoney{} left. |
| 106 |
\end{lstlisting} |
| 107 |
% |
| 108 |
(For compatibility with `\pkg{printnum.sty}', the macros |
| 109 |
\cmd{\printnum}\marg{number} and \cmd{\print\-numKomma}\slash\cmd{\printnumTrenner} |
| 110 |
still exist.) |
| 111 |
|
| 112 |
|
| 113 |
\section{See also} |
| 114 |
|
| 115 |
\begin{itemize} |
| 116 |
\item Package ``\pkg{comma.sty}'' by David Carlisle which provides |
| 117 |
similar features for integers only, i.\,e.\ it misses support |
| 118 |
for the decimal point/comma in fixed point numbers. |
| 119 |
\item Package ``\pkg{numprint.sty}'' by Harald Harders supporting |
| 120 |
formatting of numbers given as \texttt{1234e5} in addition. |
| 121 |
\end{itemize} |
| 122 |
|
| 123 |
\end{document} |