| 1 |
{\color{red!90!black} |
| 2 |
\begin{verbatim} |
| 3 |
\newcondition{defined}{} |
| 4 |
\newcondition{paper}{a4,a5,b5} |
| 5 |
\setcondition{paper={a5,b5}} |
| 6 |
\end{verbatim} |
| 7 |
} |
| 8 |
|
| 9 |
{ |
| 10 |
\newcondition{defined}{} |
| 11 |
\newcondition{paper}{a4,a5,b5} |
| 12 |
\setcondition{paper={a5,b5}} |
| 13 |
\def\cdcmdtest#1->#2 /{\textcolor{red!90!black}{\detokenize{#1}}:~ #1 \newline} |
| 14 |
\parindent=0pt\ttfamily |
| 15 |
\cdcmdtest\conditionif[*]{t}{f}->t / |
| 16 |
\cdcmdtest\conditionif[defined]{t}{f}->t / |
| 17 |
\cdcmdtest\conditionif[defined=]{t}{f}->f / |
| 18 |
\cdcmdtest\conditionif[defined=*]{t}{f}->t / |
| 19 |
\cdcmdtest\conditionif[defined=a]{t}{f}->f / |
| 20 |
\cdcmdtest\conditionif[paper={a5,a0},undefined]{t}{f}->t / |
| 21 |
|
| 22 |
\cdcmdtest\conditionif*[*]{t}{f}->t / |
| 23 |
\cdcmdtest\conditionif*[defined]{t}{f}->t / |
| 24 |
\cdcmdtest\conditionif*[defined={,,}]{t}{f}->f / |
| 25 |
\cdcmdtest\conditionif*[defined=*]{t}{f}->t / |
| 26 |
\cdcmdtest\conditionif*[defined=a]{t}{f}->f / |
| 27 |
\cdcmdtest\conditionif*[paper={a5,a0},undefined]{t}{f}->f / |
| 28 |
\cdcmdtest\conditionif*[*,undefined]{t}{f}->f / |
| 29 |
\cdcmdtest\conditionif*[paper={a5,b5}]{t}{f}->t / |
| 30 |
\cdcmdtest\conditionif*[paper={a5,,b5}]{t}{f}->t / |
| 31 |
\cdcmdtest\conditionif*[paper={a5,b6,a5}]{t}{f}->f / |
| 32 |
\cdcmdtest\conditionif*[paper={a5,{ },45}]{t}{f}->f / |
| 33 |
\cdcmdtest\conditionif*[*,defined,paper={a5,b5}]{t}{f}->t / |
| 34 |
} |
| 35 |
|
| 36 |
{\color{red!90!black} |
| 37 |
\begin{verbatim} |
| 38 |
\def\truetext{true} \def\falsetext{false} |
| 39 |
\edef\testa{\econditionif[*]{true}{false}} |
| 40 |
\ifx\testa\truetext t\else f\fi |
| 41 |
\ifx\testa\falsetext t\else f\fi |
| 42 |
\strcmp {\econditionif[*]{true}{false}} {true} |
| 43 |
\strcmp {\econditionif[*]{true}{false}} {false} |
| 44 |
\strcmp {\testa} {\truetext} |
| 45 |
\strcmp {\testa} {\falsetext} |
| 46 |
\end{verbatim} |
| 47 |
} |
| 48 |
\def\truetext{true} \def\falsetext{false} |
| 49 |
\edef\testa{\econditionif[*]{true}{false}} |
| 50 |
\ifx\testa\truetext t\else f\fi |
| 51 |
\ifx\testa\falsetext t\else f\fi |
| 52 |
\strcmp{\econditionif[*]{true}{false}}{true} |
| 53 |
\strcmp{\econditionif[*]{true}{false}}{false} |
| 54 |
\strcmp{\testa}{\truetext} |
| 55 |
\strcmp{\testa}{\falsetext} |
| 56 |
|
| 57 |
{\color{red!90!black} |
| 58 |
\begin{verbatim} |
| 59 |
\conditioncase{ |
| 60 |
{paper=a3} {a3} |
| 61 |
{paper=a4} {a4} |
| 62 |
{paper,defined} {pd} |
| 63 |
} |
| 64 |
\end{verbatim} |
| 65 |
} |
| 66 |
\conditioncase{ |
| 67 |
{paper=a3} {a3} |
| 68 |
{paper=a4} {a4} |
| 69 |
{paper,defined} {pd} |
| 70 |
} |
| 71 |
|
| 72 |
{\color{red!90!black} |
| 73 |
\begin{verbatim} |
| 74 |
\conditioncaseTF{ |
| 75 |
{paper=a3} {a3} |
| 76 |
{paper=a4} {a4} |
| 77 |
{paper,defined} {pd} |
| 78 |
}{true}{false} |
| 79 |
\end{verbatim} |
| 80 |
} |
| 81 |
\conditioncaseTF{ |
| 82 |
{paper=a3} {a3} |
| 83 |
{paper=a4} {a4} |
| 84 |
{paper,defined} {pd} |
| 85 |
}{true}{false} |
| 86 |
|
| 87 |
{\color{red!90!black} |
| 88 |
\begin{verbatim} |
| 89 |
\conditioncase!{ |
| 90 |
{paper=a3} {a3} |
| 91 |
{paper=a4} {a4} |
| 92 |
{paper,defined} {pd} |
| 93 |
} |
| 94 |
\end{verbatim} |
| 95 |
} |
| 96 |
\conditioncase!{ |
| 97 |
{paper=a3} {a3} |
| 98 |
{paper=a4} {a4} |
| 99 |
{paper,defined} {pd} |
| 100 |
} |
| 101 |
|
| 102 |
{\color{red!90!black} |
| 103 |
\begin{verbatim} |
| 104 |
\conditioncaseTF!{ |
| 105 |
{paper=a3} {a3} |
| 106 |
{paper=a4} {a4} |
| 107 |
{paper,defined} {pd} |
| 108 |
}{true}{false} |
| 109 |
\end{verbatim} |
| 110 |
} |
| 111 |
\conditioncaseTF!{ |
| 112 |
{paper=a3} {a3} |
| 113 |
{paper=a4} {a4} |
| 114 |
{paper,defined} {pd} |
| 115 |
}{true}{false} |
| 116 |
|
| 117 |
{\color{red!90!black} |
| 118 |
\begin{verbatim} |
| 119 |
\newconditioncommand\longprotectedcdcmd{longprotectedcdcmd} |
| 120 |
\newconditioncommand\longprotectedcdcmdi[1]{longprotectedcdcmdi<#1>} |
| 121 |
\newconditioncommand\longprotectedcdcmdio[1][DFT]{longprotectedcdcmdio<#1>} |
| 122 |
\newconditioncommand*\shortprotectedcdcmd{shortprotectedcdcmd} |
| 123 |
\newconditioncommand*\shortprotectedcdcmdi[1]{shortprotectedcdcmdi<#1>} |
| 124 |
\newconditioncommand*\shortprotectedcdcmdio[1][DFT]{shortprotectedcdcmdio<#1>} |
| 125 |
|
| 126 |
\setcondition{paper={a4,a5}} |
| 127 |
\longprotectedcdcmd{*} |
| 128 |
\longprotectedcdcmdi{*}{1\par arg} |
| 129 |
\longprotectedcdcmdio{*} |
| 130 |
\longprotectedcdcmdio{*}[1opt] |
| 131 |
\longprotectedcdcmdio{paper=a4}[1opt a4] |
| 132 |
\longprotectedcdcmdio+{paper={a4,a7}}[1opt a4a7] |
| 133 |
\shortprotectedcdcmd{*} |
| 134 |
\shortprotectedcdcmdi{*}{1\par arg} |
| 135 |
\shortprotectedcdcmdio{*} |
| 136 |
\shortprotectedcdcmdio{*}[1opt] |
| 137 |
\shortprotectedcdcmdio{paper=a4}[1opt a4] |
| 138 |
\shortprotectedcdcmdio+{paper={a4,a7}}[1opt a4a7] |
| 139 |
\end{verbatim} |
| 140 |
} |
| 141 |
\newconditioncommand\longprotectedcdcmd{longprotectedcdcmd} |
| 142 |
\newconditioncommand\longprotectedcdcmdi[1]{longprotectedcdcmdi<#1>} |
| 143 |
\newconditioncommand\longprotectedcdcmdio[1][DFT]{longprotectedcdcmdio<#1>} |
| 144 |
\newconditioncommand*\shortprotectedcdcmd{shortprotectedcdcmd} |
| 145 |
\newconditioncommand*\shortprotectedcdcmdi[1]{shortprotectedcdcmdi<#1>} |
| 146 |
\newconditioncommand*\shortprotectedcdcmdio[1][DFT]{shortprotectedcdcmdio<#1>} |
| 147 |
|
| 148 |
{\ttfamily\setcondition{paper={a4,a5}}\obeylines |
| 149 |
\longprotectedcdcmd{*} |
| 150 |
\longprotectedcdcmdi{*}{1\par arg} |
| 151 |
\longprotectedcdcmdio{*} |
| 152 |
\longprotectedcdcmdio{*}[1opt] |
| 153 |
\longprotectedcdcmdio{paper=a4}[1opt a4] |
| 154 |
\longprotectedcdcmdio+{paper={a4,a7}}[1opt a4a7] |
| 155 |
\shortprotectedcdcmd{*} |
| 156 |
\shortprotectedcdcmdi{*}{1arg} |
| 157 |
\shortprotectedcdcmdio{*} |
| 158 |
\shortprotectedcdcmdio{*}[1opt] |
| 159 |
\shortprotectedcdcmdio{paper=a4}[1opt a4] |
| 160 |
\shortprotectedcdcmdio+{paper={a4,a7}}[1opt a4a7] |
| 161 |
} |