summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/currency
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 /Master/texmf-dist/source/latex/currency
parent4f28912f38990fab7aac77cdaba57f15b9d4bd0b (diff)
currency (25oct18)
git-svn-id: svn://tug.org/texlive/trunk@48990 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/currency')
-rw-r--r--Master/texmf-dist/source/latex/currency/currency.dtx81
-rw-r--r--Master/texmf-dist/source/latex/currency/currency.ins4
2 files changed, 59 insertions, 26 deletions
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