[NTG-context] Making checkboxes

Cecil Westerhof cldwesterhof at gmail.com
Mon Sep 6 11:14:33 CEST 2010


I am trying to define a (paper) feedback form. One of the things I
need is checkboxes. A first stab for this (for example I need also a
start text, but I do one step at a time) is, based on TeX by Topic, a
Texnician's Reference page 106:
    \def\checkBox#1,{\space\space\space\space[\space\space] #1\par}

    \def\checkBoxes(#1,){\xcheckBoxes#1, xxx,}
    \def\endpiece{xxx}
    \def\xcheckBoxes#1,{\def\temp{#1}%
      \ifx\temp\endpiece
      \else \checkbox#1,%
        \expandafter\xcheckBox
      \fi}

    \starttext

    Some text

    \checkBoxes Yes, No, A little bit,xxx

    \stoptext

I would expect:
    Some text
        [  ] Yes
        [  ] No
        [  ] A little bit
but I get:
    Some text
    es, No, A little bit,xxx

What am I doing wrong?

Something else: how do I 'eat' spaces between parameters. I would like
to have:
    \checkBoxes Yes,No,A little bit,xxx
and:
    \checkBoxes Yes, No,   A little bit,    xxx
the same result.

And is there a way to know how many parameters a macro gets? Like ${#}
in Bash. That would make things easier.

-- 
Cecil Westerhof
M CLDWesterhof at gmail.com

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Please do not send me Microsoft Office/Apple iWork documents.
Send OpenDocument instead! http://fsf.org/campaigns/opendocument/


More information about the ntg-context mailing list