ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* What is the ConTeXt way to handle this \vbox trick?
@ 2021-05-08 20:05 Idris Samawi Hamid ادريس سماوي حامد
  2021-05-09 11:04 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Idris Samawi Hamid ادريس سماوي حامد @ 2021-05-08 20:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

Dear gang,

Consider the following MWE (for a sequential multiple-choice exam), using  
some old and ugly TeX code:

=======
\setupbodyfont[schola]
\noheaderandfooterlines
\setupwhitespace[big]

\def\CHOICE#1#2{\leavevmode\vbox{\tabskip=0pt\everycr={}
                 \halign{\strut\hfil##\hfil\cr#1\cr#2\cr}}}

\starttext
(Religion * Biology * Cosmology * Physics) is part of the subject matter  
of World Philosophies.

(Religion * Biology * Cosmology * Physics) is part of the subject matter  
of World Philosophies.

(\CHOICE{1}{Religion}\ * \CHOICE{X}{Biology} *
\CHOICE{2}{Cosmology}\ * \CHOICE{X}{Physics}) is part of the subject  
matter of World Philosophies.
\stoptext
=======

Result is attached. Question:

What is the most elegant ConTeXt way to get the same result as the above  
code, with equal or better control? Thank you in advance.

Best wishes
Idris
-- 
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80512

[-- Attachment #2: choice-mwe.pdf --]
[-- Type: application/pdf, Size: 8901 bytes --]

[-- Attachment #3: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: What is the ConTeXt way to handle this \vbox trick?
  2021-05-08 20:05 What is the ConTeXt way to handle this \vbox trick? Idris Samawi Hamid ادريس سماوي حامد
@ 2021-05-09 11:04 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2021-05-09 11:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users,
	Idris Samawi Hamid ادريس
	سماوي حامد

On 5/8/2021 10:05 PM, Idris Samawi Hamid ادريس سماوي حامد wrote:
> Dear gang,
> 
> Consider the following MWE (for a sequential multiple-choice exam), 
> using some old and ugly TeX code:
> 
> =======
> \setupbodyfont[schola]
> \noheaderandfooterlines
> \setupwhitespace[big]
> 
> \def\CHOICE#1#2{\leavevmode\vbox{\tabskip=0pt\everycr={}
>                  \halign{\strut\hfil##\hfil\cr#1\cr#2\cr}}}
> 
> \starttext
> (Religion * Biology * Cosmology * Physics) is part of the subject matter 
> of World Philosophies.
> 
> (Religion * Biology * Cosmology * Physics) is part of the subject matter 
> of World Philosophies.
> 
> (\CHOICE{1}{Religion}\ * \CHOICE{X}{Biology} *
> \CHOICE{2}{Cosmology}\ * \CHOICE{X}{Physics}) is part of the subject 
> matter of World Philosophies.
> \stoptext
> =======
> 
> Result is attached. Question:
> 
> What is the most elegant ConTeXt way to get the same result as the above 
> code, with equal or better control? Thank you in advance.
you can use some old, probaly never really used,  mechanism ...

\defineruby[auto]  [align=auto,color=darkred]
\defineruby[left]  [align=flushleft,color=darkred]
\defineruby[right] [align=flushright,color=darkred]
\defineruby[spread][stretch=yes]

\setupinterlinespace[22pt]

\starttext

\startbuffer
     \dorecurse{20}{\ruby{XYZ}{a|bc|d} }\par
     \dorecurse{20}{\ruby{PQR}{p|q|r} }\par
     \dorecurse{20}{\ruby{XYZ}{1|22|333} }\par
     \dorecurse{20}{\ruby{XYZ}{111|222|333} }\par
     \dorecurse{20}{\ruby{XYZ}{foobar} }\par
     \dorecurse{20}{\ruby{XYZ}{fooledbar} }\par
     \dorecurse{20}{\ruby[spread]{XYZ}{fooledbar} }\par
     \dorecurse{20}{\ruby{extremely}{wide} }\par
     \dorecurse{20}{\ruby{wide}{extremely} }\par
  stopbuffer

\testfeatureonce{1}{\start \setupinterlinespace[16pt] 
\setupruby[location=none]                   \getbuffer \stop \page}
\testfeatureonce{1}{\start \setupinterlinespace[16pt] 
\setupruby[location=right]                  \getbuffer \stop \page}
\testfeatureonce{1}{\start \setupinterlinespace[28pt] 
\setupruby[align=auto,color=darkred]        \getbuffer \stop \page}
\testfeatureonce{1}{\start \setupinterlinespace[28pt] 
\setupruby[align=flushleft,color=darkgreen] \getbuffer \stop \page}
\testfeatureonce{1}{\start \setupinterlinespace[28pt] 
\setupruby[align=flushright,color=darkblue] \getbuffer \stop \page}
\testfeatureonce{1}{\start \setupinterlinespace[28pt] 
\setupruby[align=middle,color=darkyellow]   \getbuffer \stop \page}

\stoptext

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-09 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08 20:05 What is the ConTeXt way to handle this \vbox trick? Idris Samawi Hamid ادريس سماوي حامد
2021-05-09 11:04 ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).