summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-10-25 21:34:28 +0000
committerKarl Berry <karl@freefriends.org>2018-10-25 21:34:28 +0000
commit56ff75d2dc5bee2624945e8dd43945f1670e040d (patch)
tree6b9cb281b97f2542f9968a2f592b8e4cfa615e86
parent4f28912f38990fab7aac77cdaba57f15b9d4bd0b (diff)
currency (25oct18)
git-svn-id: svn://tug.org/texlive/trunk@48990 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/currency/README.md9
-rw-r--r--Master/texmf-dist/doc/latex/currency/currency.pdfbin167570 -> 175744 bytes
-rw-r--r--Master/texmf-dist/doc/latex/currency/currency_doc.pdfbin501340 -> 529253 bytes
-rw-r--r--Master/texmf-dist/doc/latex/currency/currency_doc.tex45
-rw-r--r--Master/texmf-dist/source/latex/currency/currency.dtx81
-rw-r--r--Master/texmf-dist/source/latex/currency/currency.ins4
-rw-r--r--Master/texmf-dist/tex/latex/currency/currency.sty34
7 files changed, 124 insertions, 49 deletions
diff --git a/Master/texmf-dist/doc/latex/currency/README.md b/Master/texmf-dist/doc/latex/currency/README.md
index 8b37ca5f071..f95dbead147 100644
--- a/Master/texmf-dist/doc/latex/currency/README.md
+++ b/Master/texmf-dist/doc/latex/currency/README.md
@@ -4,7 +4,8 @@
## Overview
`currency` is a LaTeX package that facilitates the formatting
-of currencies (amounts and units). It is based on the `siunitx` package.
+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
@@ -40,6 +41,7 @@ for suggestions, feature requests, and bug reports.
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
@@ -47,3 +49,8 @@ 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/Master/texmf-dist/doc/latex/currency/currency.pdf b/Master/texmf-dist/doc/latex/currency/currency.pdf
index e5fb2e629f6..bf71b7f0fa7 100644
--- a/Master/texmf-dist/doc/latex/currency/currency.pdf
+++ b/Master/texmf-dist/doc/latex/currency/currency.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/currency/currency_doc.pdf b/Master/texmf-dist/doc/latex/currency/currency_doc.pdf
index 058db347d4f..764a7010383 100644
--- a/Master/texmf-dist/doc/latex/currency/currency_doc.pdf
+++ b/Master/texmf-dist/doc/latex/currency/currency_doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/currency/currency_doc.tex b/Master/texmf-dist/doc/latex/currency/currency_doc.tex
index 17c54ead9ff..a6cc83efcdd 100644
--- a/Master/texmf-dist/doc/latex/currency/currency_doc.tex
+++ b/Master/texmf-dist/doc/latex/currency/currency_doc.tex
@@ -8,7 +8,7 @@
\usepackage{filecontents}
\usepackage[
backend=biber,
-style=cnltx,
+%style=cnltx, % incompatible with biblatex 3.3
sortlocale=en_EN,
indexing=cite,
useprefix]{biblatex}
@@ -16,6 +16,9 @@ useprefix]{biblatex}
\addbibresource{\jobname.bib}
+\newnote*\doccorrectedsinceversion[1]{Documentation corrected in version~#1}
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{filecontents*}{\jobname.bib}
@online{iso,
@@ -222,10 +225,15 @@ Currencies are used with or without amounts. They could also be changed locally.
The style is stored in \verbcode|/currency/currency/.style|.
\command{CurrencySetupAppend}[\marg{maps}] Similar to \cs{CurrencySetup} but
append the style.
- \command{dXXX}[\oarg{maps}] Print only the monetary unit with currency code \texttt{XXX}.
- \command{cXXX}[\oarg{maps}\marg{value}] Print the value with the monetary unit with currency code \texttt{XXX}.
+ \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.
@@ -287,14 +295,14 @@ so that there is no need to use \verbcode|\| after a command.
The total gross salary is \dEUR{2000}. A part of \dEUR{1500} forms the net salary.
\end{example}
-\paragraph*{Using a prefix}
+\subsection*{Using a prefix}
\begin{example}
The total cost of the project is \dEUR[prefix=M,kind=symbol]{0.5}.
\end{example}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\paragraph*{Changing the base}
+\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
@@ -307,7 +315,7 @@ which is decomposed in \num{1000} fils.
\end{example}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\paragraph*{Changing the font}
+\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).
@@ -335,7 +343,7 @@ However, they should be passed as boolean keys.
\end{example}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\paragraph*{Using \option{before} and \option{after}}
+\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
@@ -362,7 +370,27 @@ For example, localization may change the unit separator (comma, ...).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\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|.
@@ -376,6 +404,9 @@ acts similarly for \verbcode|@sy| (or \verbcode|@symb|), \verbcode|@na| (or \ver
\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}
+
diff --git a/Master/texmf-dist/source/latex/currency/currency.dtx b/Master/texmf-dist/source/latex/currency/currency.dtx
index b471b945e61..4824ba50db0 100644
--- a/Master/texmf-dist/source/latex/currency/currency.dtx
+++ b/Master/texmf-dist/source/latex/currency/currency.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2015 by Scott Pakin <scott+dtx@pakin.org>
+% Copyright (C) 2018 by Antoine Lejay
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{currency}
%<*package>
- [2017/05/25 v0.1 .dtx currency file]
+ [2018/10/22 v0.4 .dtx currency file]
%</package>
%
%<*driver>
@@ -59,7 +59,11 @@
% Right brace \} Tilde \~}
%
%
-% \changes{v1.0}{2016/07/07}{Initial version}
+% \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}
%
@@ -108,6 +112,8 @@
% \begin{center}
% \url{https://github.com/antoinelejay/currency}
% \end{center}
+%
+%
%
% \section{Implementation}
%
@@ -255,29 +261,25 @@
% The first argument is the name of the currency, normally its ISO symbol (3 letters).
% This commands defines two global commands.
%
-% \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{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}
-\newcommand{\DefineCurrency}[2]{%
-\pgfkeys{/currency/#1/.style={#2}}%%
-% define the currency with digits as \dXXX
-\global\expandafter\DeclareDocumentCommand\csname d#1\endcsname{o m}{%
+\ExplSyntaxOn
+\DeclareDocumentCommand{\displayCurrency}{m o m}{
\begingroup%
% default parameters, to put outside
\sisetup{round-mode=places,round-precision=2}
-\IfNoValueTF{##1}%
+\IfNoValueTF{#2}%
{\pgfkeys{/currency/.cd,#1,currency}}%
- {\pgfkeys{/currency/.cd,#1,currency,##1}}%
+ {\pgfkeys{/currency/.cd,#1,currency,#2}}%
\ifbool{currencynumber}%
{\sisetup{parse-numbers=true}}%
{\sisetup{parse-numbers=false}}%
-\edef\value{##2}% store the value of the currency
+\edef\value{#3}% store the value of the currency
%
\ifprintbefore%
% true clause / print the unit before
@@ -295,19 +297,49 @@
\pgfkeys{/currency/after}%
\fi%
\endgroup%
- }%
- % define the currency symbol as \cXXX with one optional argument
- \global\expandafter\DeclareDocumentCommand\csname c#1\endcsname{o}{%
+}
+% \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{##1}%
+ \IfNoValueTF{#2}%
{\pgfkeys{/currency/.cd,#1,currency}}%
- {\pgfkeys{/currency/.cd,#1,currency,##1}}%
+ {\pgfkeys{/currency/.cd,#1,currency,#2}}%
\pgfkeys{/currency/font}%
\pgfkeys{/currency/before}%
- \text{\pgfkeys{/currency/prefix}\currencyunit}
+ \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}
@@ -324,6 +356,7 @@
\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
diff --git a/Master/texmf-dist/source/latex/currency/currency.ins b/Master/texmf-dist/source/latex/currency/currency.ins
index 5712ab3a12d..bd59192b1a1 100644
--- a/Master/texmf-dist/source/latex/currency/currency.ins
+++ b/Master/texmf-dist/source/latex/currency/currency.ins
@@ -1,5 +1,5 @@
%%
-%% Copyright (C) 2015 by Scott Pakin <scott+dtx@pakin.org>
+%% 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
@@ -21,7 +21,7 @@
This is a generated file.
-Copyright (C) 2015 by Scott Pakin <scott+dtx@pakin.org>
+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
diff --git a/Master/texmf-dist/tex/latex/currency/currency.sty b/Master/texmf-dist/tex/latex/currency/currency.sty
index c098f2b7f47..5e2baf8f882 100644
--- a/Master/texmf-dist/tex/latex/currency/currency.sty
+++ b/Master/texmf-dist/tex/latex/currency/currency.sty
@@ -8,7 +8,7 @@
%%
%% This is a generated file.
%%
-%% Copyright (C) 2015 by Scott Pakin <scott+dtx@pakin.org>
+%% 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
@@ -22,7 +22,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{currency}
- [2017/05/25 v0.1 .dtx currency file]
+ [2018/10/22 v0.4 .dtx currency file]
\RequirePackage{siunitx}
\RequirePackage{pgfkeys}
\RequirePackage{etoolbox}
@@ -90,18 +90,17 @@
\keys_set:nV {siunitx} {\SetPrecision}%
}}%
\ExplSyntaxOff
-\newcommand{\DefineCurrency}[2]{%
-\pgfkeys{/currency/#1/.style={#2}}%%
-\global\expandafter\DeclareDocumentCommand\csname d#1\endcsname{o m}{%
+\ExplSyntaxOn
+\DeclareDocumentCommand{\displayCurrency}{m o m}{
\begingroup%
\sisetup{round-mode=places,round-precision=2}
-\IfNoValueTF{##1}%
+\IfNoValueTF{#2}%
{\pgfkeys{/currency/.cd,#1,currency}}%
- {\pgfkeys{/currency/.cd,#1,currency,##1}}%
+ {\pgfkeys{/currency/.cd,#1,currency,#2}}%
\ifbool{currencynumber}%
{\sisetup{parse-numbers=true}}%
{\sisetup{parse-numbers=false}}%
-\edef\value{##2}% store the value of the currency
+\edef\value{#3}% store the value of the currency
\ifprintbefore%
\pgfkeys{/currency/font}%
\pgfkeys{/currency/before}%
@@ -117,19 +116,23 @@
\pgfkeys{/currency/after}%
\fi%
\endgroup%
- }%
- % define the currency symbol as \cXXX with one optional argument
- \global\expandafter\DeclareDocumentCommand\csname c#1\endcsname{o}{%
+}
+\DeclareDocumentCommand{\displayCurrencySymbol}{m o}{
\begingroup%
- \IfNoValueTF{##1}%
+ \IfNoValueTF{#2}%
{\pgfkeys{/currency/.cd,#1,currency}}%
-{\pgfkeys{/currency/.cd,#1,currency,##1}}%
+{\pgfkeys{/currency/.cd,#1,currency,#2}}%
\pgfkeys{/currency/font}%
\pgfkeys{/currency/before}%
- \text{\pgfkeys{/currency/prefix}\currencyunit}
+ \text{\pgfkeys{/currency/prefix}\currencyunit}%
\pgfkeys{/currency/after}%
\endgroup%
- }%
+}
+\ExplSyntaxOff
+\newcommand{\DefineCurrency}[2]{%
+\pgfkeys{/currency/#1/.style={#2}}%%
+\csgdef{d#1}{\displayCurrency{#1}}
+\csgdef{c#1}{\displayCurrencySymbol{#1}}
}%
\pgfkeys{/currency/@iso/.style={kind=iso}}
\pgfkeys{/currency/@symb/.style={kind=symbol}}
@@ -138,6 +141,7 @@
\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}}
\endinput
%%
%% End of file `currency.sty'.