What is a better way to do this macro?
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 Best wishes Idris -- Idris Samawi Hamid Professor of Philosophy Colorado State University Fort Collins, CO 80523
Idris Samawi Hamid ادريس سماوي حامد mailto:Idris.Hamid@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
Hi Wolfgang,
On Thu, 16 Jul 2015 13:03:15 -0600, Wolfgang Schuster
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
Both examples are very instructive!! Thanks a million, Wolfgang, and Best wishes Idris -- Idris Samawi Hamid Professor of Philosophy Colorado State University Fort Collins, CO 80523
Hi Wolfgang, all, Here is a new test file. Objective: To control the interlinespacing of the \\ command inside of \framed while keeping the bottom argument y of {x\\y} on the same baseline as the rest of the sentence. Look carefully at the examples in the attached pdf and see how the baselines moves when top is used to control \\. A mixture of the parameters top and bottom does the trick, but the use of bottom is an ugly hack. Is there a better way? See below and attached Best wishes Idris =====choice-cs-new2.tex===== \setupinterlinespace[line=1.8em] \setupwhitespace[big] \defineframed[Choice][frame=off,location=bottom,align=middle,offset=0pt] \defineframed[ChoiceTop][frame=off,location=bottom,align=middle,offset=0pt,top={\setupinterlinespace[line=1.2em]}] \defineframed[ChoiceTopBottom][frame=off,location=bottom,align=middle,offset=0pt,top={\setupinterlinespace[line=1.2em]},bottom={\vskip.14em}] \starttext (One~* Two~* Three~* Four) is even. (\Choice{x\\One}~* \Choice{1\\Two}~* \Choice{x\\Three}~* \Choice{2\\Four}) is even. (\ChoiceTop{x\\One}~* \ChoiceTop{1\\Two}~* \ChoiceTop{x\\Three}~* \ChoiceTop{2\\Four}) is even. (\ChoiceTopBottom{x\\One}~* \ChoiceTopBottom{1\\Two}~* \ChoiceTopBottom{x\\Three}~* \ChoiceTopBottom{2\\Four}) is even. \stoptext ============================ -- Idris Samawi Hamid Professor of Philosophy Colorado State University Fort Collins, CO 80523
Idris Samawi Hamid ادريس سماوي حامد mailto:Idris.Hamid@colostate.edu 16. Juli 2015 22:09 Hi Wolfgang, all,
Here is a new test file. Objective: To control the interlinespacing of the \\ command inside of \framed while keeping the bottom argument y of {x\\y} on the same baseline as the rest of the sentence. Look carefully at the examples in the attached pdf and see how the baselines moves when top is used to control \\.
A mixture of the parameters top and bottom does the trick, but the use of bottom is an ugly hack. Is there a better way? See below and attached Use the foregroundstyle key to change the interlinespace.
Wolfgang
On Thu, 16 Jul 2015 22:35:45 -0600, Wolfgang Schuster
Use the foregroundstyle key to change the interlinespace.
Works like a charm. Question: Should the wiki page be edited: http://wiki.contextgarden.net/Command/setupframed It has the equivalent of foregroundstyle = <name> Shouldn't that be changed to foregroundstyle = <command> Originally I looked for keys mapped to <command> so I tried bottom and top because and those are the only keys that are mapped to <command> in the description. Or am I missing something here? Thanks, Wolfgang and Best wishes Idris -- Idris Samawi Hamid Professor of Philosophy Colorado State University Fort Collins, CO 80523
Idris Samawi Hamid ادريس سماوي حامد mailto:Idris.Hamid@colostate.edu 17. Juli 2015 19:56 On Thu, 16 Jul 2015 22:35:45 -0600, Wolfgang Schuster
wrote: Works like a charm. Question: Should the wiki page be edited:
http://wiki.contextgarden.net/Command/setupframed
It has the equivalent of
foregroundstyle = <name>
Shouldn't that be changed to
foregroundstyle = <command>
Originally I looked for keys mapped to <command> so I tried bottom and top because and those are the only keys that are mapped to <command> in the description. Or am I missing something here?
The foregroundstyle should list the same arguments as the style key from other commands/environments. For a example look at the arguments for \setupdescriptions: http://wiki.contextgarden.net/Command/setupdescriptions Wolfgang
On Fri, 17 Jul 2015 12:07:29 -0600, Wolfgang Schuster
Idris Samawi Hamid ادريس سماوي حامد mailto:Idris.Hamid@colostate.edu 17. Juli 2015 19:56 On Thu, 16 Jul 2015 22:35:45 -0600, Wolfgang Schuster
wrote: Works like a charm. Question: Should the wiki page be edited:
http://wiki.contextgarden.net/Command/setupframed
It has the equivalent of
foregroundstyle = <name>
Shouldn't that be changed to
foregroundstyle = <command>
Originally I looked for keys mapped to <command> so I tried bottom and top because and those are the only keys that are mapped to <command> in the description. Or am I missing something here?
The foregroundstyle should list the same arguments as the style key from other commands/environments.
For a example look at the arguments for \setupdescriptions: http://wiki.contextgarden.net/Command/setupdescriptions
Ah! Perhaps disambiguating would help unsuspecting users. So in
\setupdescriptions we have things like
style = normal bold slanted boldslanted type cap small... command
[i.e. style = <name>|<command>]
color = <name>
before = <command>
So in the explanation of the foregroundstyle key we could have, e.g.
foregroundstyle =
participants (2)
-
Idris Samawi Hamid ادريس سماوي ح امد
-
Wolfgang Schuster