Conditional expressions allow to set parameters of GNML tags, according to the results of test, in following syntax:
>tagname (test) ? return_value_when_test=true : return_value_when_test=false<
>f (LD = 8.5pt) ? 9003 : 9001< It acts as >f 9003< when the current leading is equal to 8.5pt, or >f 9001<, when the current leading is any other value. >f (LD ] 8.5pt) ? 9003 : 9001< It acts as >f 9003< when the current leading is greater than 8.5pt, or >f 9001<, when the current leading is equal or smaller than 8.5pt. >f (LD [ 8.5pt) ? 9003 : 9001< It acts as >f 9003< when the current leading is smaller than 8.5pt, or >f 9001<, when the current leading is equal or greater. >f (LD [] 8.5pt) ? 9003 : 9001< It acts as >f 9003< when the current leading is different than 8.5pt, or >f 9001<, when the current leading is equal to 8.5pt. >a (LD ] 8.5pt) ? 6 : 10< It acts as >a 6< when the current leading is greater than 8.5pt, or >a 10<, when the current leading is equal or smaller than 8.5pt. >q (LD ] 8.5pt) ? 1 : 2< It acts as >q 1< when the current leading is greater than 8.5pt, or >q 2<, when the current leading is equal or smaller than 8.5pt. If you are using the >pa..< tag in a variable style, assuming the first parameter of the style is alignment, you can optimize the usage by the following syntax: >pa #1<>q (#1=0) ? 3: #1< (#1=0) this is a test, i.e If #1 is 0; it can return true (it means #1=0) or false (it means #1<>0) ? this sign delimits the part of test and the part of reactions to test 3 REACTION ON TRUE: if the test returns true, e.g. #1=0 i.e. justified, return 3 as parameter for q, i.e. make it LEFT : this delimits reaction on TRUE from reaction of FALSE #1 REACTION ON FALSE: if the test returns false, e.g. #1 is not 0, then return the value which is the same as first parameter, e.g. centred for centred and so on. |
The conditional test returns a value different than 0 if it evaluates true, and zero value if it evaluates to false.
|
|
The conditional expressions do not work in tags which require string parameter type, in particular, in >co...< tag. For example, >co (LD = 8.5pt) ? M : C< won't work. As a consequence, you can't conditionally change the color of the text. |