| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 6 Datum Tests for Equality |
| 3 |
% Label: "ex:datumifeq" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage{datatool-base} |
| 9 |
\DTLparse{\Fruit}{Pear} |
| 10 |
\DTLparse{\Price}{\$1.50} |
| 11 |
\DTLparse{\Quantity}{10} |
| 12 |
\DTLsetcurrencydatum{\OtherPrice}{1 dollar 50\textcent}{1.5}{\$} |
| 13 |
\DTLsetdecimaldatum{\OtherQuantity}{10.00}{10.0} |
| 14 |
\newcommand{\test}[3]{#1=#2 (\texttt{\string#3}) ? #3{#1}{#2}{true}{false}.\par} |
| 15 |
\begin{document} |
| 16 |
\ExplSyntaxOn |
| 17 |
\test \Fruit {Pear} \tl_if_eq:NnTF |
| 18 |
\test \Fruit {Pear} \tl_if_eq:enTF |
| 19 |
\test \Fruit {Pear} \datatool_if_value_eq:NnTF |
| 20 |
|
| 21 |
\test \Price {\$1.50} \tl_if_eq:NnTF |
| 22 |
\test \Price {\$1.50} \tl_if_eq:enTF |
| 23 |
\test \Price {\$1.50} \datatool_if_value_eq:NnTF |
| 24 |
\test \Price {\$1.5} \datatool_if_value_eq:NnTF |
| 25 |
\test \Price \OtherPrice \tl_if_eq:NNTF |
| 26 |
\test \Price \OtherPrice \datatool_if_value_eq:NNTF |
| 27 |
|
| 28 |
\test \Quantity {10} \tl_if_eq:NnTF |
| 29 |
\test \Quantity {10} \tl_if_eq:enTF |
| 30 |
\test \Quantity {10} \datatool_if_value_eq:NnTF |
| 31 |
\test \Quantity {10.00} \datatool_if_value_eq:NnTF |
| 32 |
\test \Quantity \OtherQuantity \tl_if_eq:NNTF |
| 33 |
\test \Quantity \OtherQuantity \datatool_if_value_eq:NNTF |
| 34 |
\ExplSyntaxOff |
| 35 |
\end{document} |