diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/currency/currency.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/currency/currency.sty | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/currency/currency.sty b/Master/texmf-dist/tex/latex/currency/currency.sty new file mode 100644 index 00000000000..c098f2b7f47 --- /dev/null +++ b/Master/texmf-dist/tex/latex/currency/currency.sty @@ -0,0 +1,143 @@ +%% +%% This is file `currency.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% currency.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2015 by Scott Pakin <scott+dtx@pakin.org> +%% +%% 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. +%% +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{currency} + [2017/05/25 v0.1 .dtx currency file] +\RequirePackage{siunitx} +\RequirePackage{pgfkeys} +\RequirePackage{etoolbox} +\RequirePackage{xparse} +\RequirePackage{expl3} +\RequirePackage{textcomp} +\RequirePackage{eurosym} +\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} + +\pgfkeys{/currency/currency/.style={}} +\newcommand{\CurrencySetup}[1]{% + \pgfkeys{/currency/currency/.style={#1}}% +} +\newcommand{\CurrencySetupAppend}[1]{% + \pgfkeys{/currency/currency/.append style={#1}}% +} +\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} +\pgfkeys{/currency/pre-between/.initial={~}} +\pgfkeys{/currency/post-between/.initial={~}} +\pgfkeys{/currency/before/.initial={}} +\pgfkeys{/currency/before+/.code={\pgfkeys{/currency/before/.append={#1}}}} +\pgfkeys{/currency/before</.code={\pgfkeys{/currency/before/.prefix={#1}}}} +\pgfkeys{/currency/after/.initial={}} % tokens that are inserted after +\pgfkeys{/currency/after+/.code={\pgfkeys{/currency/after/.append={#1}}}} +\pgfkeys{/currency/after</.code={\pgfkeys{/currency/after/.prefix={#1}}}} +\pgfkeys{/currency/font/.initial={}} % for setting up the fonts +\pgfkeys{/currency/font+/.code={\pgfkeys{/currency/font/.append={#1}}}} +\pgfkeys{/currency/prefix/.initial={}} +\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} +\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} +\ExplSyntaxOn +\pgfkeys{/currency/.unknown/.code={% +\edef\Unknown{\pgfkeyscurrentname=\pgfkeyscurrentvalue}% +\keys_set:nV {siunitx} {\Unknown}% + }}% +\ExplSyntaxOff +\ExplSyntaxOn +\pgfkeys{/currency/base/.code={% +\edef\SetPrecision{round-precision=\pgfkeyscurrentvalue}% +\keys_set:nV {siunitx} {\SetPrecision}% + }}% +\ExplSyntaxOff +\newcommand{\DefineCurrency}[2]{% +\pgfkeys{/currency/#1/.style={#2}}%% +\global\expandafter\DeclareDocumentCommand\csname d#1\endcsname{o m}{% +\begingroup% +\sisetup{round-mode=places,round-precision=2} +\IfNoValueTF{##1}% + {\pgfkeys{/currency/.cd,#1,currency}}% + {\pgfkeys{/currency/.cd,#1,currency,##1}}% +\ifbool{currencynumber}% + {\sisetup{parse-numbers=true}}% + {\sisetup{parse-numbers=false}}% +\edef\value{##2}% store the value of the currency +\ifprintbefore% +\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% + }% + % define the currency symbol as \cXXX with one optional argument + \global\expandafter\DeclareDocumentCommand\csname c#1\endcsname{o}{% +\begingroup% + \IfNoValueTF{##1}% +{\pgfkeys{/currency/.cd,#1,currency}}% +{\pgfkeys{/currency/.cd,#1,currency,##1}}% + \pgfkeys{/currency/font}% + \pgfkeys{/currency/before}% + \text{\pgfkeys{/currency/prefix}\currencyunit} +\pgfkeys{/currency/after}% +\endgroup% + }% +}% +\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}} +\endinput +%% +%% End of file `currency.sty'. |