Am 04.11.2009 um 11:52 schrieb Oliver Buerschaper:

Dear all,

how can I check whether a macro I defined is actually expanded into what I intended? For example, if I define

\define[2]\Test{#2, {\it #1}}

is there a (Lua?) function like

check(\Test{Hello}{world}, string)

that would return true for string = "world, {\it Hello}" and false otherwise? If the macro is a bit more complicated than this I usually get caught by a mistake rather quickly ... so a quick check would be very handy for me.

You can check the content in ConTeXt itself.

\define[2]\Test
{\doifelse{#1}{world}{\writedirect{Test \#1: true}}{\writedirect {Test \#1: false}}% \doifelse{#2}{Hello}{\writedirect{Test \#2: true}}{\writedirect {Test \#2: false}}%
   #2, {\it#1}}

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to