[NTG-context] Why does \doifsomething think there is content?

Joel uaru99 at yahoo.com
Sun Jan 15 17:28:07 CET 2023


I am creating a book that presents readers with a list of recommended materials.
If materials are listed, then its displayed under the \subject{Materials} heading in a simple itemized list.
I'm using \doifsomething{} to check if any items are listed.
The problem I'm having is, when fed a blank macro, `\define\needsoven{}` it thinks there is content, so it displays the "Materials" heading, but an empty list. I have a custom macro that determins "if oven is needed" independent of these other items. So I need  `\define\needsoven{}` to be regarded as nothing.
How can I get \doifsomething{} to think \define\needsoven{} is an empty value?
--Joel
My minimal working example is below:
\define\needsoven{}
\define[1]\materialsneeded{%
        \doifsomething{#1}{
            \subject{Materials}
                \startitemize
                    #1
                \stopitemize
        }        
}

\starttext

    \chapter{Recipe 1}
        \materialsneeded{\needsoven}
        
        \subject{Instructions}
        
            Spread peanut butter on sandwich.
        
    \chapter{Recipe 2}
        
        \materialsneeded{\item pizza cutter \item stove}
        
        \subject{Instructions}
        
            Preheat oven to 450 degrees F.
            
\stoptext


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20230115/09cf7145/attachment.htm>


More information about the ntg-context mailing list