| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 42 Currency Formats (GB Region) |
| 3 |
% Label: "ex:regionGBcurrency" |
| 4 |
% arara: xelatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage[locales={en-GB}]{datatool-base} |
| 9 |
|
| 10 |
\begin{document} |
| 11 |
Currency code: \DTLCurrencyCode. |
| 12 |
Currency symbol: \DTLCurrencySymbol. |
| 13 |
|
| 14 |
\DTLdecimaltocurrency{12345.678}{\formattedresult} |
| 15 |
Formatted: \formattedresult. |
| 16 |
(Numeric value: \DTLdatumvalue{\formattedresult}.) |
| 17 |
|
| 18 |
\DTLparse\parsed{£28,342.64} |
| 19 |
String value: \parsed. |
| 20 |
Numeric value: \DTLdatumvalue{\parsed}. |
| 21 |
|
| 22 |
\DTLparse\parsed{€19,234.56} |
| 23 |
String value: \parsed. |
| 24 |
Numeric value: \DTLdatumvalue{\parsed}. |
| 25 |
|
| 26 |
\DTLsetLocaleOptions{GB}{ |
| 27 |
number-style=old, |
| 28 |
currency-symbol-prefix |
| 29 |
} |
| 30 |
(GB settings: number-style=old, currency-symbol-prefix=true.) |
| 31 |
|
| 32 |
\DTLdecimaltocurrency{12345.678}{\formattedresult} |
| 33 |
Formatted: \formattedresult. |
| 34 |
(Numeric value: \DTLdatumvalue{\formattedresult}.) |
| 35 |
|
| 36 |
\DTLparse\parsed{£28,342.648} |
| 37 |
String value: \parsed. |
| 38 |
Numeric value: \DTLdatumvalue{\parsed}. |
| 39 |
|
| 40 |
\DTLsetup{ |
| 41 |
numeric={ |
| 42 |
auto-reformat, |
| 43 |
region-currency-prefix=smallcaps |
| 44 |
} |
| 45 |
} |
| 46 |
(Numeric settings: auto-reformat, region-currency-prefix=smallcaps.) |
| 47 |
|
| 48 |
\DTLparse\parsed{£28,342.648} |
| 49 |
String value: \parsed. |
| 50 |
Numeric value: \DTLdatumvalue{\parsed}. |
| 51 |
Currency symbol: \DTLdatumcurrency{\parsed}. |
| 52 |
\end{document} |