summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/currency
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/currency
Initial commit
Diffstat (limited to 'macros/latex/contrib/currency')
-rw-r--r--macros/latex/contrib/currency/README.md56
-rw-r--r--macros/latex/contrib/currency/currency.dtx363
-rw-r--r--macros/latex/contrib/currency/currency.ins55
-rw-r--r--macros/latex/contrib/currency/currency.pdfbin0 -> 175744 bytes
-rw-r--r--macros/latex/contrib/currency/currency_doc.pdfbin0 -> 529253 bytes
-rw-r--r--macros/latex/contrib/currency/currency_doc.tex439
6 files changed, 913 insertions, 0 deletions
diff --git a/macros/latex/contrib/currency/README.md b/macros/latex/contrib/currency/README.md
new file mode 100644
index 0000000000..f95dbead14
--- /dev/null
+++ b/macros/latex/contrib/currency/README.md
@@ -0,0 +1,56 @@
+# currency — Formatting currencies
+
+
+## Overview
+
+`currency` is a LaTeX package that facilitates the formatting
+of currencies (amounts and units). It is based on the `siunitx` package
+for printing numbers.
+
+For instance, this code in the preamble defines a EUR monetary unit
+
+``` latex
+\DefineCurrency{EUR}{name={euro},plural={euros},symbol={\euro},iso={EUR},kind=iso,base=2}
+```
+
+that will be used later by
+
+``` latex
+\dEUR{123} or \dEUR[kind=plural]{123}
+```
+to print `123 EUR or 123 euros`. There are many ways to change to output
+(the symbol could be put in front of the amount as required by some
+typographical conventions, ...).
+
+
+See the [documentation](https://github.com/antoinelejay/currency/blob/master/currency_doc.pdf)
+for examples and installation instructions.
+
+## License
+
+This work may be distributed and/or modified under the conditions of the
+[LaTeX Project Public License](http://www.latex-project.org/lppl.txt) (LPPL),
+version 1.3 or later.
+
+Please use the project's GitHub site at <https://github.com/antoinelejay/currency>
+for suggestions, feature requests, and bug reports.
+
+## Installation
+
+```
+pdflatex currency.ins
+pdflatex currency.dtx
+makeindex -s gind.ist currency.idx
+makeindex -s gglo.ist -o currency.gls currency.glo
+pdflatex currency.dtx
+
+pdflatex currency_doc.tex
+biber currency_doc
+pdflatex currency_doc.tex
+```
+
+## Availability
+
+This package is available on [github](https://github.com/antoinelejay/currency) and on
+[CTAN](http://www.ctan.org/tex-archive/macros/latex/contrib/currency)
+
diff --git a/macros/latex/contrib/currency/currency.dtx b/macros/latex/contrib/currency/currency.dtx
new file mode 100644
index 0000000000..4824ba50db
--- /dev/null
+++ b/macros/latex/contrib/currency/currency.dtx
@@ -0,0 +1,363 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2018 by Antoine Lejay
+% -------------------------------------------------------
+%
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in:
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{currency.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+%<package>\ProvidesPackage{currency}
+%<*package>
+ [2018/10/22 v0.4 .dtx currency file]
+%</package>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{currency}
+\usepackage{url}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{currency.dtx}
+ \PrintChanges
+ \PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{0}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \changes{v0.1}{2016/05/25}{Initial version}
+% \changes{v0.2}{2016/06/15}{Adding vXXX as an alias for dXXX}
+% \changes{v0.3}{2017/07/04}{Dropping spurious space in the definition of cXXX}
+% \changes{v0.4}{2018/10/22}{Change DeclareDocumentCommand for compability with TexLive 2018}
+%
+%
+% \GetFileInfo{currency.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment}
+%
+%
+% \title{The \textsf{currency} package\thanks{This document
+% corresponds to \textsf{currency}~\fileversion, dated \filedate.}}
+% \author{Antoine Lejay \\ \texttt{Antoine.Lejay@univ-lorraine.fr}}
+%
+% \maketitle
+%
+%
+% \DefineCurrency{EUR}{name={euro},plural-name={euros},symbol={\euro},iso={EUR},kind=iso}
+% \DefineCurrency{USD}{name={dollar},plural-name={dollars},symbol={\$},iso={USD},kind=iso}
+%
+% \section{Introduction}
+%
+% This package creates macros for defined currencies which follow
+% the ISO 4217 codes, with various formatting options for both
+% the currency (code, symbols, names, ...) and the numbers (using \texttt{siunitx}).
+%
+% The currency code ISO 4217 specifies the code of the currency as
+% a three-letters code. The first two ones are the code of the country
+% according to ISO 3166. The last one is the name of the currency name.
+%
+% \section{Licence}
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% \url{http://www.latex-project.org/lppl.txt}
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Antoine Lejay.
+%
+% \section{Documentation and sources}
+%
+% This package is documented in \texttt{currency\_doc}.
+%
+% A source of this package is hosted in
+% \begin{center}
+% \url{https://github.com/antoinelejay/currency}
+% \end{center}
+%
+%
+%
+% \section{Implementation}
+%
+% \subsection{Dependencies}
+%
+% \begin{macrocode}
+\RequirePackage{siunitx}
+\RequirePackage{pgfkeys}
+\RequirePackage{etoolbox}
+\RequirePackage{xparse}
+\RequirePackage{expl3}
+\RequirePackage{textcomp}
+\RequirePackage{eurosym}
+% \end{macrocode}
+% The unit could be printed before or after
+% \begin{macrocode}
+\newif\ifcurrencynumber
+\pgfkeys{/currency/.cd,number/.is if=currencynumber,number=true}
+\newif\ifprintbefore
+\pgfkeys{/currency/pre/.is if=printbefore}
+\pgfkeys{/currency/name/.initial=ZZZ}
+\pgfkeys{/currency/symbol/.initial=\textcurrency}
+% \end{macrocode}
+%
+% Defines a style currency, which is general and empty.
+% The styles are then called in order
+% - the currency style
+% - currency (initially empty)
+% - the options passed to the command
+
+% \begin{macrocode}
+\pgfkeys{/currency/currency/.style={}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\newcommand{\CurrencySetup}[1]{%
+ \pgfkeys{/currency/currency/.style={#1}}%
+}
+\newcommand{\CurrencySetupAppend}[1]{%
+ \pgfkeys{/currency/currency/.append style={#1}}%
+}
+% \end{macrocode}
+%
+% \subsection{Names and symbols definitions}
+%
+% The commands \verb|\currencyName|, \verb|\currencyNames|, \verb|\currencyISO| and \verb|\currencySymbol|
+% are used internally every time a currency is called to define the name, the plural,
+% the ISO code and the symbol associated to a currency.
+%
+% \begin{macrocode}
+\pgfkeys{/currency/name/.store in=\currencyName}
+\pgfkeys{/currency/plural/.store in=\currencyNames}
+\pgfkeys{/currency/plural/.initial=\currencyName s}
+\pgfkeys{/currency/iso/.store in=\currencyISO}
+\pgfkeys{/currency/symbol/.store in=\currencySymbol}
+% \end{macrocode}
+%
+% \subsection{Keys for formatting}
+%
+% Several keys are devoted to insert tokens before or after th unit
+% and the amount, set up the font, ...
+%
+% \begin{macrocode}
+% between the symbol and the num if before
+\pgfkeys{/currency/pre-between/.initial={~}}
+% between the symbol and the num if after
+\pgfkeys{/currency/post-between/.initial={~}}
+% tokens that are inserted before
+\pgfkeys{/currency/before/.initial={}}
+% append to before
+\pgfkeys{/currency/before+/.code={\pgfkeys{/currency/before/.append={#1}}}}
+% prepend to before
+\pgfkeys{/currency/before</.code={\pgfkeys{/currency/before/.prefix={#1}}}}
+\pgfkeys{/currency/after/.initial={}} % tokens that are inserted after
+% append to after
+\pgfkeys{/currency/after+/.code={\pgfkeys{/currency/after/.append={#1}}}}
+% prepend to after
+\pgfkeys{/currency/after</.code={\pgfkeys{/currency/after/.prefix={#1}}}}
+\pgfkeys{/currency/font/.initial={}} % for setting up the fonts
+% append to the font definition
+\pgfkeys{/currency/font+/.code={\pgfkeys{/currency/font/.append={#1}}}}
+% the prefix before the name
+\pgfkeys{/currency/prefix/.initial={}}
+% \end{macrocode}
+%
+% Several options are given for printing the kind of unit (\verb|iso|,
+% \verb|plural|, \verb|name|, \verb|symbol|).
+% \begin{macrocode}
+%
+\pgfkeys{/currency/kind/.is choice}
+\pgfkeys{/currency/kind/iso/.code=%
+ {\def\currencyunit{\currencyISO}}}
+\pgfkeys{/currency/kind/plural/.code=%
+ {\def\currencyunit{\currencyNames}\printbeforefalse}}
+\pgfkeys{/currency/kind/name/.code=%
+ {\def\currencyunit{\currencyName}\printbeforefalse}}
+\pgfkeys{/currency/kind/symbol/.code=%
+ {\def\currencyunit{\currencySymbol}}}
+\pgfkeys{/currency/kind=iso}
+% \end{macrocode}
+%
+% Options are also define for printing the cents (\verb|true|, \verb|false|, \verb|always|).
+%
+% \begin{macrocode}
+\pgfkeys{/currency/cents/.is choice}
+\pgfkeys{/currency/cents/true/.code=%
+ {\sisetup{zero-decimal-to-integer=true}}}
+\pgfkeys{/currency/cents/false/.code=%
+ {\sisetup{zero-decimal-to-integer=true,round-precision=0}}}
+\pgfkeys{/currency/cents/always/.code=%
+ {\sisetup{zero-decimal-to-integer=false,round-integer-to-decimal=true}}}
+\pgfkeys{/currency/cents=true}
+% \end{macrocode}
+%
+% \subsection{Dealing with unknown keys}
+%
+% The unknown keys are passed to the \verb|\num| command of \texttt{siunitx}, which use the \LaTeX3 syntax
+% and not the pgf one.
+%
+% \begin{macrocode}
+\ExplSyntaxOn
+\pgfkeys{/currency/.unknown/.code={%
+\edef\Unknown{\pgfkeyscurrentname=\pgfkeyscurrentvalue}%
+\keys_set:nV {siunitx} {\Unknown}%
+ }}%
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% \subsection{Setting the precision}
+%
+% The key \verb|base| is used to set the precision.
+% Its value is passed to the key \verb|round-precision| of \verb|siunitx|.
+%
+% \begin{macrocode}
+\ExplSyntaxOn
+\pgfkeys{/currency/base/.code={%
+\edef\SetPrecision{round-precision=\pgfkeyscurrentvalue}%
+\keys_set:nV {siunitx} {\SetPrecision}%
+ }}%
+\ExplSyntaxOff
+% \end{macrocode}
+%
+% \subsection{Defining new currencies}
+%
+% The first argument is the name of the currency, normally its ISO symbol (3 letters).
+% This commands defines two global commands.
+%
+% \begin{macro}{\displayCurrency}
+%
+% This is a generic macro for displaying the currency symbol and amount. This macro does not aim
+% at being called directly.
+%
+%
+% \begin{macrocode}
+\ExplSyntaxOn
+\DeclareDocumentCommand{\displayCurrency}{m o m}{
+\begingroup%
+% default parameters, to put outside
+\sisetup{round-mode=places,round-precision=2}
+\IfNoValueTF{#2}%
+ {\pgfkeys{/currency/.cd,#1,currency}}%
+ {\pgfkeys{/currency/.cd,#1,currency,#2}}%
+\ifbool{currencynumber}%
+ {\sisetup{parse-numbers=true}}%
+ {\sisetup{parse-numbers=false}}%
+\edef\value{#3}% store the value of the currency
+%
+\ifprintbefore%
+% true clause / print the unit before
+\pgfkeys{/currency/font}%
+\pgfkeys{/currency/before}%
+\text{\pgfkeys{/currency/prefix}\currencyunit}%
+\pgfkeys{/currency/pre-between}%
+\num{\value}\pgfkeys{/currency/after}%
+\else% print the unit after
+\pgfkeys{/currency/font}%
+\pgfkeys{/currency/before}%
+\num{\value}%
+\pgfkeys{/currency/post-between}%
+\text{\pgfkeys{/currency/prefix}\currencyunit}%
+\pgfkeys{/currency/after}%
+\fi%
+\endgroup%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\displayCurrencySymbol}
+%
+% This is a generic macro for displaying the currency symbol. This macro does not aim
+% at being called directly.
+%
+% \begin{macrocode}
+\DeclareDocumentCommand{\displayCurrencySymbol}{m o}{
+\begingroup%
+ \IfNoValueTF{#2}%
+ {\pgfkeys{/currency/.cd,#1,currency}}%
+ {\pgfkeys{/currency/.cd,#1,currency,#2}}%
+ \pgfkeys{/currency/font}%
+ \pgfkeys{/currency/before}%
+ \text{\pgfkeys{/currency/prefix}\currencyunit}%
+ \pgfkeys{/currency/after}%
+\endgroup%
+}
+% \end{macrocode}
+% \end{macro}
+\ExplSyntaxOff
+%
+% \begin{macro}{\DefineCurrency}
+% Define the parameters for a new currency. The first parameter is
+% a three letters code of type \verb|XXX| (actually, it should by any suitable word).
+% Global commands \verb|\dXXX|
+% (for printing currency with an amount)
+% and \verb|\cXXX| (for printing only the symbols) are then defined, as
+% well as a style under the pgfkey \verb|/currency/XXX|.
+%
+% \begin{macrocode}
+\newcommand{\DefineCurrency}[2]{%
+\pgfkeys{/currency/#1/.style={#2}}%%
+% define the currency with digits as \dXXX
+\csgdef{d#1}{\displayCurrency{#1}}
+% end of \dXXX definition
+% define the currency symbol as \cXXX with one optional argument
+% \global\expandafter\DeclareDocumentCommand\csname c#1\endcsname{o}{%
+\csgdef{c#1}{\displayCurrencySymbol{#1}}
+% end of \cXXX definition
+}%
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Predefined styles}
+%
+% Some styles are defined to shorten the typesetting.
+%
+% \begin{macrocode}
+\pgfkeys{/currency/@iso/.style={kind=iso}}
+\pgfkeys{/currency/@symb/.style={kind=symbol}}
+\pgfkeys{/currency/@sy/.style={kind=symbol}}
+\pgfkeys{/currency/@name/.style={kind=name}}
+\pgfkeys{/currency/@na/.style={kind=name}}
+\pgfkeys{/currency/@plural/.style={kind=plural}}
+\pgfkeys{/currency/@pl/.style={kind=plural}}
+\pgfkeys{/currency/no-parse/.style={number=false}}
+% \end{macrocode}
+%
+% \Finale
+\endinput
diff --git a/macros/latex/contrib/currency/currency.ins b/macros/latex/contrib/currency/currency.ins
new file mode 100644
index 0000000000..bd59192b1a
--- /dev/null
+++ b/macros/latex/contrib/currency/currency.ins
@@ -0,0 +1,55 @@
+%%
+%% Copyright (C) 2018 by Antoine Lejay
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3 of this license
+%% or (at your option) any later version. The latest version of this
+%% license is in:
+%%
+%% http://www.latex-project.org/lppl.txt
+%%
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{currency}
+
+\preamble
+
+This is a generated file.
+
+Copyright (C) 2018 by Scott Lejay
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3 of this license
+or (at your option) any later version. The latest version of this
+license is in:
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX version
+2005/12/01 or later.
+
+\endpreamble
+
+\generate{\file{currency.sty}{\from{currency.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* currency.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file skeleton.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/macros/latex/contrib/currency/currency.pdf b/macros/latex/contrib/currency/currency.pdf
new file mode 100644
index 0000000000..bf71b7f0fa
--- /dev/null
+++ b/macros/latex/contrib/currency/currency.pdf
Binary files differ
diff --git a/macros/latex/contrib/currency/currency_doc.pdf b/macros/latex/contrib/currency/currency_doc.pdf
new file mode 100644
index 0000000000..764a701038
--- /dev/null
+++ b/macros/latex/contrib/currency/currency_doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/currency/currency_doc.tex b/macros/latex/contrib/currency/currency_doc.tex
new file mode 100644
index 0000000000..a6cc83efcd
--- /dev/null
+++ b/macros/latex/contrib/currency/currency_doc.tex
@@ -0,0 +1,439 @@
+\documentclass[12pt,add-index]{cnltx-doc}
+\usepackage[T1]{fontenc}
+\usepackage[english]{babel}
+\usepackage[utf8]{inputenc}
+\usepackage{csquotes}
+\usepackage{currency}
+\usepackage{enumitem}
+\usepackage{filecontents}
+\usepackage[
+backend=biber,
+%style=cnltx, % incompatible with biblatex 3.3
+sortlocale=en_EN,
+indexing=cite,
+useprefix]{biblatex}
+\usepackage{nicefrac}
+
+\addbibresource{\jobname.bib}
+
+\newnote*\doccorrectedsinceversion[1]{Documentation corrected in version~#1}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{filecontents*}{\jobname.bib}
+@online{iso,
+ author = {{ISO committee}},
+ title = {Currency codes - ISO 4217},
+ url = {http://www.iso.org/iso/home/standards/currency_codes.htm},
+ year = {2015},
+}
+
+@online{iso:wikipedia,
+ editor = {Wikipedia},
+ title = {ISO 4217},
+ url = {https://en.wikipedia.org/wiki/ISO_4217},
+ year = {2015},
+}
+
+@package{siunitx,
+ author = {Wright, Joseph},
+ title = {\texttt{siunitx} — A comprehensive (SI) units package},
+ date = {2014-10-28},
+ note = {Version 2.6d},
+}
+
+@package{translations,
+ author = {Niederberger, Clemens},
+ title = {\texttt{translations}, Internationalization of \LaTeX2e Packages},
+ date = {2017-05-16},
+ note = {Version 1.6},
+}
+
+\end{filecontents*}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\setcnltx{
+ package = {currency},
+ info = {Print monetary units} ,
+ url = https://github.com/antoinelejay/currency.git ,
+ authors = Antoine Lejay,
+ email = antoine.lejay@univ-lorraine.fr ,
+ abstract = {%
+ This packages aims at typesetting monetary units in a consistent way.
+ } ,
+ add-cmds =
+ {
+ dXXX,cXXX,CurrencySetup
+ } ,
+ add-silent-cmds = {
+ } ,
+ index-setup = { othercode=\footnotesize, level=\section , noclearpage } ,
+ makeindex-setup = { columns=3, columnsep=1em }
+}
+
+% Some currencies definition
+\DefineCurrency{EUR}{name={euro},plural={euros},symbol={\euro},iso={EUR},kind=iso,base=2}
+\DefineCurrency{USD}{name={dollar},plural={dollars},symbol={\$},iso={USD},kind=iso,base=2}
+\DefineCurrency{JPY}{name={yen}, plural={yens}, symbol={\textyen}, iso={JPY}, kind=iso,cents=false}
+\DefineCurrency{GBP}{name={pound},pre=true,plural={pounds}, symbol={\pounds}, iso={GBP}, kind=iso,base=2}
+
+
+\begin{document}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Introduction
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Introduction}
+
+Strangely enough, it seems that no package deals with a conveninent,
+normalized way to print monetary units and values. Built on the top
+of the \pkg{siunitx}, this package
+then aims at providing a consistant and coherent way to format such
+quantities. In particular, we consider printing values and unit
+\begin{itemize}[noitemsep=0pt,topsep=0pt]
+\item In the ISO format (ISO 4217),
+\item In their usual name (dollar, \cEUR[kind=name], ...), singular and plurals,
+\item Using their ususal symbols (\$, \cEUR[kind=symbol],...).
+\end{itemize}
+
+The currency code ISO 4217 specifies the code of the currency as
+a three-letters code. The first two ones are the code of the country
+according to ISO 3166. The last one is the name of the currency name.
+
+This package creates macros for defined currencies which follow
+the ISO 4217 codes.
+
+This package is then useful for current monetary units, using
+the decimal systems and cents, written in western format.
+Non decimal systems such as
+the \emph{pound shilling pennies} are not supported.
+
+\section{Licence and Requirements}
+\license
+
+The \pkg*{currency} package needs and thus loads the packages
+\pkg{siunitx}, \pkg{pgfkeys}, \pkg{etoolbox}, \pkg{xparse},
+\pkg{expl3}, \pkg{textcomp} and \pkg{eurosym}.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Currency definition
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{Currency definition}
+
+\begin{commands}
+ \command{DefineCurrency}[\marg{ISO}\marg{maps}]
+ defines a new currency (there is no warning if a currency is being redefined).
+\end{commands}
+
+A new currency is defined with this command. The argument \Darg{ISO}
+is the ISO format (a unique code in three letters based on country codes \cite{iso,iso:wikipedia}, \eg, USD
+for \emph{United States Dollar}), or any suitable name from which commands will be created.
+Its characteristics are defined through key-values pairs, the so-called \Darg{map}.
+
+When \verb|XXX| is the ISO code (or any other code), it defines
+two commands \verb|\dXXX| and \verb|\cXXX| for using these units in the text.
+These commands are defined globally.
+See Section~\ref{sec:using}.
+
+
+For example, to define the US dollars, we set
+
+\begin{sourcecode}
+ \DefineCurrency{USD}{name={dollar},plural={dollars},iso={USD},kind=iso,symbol={\$}}
+\end{sourcecode}
+
+
+Other styles may be defined through \cs*{pgfkeys} by following this example:
+\begin{example}
+ \pgfkeys{/currency/my style/.style={locale=US,kind=plural}}
+ \dUSD[my style]{100.10}
+\end{example}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\paragraph*{Key-values when defining or using a currency.}
+
+Several key-values pair are defined. Since this package relies on \pkg{siunitx},
+it is also possible to use any key-values from this latest package, for example
+to control the ways the values are printed (separators, ...).
+
+\begin{options}
+ \keyval{name}{name}\Default{ZZZ} The name of the currency (\eg, dollar, yen, ...).
+ \keyval{plural}{plural}\Default{\textit{name} s} The plural form of the name of the currency.
+ \keyval{iso}{iso} The ISO code of the currency.
+ \keyval{symbol}{symbol}\Default{\textcurrency} The symbol for the currency, if any (\eg, \cEUR[kind=symbol], \cUSD[kind=symbol], ...).
+ \keyval{pre-between}{tokens}\Default{no break space}
+ The tokens that are placed between the name and the value when the name
+ is printed before.
+ \keyval{post-between}{tokens}\Default{no break space}
+ The tokens that are placed between the name and the value when the name
+ is printed after.
+ \keyval{before}{tokens}\Default{} What is printed before.
+ \keyval{before+}{tokens} Append the content to \option{before}.
+ \keyval{before<}{tokens} Prepend the content to \option{before}.
+ \keyval{font}{tokens} For setting up the font which is used for both the unit and the amount (previous uses of \option{font} are overrided).
+ \keyval{font+}{tokens} Add the content to \option{font}.
+ \keyval{after}{tokens} What is printed after.
+ \keyval{after+}{tokens} Append to what is print after.
+ \keyval{after<}{tokens} Prepend to what is print after.
+ \keyval{prefix}{tokens}\Default What is printed before the name (\eg, k, M, ...).
+ \keychoice{kind}{\default{iso},plural,name,symbol}
+ The representation of the monetary unit.
+ \keychoice{cents}{\default{true},false,always}
+ Control the way the cents are printed.
+ \keychoice{pre}{true,\default{false}} Select if the unit should be print before or after the value (only for ISO code and symbols).
+ \keybool{number} Parse the values (interface to \option{parse-numbers} from \pkg{siunitx}).
+
+ \keyval{base}{integer}\Default{2} Number of digits for the cents.
+\end{options}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% Examples
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\paragraph*{Examples}
+
+No currency are actually defined in \pkg{currency}.
+Euros, US dollars, yens and pounds could be defined by
+\begin{sourcecode}
+ \DefineCurrency{EUR}{name={euro}, plural={euros}, symbol={\euro}, iso={EUR}, kind=iso}
+ \DefineCurrency{USD}{name={dollar}, plural={dollars}, symbol={\$}, iso={USD}, kind=iso}
+ \DefineCurrency{JPY}{name={yen}, plural={yens}, symbol={\textyen}, iso={JPY}, kind=iso,cents=false}
+ \DefineCurrency{GBP}{name={pound},pre=true,plural={pounds}, symbol={\pounds}, iso={GBP}, kind=iso}
+\end{sourcecode}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% Using currencies
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{Using currencies}
+\label{sec:using}
+
+\subsection{Using currencies}
+
+Currencies are used with or without amounts. They could also be changed locally.
+
+\begin{commands}
+ \command{CurrencySetup}[\marg{maps}]
+ This command defines a \emph{style} in the sense of \pkg{pgfkeys}, that
+ is a series of keys-values pairs.
+ These maps are exectued after
+ the ones defining the format of the currency but before the optional
+ argument passed to \cs{dXXX} or \cs{cXXX} where \texttt{XXX} is
+ the ISO 4217 code of the currency. It could be used to change locally
+ the setting of a currency. Using this command overrides the previous settings of
+ \cs*{CurrencySetup}. The command \cs{CurrencySetupAppend} append to the current style.:w
+ The style is stored in \verbcode|/currency/currency/.style|.
+ \command{CurrencySetupAppend}[\marg{maps}] Similar to \cs{CurrencySetup} but
+ append the style.
+ \doccorrectedsinceversion{0.2}
+ \command{cXXX}[\oarg{maps}] Print only the monetary unit with currency code \texttt{XXX}
+ (mnemonic \textit{c} stands for \textit{currency}).
+ \command{dXXX}[\oarg{maps}\marg{value}] Print the value with the monetary unit with currency code \texttt{XXX} (mnemonic \textit{d} stands for \textit{display}).
+ \command{vXXX}[\oarg{maps}\marg{value}]\sinceversion{0.2}
+ alias for \verbcode|\dXXX| (mnemonic \textit{v} stands for \textit{value}).
+\end{commands}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{How currencies are composed?}
+
+The commands \cs{cXXX} and \cs{dXXX} are expanded inside a group.
+The argument \meta{value} for \cs{cXXX} is stored into \cs*{value}.
+Besides, the unit is stored into \cs*{currencyunit} according
+to the value of \option{kind}.
+
+When using \cs{dXXX}, the order in which the elements are composed is
+\begin{quote}
+ \option{font}\ \option{before}\ \option{prefix}\ \cs*{currencyunit}\ \option{pre-between}\
+ \cs*{value}\ \option{after}
+\end{quote}
+when the currency unit is printed before (\code{pre=false}), and
+\begin{quote}
+ \option{font}\ \option{before}\ \cs*{value}\ \option{post-betwen}\ \option{prefix}\ \cs*{currencyunit}\ \option{after}
+\end{quote}
+otherwise (\code{pre=true}).
+
+The rules are
+\begin{itemize}[leftmargin=2em,itemsep=0pt]
+ \item The value (mandatory argument) specified by \meta{value} is printed
+ using \verbcode|\num{\value}| using the \cs{num} command from \pkg{siunitx}, and the value
+ is stored locally into \cs*{value}.
+ \item Both \option{prefix} and \option{unit} are enclosed into a \cs{text} command
+ so that they could safely be used in math mode.
+\end{itemize}
+
+When using \cs{cXXX}, the order in which the elements are composed is
+\begin{quote}
+ \option{font}\ \option{before}\ \option{prefix}\ \cs*{currencyunit}\ \option{after}
+\end{quote}
+where \option{prefix} and \cs*{currencyunit} are enclosed in a \cs{text} command.
+The boolean option \option{pre} is useless in this case.
+
+\subsection{The hierarchy of keys definitions}
+
+The order in which the keys are defined (and then overwritten) is
+\begin{itemize}[leftmargin=2em,itemsep=0pt]
+ \item Default options values.
+ \item Command \cs{DefineCurrency}.
+ \item Command \cs{CurrencySetup}, which is a shorthand for defining
+ the pgfkey \verbcode|/currency/currency/.style|.
+ \item Command \cs{cXXX} ou \cs{dXXX} (the commands are executed
+ in a group).
+\end{itemize}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Examples
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsection{Examples}
+
+\subsubsection{Punctuation.}
+
+The commands \cs{dXXX} and \cs{cXXX} are defined using
+the \pkg{xparse} package. The space is preserved after the command
+so that there is no need to use \verbcode|\| after a command.
+
+\begin{example}
+ The total gross salary is \dEUR{2000}. A part of \dEUR{1500} forms the net salary.
+\end{example}
+
+\subsection*{Using a prefix}
+
+\begin{example}
+ The total cost of the project is \dEUR[prefix=M,kind=symbol]{0.5}.
+\end{example}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection{Changing the base}
+
+Most of the currencies have \emph{cents}, that is a monetary unit equal to $\nicefrac{1}{100}$
+of the monetary unit. It is however possible to use another number of digits, either
+for special purposes, or for monetary units with other bases such as the Kuwaiti dinar
+which is decomposed in \num{1000} fils.
+
+\begin{example}
+ \DefineCurrency{KWD}{name={dinar},plural={dinars},symbol={KD},iso={KWD},kind=iso,base=3}
+ $\dUSD{1}=\dKWD{0.29963}$
+\end{example}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection{Changing the font}
+
+Using the \key{font}{tokens} key, it is possible to change the font which
+is used for the monetary units (remember that everything is enclosed into a group).
+When used in the currency definition and in \cs{CurrencySetup},
+it is however supersed by any other \key{font}{tokens} key used in \cs{dXXX}
+(A similar result could be obtained with \key{before}{tokens}, which aims
+at putting some material). To avoid this, \key{font+}{tokens} shall be used.
+
+Numbers are typesetted using a upright font. The \option*{detect-...}
+options of \pkg{siunitx} could be used to change \cite[\S~5.2]{siunitx}.
+However, they should be passed as boolean keys.
+
+
+\begin{example}
+ \textit{It costs \dUSD{1}}.
+ \textit{It costs \dUSD[font=\normalfont]{1}}.
+ \begin{empty}
+ \CurrencySetup{font=\normalfont}
+ \textit{It costs \dUSD{1}}.
+ \textit{It costs \dUSD[font+=\bfseries]{1}}.
+ \textit{It costs \dUSD[font=\bfseries]{1}}.
+ \textit{It costs \dUSD[font=\bfseries,detect-weight=true]{1}}.
+ \textit{It costs \dUSD[font=\bfseries,detect-all=true]{1}}.
+ \end{empty}
+\end{example}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection{Using options before and after}
+
+The use of \key{before}{tokens} is similar to the one of \key{font}{tokens}.
+It is possible to append or to prepend the value to existing ones
+defined as a higher level through \key{before+}{tokens} and \key{before<}{tokens}.
+Similarly, one could use \key{after}{tokens}, \key{after+}{tokens} and \key{after<}{tokens}.
+
+\begin{example}
+ \CurrencySetup{before=X}
+ \dUSD[before+={\color{red}}]{1}
+ \dUSD[before<={\color{red}}]{1}
+\end{example}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection{Using siunitx's features}
+
+Any key of the \pkg{siunitx} package could be used.
+For example, localization may change the unit separator (comma, ...).
+
+\begin{example}
+ This costs \dEUR{12 345.76}.
+ {\sisetup{locale=FR} Cela co\^ute \dEUR{12 345.76}.}
+\end{example}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection{Using raw formula}
+
+A raw formula could be typeseted using the number option \verbcode|number=false|.
+Beware, this propagate \verbcode|parse-numbers=false| to \verbcode|\num|
+so that any inner call to the latter command should specify
+\verbcode|parse-numbers=true| if needed.
+
+A style (see Section~\ref{sec:styles}) \verbcode|no-parse| is equivalent
+to \verbcode|number=false|.
+
+\begin{example}
+ We get a total of \dEUR[number=false]{2\times \num[parse-numbers=true]{10000}}=\dEUR{20000}.
+
+ We get a total of \dEUR[number=false]{2\times \num{10000}}=\dEUR{20000}.
+\end{example}
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\subsubsection{Using styles}
+\label{sec:styles}
+
+Some styles are aldeary defined to shorten the typesetting.
+For example, \verbcode|@iso| expands to \verbcode|kind=iso|.
+It
+acts similarly for \verbcode|@sy| (or \verbcode|@symb|), \verbcode|@na| (or \verbcode|@name|) and \verbcode|@pl|
+(or \verbcode|@plural|).
+
+\begin{example}
+ \dEUR[@iso]{10}; \dEUR[@symb]{10}; \dEUR[@name]{10}; \dEUR[@pl]{10}
+
+ \dGBP{10} ; \dGBP[@symb]{10} ; \dGBP[@pl]{10} ; \dGBP{5}
+\end{example}
+
+A style \verbcode|no-parse| is also equivalent to \verbcode|number=false|.
+\sinceversion{0.2}
+
+
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% TODO
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\section{To Do}
+
+\begin{itemize}
+ \item Store the values to use them later.
+ \item Automatic detection of plurals.
+ \item Perform simple arithmetics.
+ \item Behavior of \verbcode{detect-...} keys from \pkg{siunitx} with default argument.
+ \item Internationalization using the \texttt{translations} packages \cite{translations}.
+ \item Non decimal systems such as pounds, shillings, and pence.
+ \item Column definition for a table.
+ \item ...
+\end{itemize}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% References
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\printbibliography
+
+
+\end{document}