[NTG-context] What is a better way to do this macro?

Wolfgang Schuster schuster.wolfgang at gmail.com
Thu Jul 16 21:03:15 CEST 2015


> Idris Samawi Hamid ادريس سماوي حامد <mailto:Idris.Hamid at colostate.edu>
> 16. Juli 2015 20:49
> Dear gang,
>
> Consider the following (also attached):
>
> =====choice-cs.tex====
> \def\CHOICE#1#2{\leavevmode\vbox{\tabskip=0pt\everycr={}
>                 \halign{\strut\hfil##\hfil\cr#1\cr#2\cr}}}
>
> \setuppagenumber[state=stop]
> \setupwhitespace[big]
>
> \starttext
> (One~* Two~* Three~* Four) is even.
>
> (\CHOICE{x}{One}~* \CHOICE{1}{Two}~* \CHOICE{x}{Three}~* 
> \CHOICE{2}{Four}) is even.
> \stoptext
> ======================
>
> What is best way to define the \CHOICE macro without low-level TeX 
> commands, only high-level ConTeXt commands? Thanks in advance and
You can use the \framed command.

\define[2]\ChoiceOne
   
{\dontleavehmode\framed[frame=off,location=bottom,align=middle,offset=0pt]{#1\\#2}}

\defineframed[ChoiceTwo][frame=off,location=bottom,align=middle,offset=0pt]

\starttext

(\ChoiceOne{x}{One}~* \ChoiceOne{1}{Two}~* \ChoiceOne{x}{Three}~* 
\ChoiceOne{2}{Four}) is even.

(\ChoiceTwo{x\\One}~* \ChoiceTwo{1\\Two}~* \ChoiceTwo{x\\Three}~* 
\ChoiceTwo{2\\Four}) is even.

\stoptext

Wolfgang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150716/1781e4f5/attachment.html>


More information about the ntg-context mailing list