diff options
Diffstat (limited to 'Master/texmf-dist/tex/optex/base/if-macros.opm')
-rw-r--r-- | Master/texmf-dist/tex/optex/base/if-macros.opm | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/optex/base/if-macros.opm b/Master/texmf-dist/tex/optex/base/if-macros.opm index 9113b5f8beb..148c8559413 100644 --- a/Master/texmf-dist/tex/optex/base/if-macros.opm +++ b/Master/texmf-dist/tex/optex/base/if-macros.opm @@ -1,6 +1,6 @@ %% This is part of the OpTeX project, see http://petr.olsak.net/optex -\_codedecl \newif {Special if-macros, is-macros and loops <2022-12-02>} % preloaded in format +\_codedecl \newif {Special if-macros, is-macros and loops <2023-01-16>} % preloaded in format \_doc ---------------------------- \secc Classical \code{\\newif} @@ -64,6 +64,7 @@ \_def \_iterate {\_body \_ea \_iterate \_fi} \_doc ----------------------------- + {\_let\_moremainpoints=\_relax \`\foreach` `<list>`\`\do` `{<what>}` repeats `<what>` for each element of the `<list>`. The `<what>` can include `#1` which is substituted by each @@ -82,7 +83,7 @@ Recommendation: it is better to use private variants of \`\_foreach`. When the user writes `\input tikz` then `\foreach` macro is redefined in each TikZ environment. - The private variants use \`\_do` separator instead `\do` separator. + The private variants use \`\_do` separator instead `\do` separator.} \_cod ----------------------------- \_newcount\_frnum % the numeric variable used in \fornum @@ -101,6 +102,7 @@ \_afterfi{\_foreachA{#1}{##1}}\_else\_afterfi{\_foreachA{#1}{#2}}\_fi} \_doc ----------------------------- + {\_let\_moremainpoints=\_relax \`\fornum` `<from>..<to>` \`\do` `{<what>}` or \`\fornumstep` `<num>: <from>..<to>` \`\do` `{<what>}` repeats `<what>` for each number from `<from>` to `<to>` (with step `<num>` @@ -110,7 +112,7 @@ The test in the \`\_fornumB` says: if (<to> $\string<$ <current number> AND <step> is positive) or if (<to> $>$ <current number> AND <step> is negative) then close loop by `\_getforstack`. Sorry, the condition is - writen by somewhat cryptoid \TeX/ language. + writen by somewhat cryptoid \TeX/ language.} \_cod ----------------------------- \_def\_fornum#1..#2\_do{\_fornumstep 1:#1..#2\_do} @@ -292,16 +294,17 @@ \_public \isfont ; \_doc ---------------------------- - The last macro \`\isnextchar` `<char>{<codeA>}{<codeB>}` + The macro \`\isnextchar` `<char>{<codeA>}{<codeB>}` has a different syntax than all other is-macros. It executes `<codeA>` if next character is equal to <char>. - Else the `<codeB>` is executed. The macro is not expandable. + Else the `<codeB>` is executed. The macro is expandable. \_cod ---------------------------- -\_long\_def\_isnextchar#1#2#3{\_begingroup\_toks0={\_endgroup#2}\_toks1={\_endgroup#3}% - \_let\_tmp= #1\_futurelet\_next\_isnextcharA +\_long\_def\_isnextchar#1#2#3{\_immediateassignment + \_def\_isnextcharA{\_isnextcharB{#1}{#2}{#3}}% + \_immediateassignment\_futurelet \_next \_isnextcharA } -\_def\_isnextcharA{\_the\_toks\_ifx\_tmp\_next0\_else1\_fi\_space} +\_long\_def\_isnextcharB#1{\_ifx\_next#1\_ea\_ignoresecond\_else\_ea\_usesecond\_fi} \_public \isnextchar ; @@ -359,6 +362,7 @@ \_endcode +2023-01-16 \isnextchar created expandable. 2022-12-02 \xcasesof: its first parameter is \long too. 2022-11-29 renamed to \casesof, \xcasesof. 2022-11-26 \casesby, \casesbyif introduced. |