Debian Codegraph @

texmf-dist/doc/latex/datatool/datatool-user-examples/datatool-user-example041.tex

raw
1 % This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
2 % Example 41 Formatting and Parsing Currency (No Region)
3 % Label: "ex:noregioncurrency"
4 % arara: pdflatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 \usepackage{datatool-base}
9 \begin{document}
10 Currency code: \DTLCurrencyCode. Currency symbol: \DTLCurrencySymbol.
11
12 \DTLdecimaltocurrency{12345.678}{\formattedresult}
13 Formatted: \formattedresult.
14 (Numeric value: \DTLdatumvalue{\formattedresult}.)
15
16 \$1,234.57 add 1,236.59:
17 \DTLadd{\total}{\$1,234.57}{1,236.59}
18 Total: \total.
19
20 1,234.57 add £1,236.59:
21 \DTLadd{\total}{1,234.57}{£1,236.59}
22 Total: \total.
23
24 €48,236.59 multiplied by 0.5:
25 \DTLmul{\result}{€48,236.59}{0.5}
26 \result\ (\DTLdatumvalue{\result}).
27
28 \DTLparse\parsed{€19,234.56}
29 String value: \parsed.
30 Numeric value: \DTLdatumvalue{\parsed}.
31
32
33 \DTLparse\parsed{£28,342.64}
34 String value: \parsed.
35 Numeric value: \DTLdatumvalue{\parsed}.
36
37
38 \DTLparse\parsed{19,234.56€}
39 String value: \parsed.
40 Numeric value: \DTLdatumvalue{\parsed}.
41
42 Formatting specific currency symbol: \DTLfmtcurrency{\texteuro}{12.345,65}
43
44 Formatting default currency symbol: \DTLcurrency{12 345,65}
45
46 Formatting EUR: \DTLfmtcurr{EUR}{12.345,65}
47 \end{document}