Debian Codegraph @

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

raw
1 % This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
2 % Example 44 Defining a Currency
3 % Label: "ex:defcurr"
4 % arara: xelatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 % This is an example document to demonstrate provided commands
9 % To create your own region ldf file, see https://github.com/nlct/datatool-regions
10 \usepackage{datatool-base}
11
12 \begin{document}
13 Default currency: \DTLCurrencyCode.
14 \DTLdecimaltocurrency{1234.567}{\result}
15 Formatted value: \result.
16
17 £1.99: \DTLifcurrency{£1.99}{currency}{not currency};
18 \DTLfmtcurrency{£}{1.99}: \DTLifcurrency{\DTLfmtcurrency{£}{1.99}}{currency}{not currency}.
19
20 Defining GBP.
21 \DTLdefcurrency{GBP}{\pounds}{£}
22 Default currency: \DTLCurrencyCode.
23
24 £1.99: \DTLifcurrency{£1.99}{currency}{not currency}.
25
26 Switching to GBP.\DTLsetdefaultcurrency{GBP}
27 Default currency: \DTLCurrencyCode.
28
29 \DTLdecimaltocurrency{1234.567}{\result}
30 Formatted value: \result.
31
32 \renewcommand{\dtlcurrdefaultfmt}{\dtlcurrsuffixfmt} \renewcommand{\DTLcurrCodeOrSymOrChar}[3]{#1} Formatted value: \result.
33
34 \DTLaddall{\result}{\pounds2.50,\DTLcurrGBP 1.25,£0.25}
35 Formatted value: \result.
36 \end{document}