| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 32 Conditionals (pgfmath) |
| 3 |
% Label: "ex:pgfmathif" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage[math=pgfmath]{datatool-base} |
| 9 |
\newcommand{\numducks}{4} |
| 10 |
\begin{document} |
| 11 |
\edef\test{There |
| 12 |
\dtlifnumeq{\numducks}{1}{is 1 duck}{are \numducks\space ducks}.} |
| 13 |
\texttt{\meaning\test} |
| 14 |
|
| 15 |
Test text: \test |
| 16 |
|
| 17 |
\edef\test{There are |
| 18 |
\dtlifnumlt{\numducks}{10}{less than}{not less than} |
| 19 |
10 ducks.} \texttt{\meaning\test} |
| 20 |
|
| 21 |
Test text: \test |
| 22 |
|
| 23 |
\edef\test{There are |
| 24 |
\dtlifnumgt{\numducks}{10}{more than}{not more than} |
| 25 |
10 ducks.} \texttt{\meaning\test} |
| 26 |
|
| 27 |
Test text: \test |
| 28 |
|
| 29 |
\edef\test{There |
| 30 |
\dtlifnumopenbetween{\numducks}{4}{10}{are}{are not} |
| 31 |
between 4 and 10 ducks (exclusive).} \texttt{\meaning\test} |
| 32 |
|
| 33 |
Test text: \test |
| 34 |
|
| 35 |
\edef\test{There |
| 36 |
\dtlifnumclosedbetween{\numducks}{4}{10}{are}{are not} |
| 37 |
between 4 and 10 ducks (inclusive).} \texttt{\meaning\test} |
| 38 |
|
| 39 |
Test text: \test |
| 40 |
\end{document} |