| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 34 Data Type Conditionals for use with ifthen |
| 3 |
% Label: "ex:DTListype" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage{datatool-base} |
| 9 |
\begin{document} |
| 10 |
1,234.0: \ifthenelse{\DTLisint{1,234.0}}{int}{not int}. |
| 11 |
|
| 12 |
1,234: \ifthenelse{\DTLisint{1,234}}{int}{not int}. |
| 13 |
|
| 14 |
1,234.0: \ifthenelse{\DTLisreal{1,234.0}}{real}{not real}. |
| 15 |
|
| 16 |
1,234: \ifthenelse{\DTLisreal{1,234}}{real}{not real}. |
| 17 |
|
| 18 |
Compare: \$1,234: \DTLifcurrency{\$1,234}{currency}{not currency}. With: \$1,234: \ifthenelse{\DTLiscurrency{\$1,234}}{currency}{not currency}. |
| 19 |
|
| 20 |
\DTLnewcurrencysymbol{\protect\$}% |
| 21 |
\$1,234: \ifthenelse{\DTLiscurrency{\$1,234}}{currency}{not currency}. |
| 22 |
|
| 23 |
1.234,0: \ifthenelse{\DTLisnumerical{1.234,0}}{numerical}{not numerical}; \ifthenelse{\DTLisstring{1.234,0}}{string}{not string}. |
| 24 |
|
| 25 |
\DTLsetnumberchars{.}{,}% |
| 26 |
1.234,0: \ifthenelse{\DTLisnumerical{1.234,0}}{numerical}{not numerical}; \ifthenelse{\DTLisstring{1.234,0}}{string}{not string}. |
| 27 |
|
| 28 |
Empty: \ifthenelse{\DTLisnumerical{}}{numerical}{not numerical}; \ifthenelse{\DTLisstring{}}{string}{not string}. |
| 29 |
\end{document} |