texlive[48990] Master/texmf-dist: currency (25oct18)

commits+karl at tug.org commits+karl at tug.org
Thu Oct 25 23:34:28 CEST 2018


Revision: 48990
          http://tug.org/svn/texlive?view=revision&revision=48990
Author:   karl
Date:     2018-10-25 23:34:28 +0200 (Thu, 25 Oct 2018)
Log Message:
-----------
currency (25oct18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/currency/README.md
    trunk/Master/texmf-dist/doc/latex/currency/currency.pdf
    trunk/Master/texmf-dist/doc/latex/currency/currency_doc.pdf
    trunk/Master/texmf-dist/doc/latex/currency/currency_doc.tex
    trunk/Master/texmf-dist/source/latex/currency/currency.dtx
    trunk/Master/texmf-dist/source/latex/currency/currency.ins
    trunk/Master/texmf-dist/tex/latex/currency/currency.sty

Modified: trunk/Master/texmf-dist/doc/latex/currency/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/currency/README.md	2018-10-25 21:34:13 UTC (rev 48989)
+++ trunk/Master/texmf-dist/doc/latex/currency/README.md	2018-10-25 21:34:28 UTC (rev 48990)
@@ -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 @@
 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 @@
 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)
+

Modified: trunk/Master/texmf-dist/doc/latex/currency/currency.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/currency/currency_doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/currency/currency_doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/currency/currency_doc.tex	2018-10-25 21:34:13 UTC (rev 48989)
+++ trunk/Master/texmf-dist/doc/latex/currency/currency_doc.tex	2018-10-25 21:34:28 UTC (rev 48990)
@@ -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 @@
 
 \addbibresource{\jobname.bib}
 
+\newnote*\doccorrectedsinceversion[1]{Documentation corrected in version~#1}
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{filecontents*}{\jobname.bib}
 @online{iso,
@@ -222,10 +225,15 @@
     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,7 +295,7 @@
     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}.
@@ -294,7 +302,7 @@
 \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 @@
 \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 @@
 \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 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\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,11 +404,14 @@
     \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
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Modified: trunk/Master/texmf-dist/source/latex/currency/currency.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/currency/currency.dtx	2018-10-25 21:34:13 UTC (rev 48989)
+++ trunk/Master/texmf-dist/source/latex/currency/currency.dtx	2018-10-25 21:34:28 UTC (rev 48990)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2015 by Scott Pakin <scott+dtx at 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,8 +59,12 @@
 %   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}
 %
 % \DoNotIndex{\newcommand,\newenvironment}
@@ -108,7 +112,9 @@
 % \begin{center}
 % \url{https://github.com/antoinelejay/currency}
 % \end{center}
+% 
 %
+%
 % \section{Implementation}
 %
 % \subsection{Dependencies}
@@ -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

Modified: trunk/Master/texmf-dist/source/latex/currency/currency.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/currency/currency.ins	2018-10-25 21:34:13 UTC (rev 48989)
+++ trunk/Master/texmf-dist/source/latex/currency/currency.ins	2018-10-25 21:34:28 UTC (rev 48990)
@@ -1,5 +1,5 @@
 %%
-%% Copyright (C) 2015 by Scott Pakin <scott+dtx at 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 at 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

Modified: trunk/Master/texmf-dist/tex/latex/currency/currency.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/currency/currency.sty	2018-10-25 21:34:13 UTC (rev 48989)
+++ trunk/Master/texmf-dist/tex/latex/currency/currency.sty	2018-10-25 21:34:28 UTC (rev 48990)
@@ -8,7 +8,7 @@
 %% 
 %% This is a generated file.
 %% 
-%% Copyright (C) 2015 by Scott Pakin <scott+dtx at 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'.



More information about the tex-live-commits mailing list