Hi, Re: http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions What kind of emptyness do \doifempty, \doifnotempty, \doifemptyelse test ? \def\ISay{} %\def\ISay{Boe!} \starttext \doifemptyelse{\ISay}{I say shhhhht}{I say \ISay} \blank \doif{\ISay}{}{I say shhhhht} \blank \doifnot{\ISay}{}{I say \ISay} \stoptext -- Best, Alan * TeX engine = LuaTeX * ConTeXt minimals ver: 2009.01.18 14:39 MKIV fmt: 2009.1.22 int: english/english * Ubuntu 8.04 Hardy Heron, Windows XP SP3 Home
On Sun, 8 Feb 2009, Alan Stone wrote:
Re: http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions
What kind of emptyness do \doifempty, \doifnotempty, \doifemptyelse test ?
Hello Alan, Here a small test file: \def\Empty{} \def\Macro#1{argument is \doifemptyelse{#1}{empty}{full}} \starttext \quotation{Remember to expand it yourself where needed.} \Macro{}, \Macro{blabla} Nothing: \doifemptyelse{}{empty}{full} \type{\Empty}: \doifemptyelse{\Empty}{empty}{full} \type{all expanded}: \expanded{\doifemptyelse{\Empty}{empty}{full}} \type{with \expandafter}: \expandafter\doifemptyelse\expandafter{\Empty}{empty}{full} \stoptext Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/
Peter Münster schrieb:
On Sun, 8 Feb 2009, Alan Stone wrote:
Re: http://wiki.contextgarden.net/System_Macros/Branches_and_Decisions
What kind of emptyness do \doifempty, \doifnotempty, \doifemptyelse test ?
Hello Alan,
Here a small test file:
\def\Empty{} \def\Macro#1{argument is \doifemptyelse{#1}{empty}{full}} \starttext \quotation{Remember to expand it yourself where needed.}
\Macro{}, \Macro{blabla}
Nothing: \doifemptyelse{}{empty}{full}
\type{\Empty}: \doifemptyelse{\Empty}{empty}{full}
\type{all expanded}: \expanded{\doifemptyelse{\Empty}{empty}{full}}
\type{with \expandafter}: \expandafter\doifemptyelse\expandafter{\Empty}{empty}{full}
You can use ConTeXt's \ExpandAfter: \ExpandAfter\doifemptyelse{\Empty}{empty}{full}
\stoptext
@Alan: It's better to use \doifsomething / \doifelsenothing because they work also with macro content. Wolfgang
participants (3)
-
Alan Stone
-
Peter Münster
-
Wolfgang Schuster