% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
% Example 44 Defining a Currency
% Label: "ex:defcurr"
% arara: xelatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
% This is an example document to demonstrate provided commands
 % To create your own region ldf file, see https://github.com/nlct/datatool-regions
 \usepackage{datatool-base}

\begin{document}
Default currency: \DTLCurrencyCode.
\DTLdecimaltocurrency{1234.567}{\result}
Formatted value: \result. 

£1.99: \DTLifcurrency{£1.99}{currency}{not currency};
\DTLfmtcurrency{£}{1.99}: \DTLifcurrency{\DTLfmtcurrency{£}{1.99}}{currency}{not currency}. 

Defining GBP.
\DTLdefcurrency{GBP}{\pounds}{£}
Default currency: \DTLCurrencyCode. 

£1.99: \DTLifcurrency{£1.99}{currency}{not currency}. 

Switching to GBP.\DTLsetdefaultcurrency{GBP}
Default currency: \DTLCurrencyCode. 

\DTLdecimaltocurrency{1234.567}{\result}
Formatted value: \result. 

\renewcommand{\dtlcurrdefaultfmt}{\dtlcurrsuffixfmt} \renewcommand{\DTLcurrCodeOrSymOrChar}[3]{#1} Formatted value: \result. 

\DTLaddall{\result}{\pounds2.50,\DTLcurrGBP 1.25,£0.25}
Formatted value: \result. 
\end{document}
