ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Q: Keeping blocks together
@ 2001-10-25  8:45 Jose Luis Diaz
  2001-10-25  9:54 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Jose Luis Diaz @ 2001-10-25  8:45 UTC (permalink / raw)


Hello ConTeXt users,

 I  want to have two kind of blocks typeset with different format, but
 disallowing  a  page break inbetween. For example, assume that I have
 pairs  Question/Answer,  and  I  never  want  a  page break after the
 Question,  but  a  page  break  after  the answer is desirable. To be
 precise,  I'm  working  in  a multicolumn environment (3 columns) and
 what I want to allow/disallow are the column breaks.
 I tried the following:

 \defineblock[Question,Answer]
 \setupblock[Question]
    [before={\startitemize[2]\item},
     after={\stopitemize\page[no]},
    ]
 \setupblock[Answer]
    [before={\startframedtext[width=\textwidth]\startcolor[red]},
     after={\stopcolor\stopframedtext\page[preference]},
    ]

 (BTW, I need to put a comma at the end of the "after" line, why?)
 This  code  doesn't  work.  I  keep getting column breaks between the
 question and the answer (surprisingly, it appears that a column break
 is indeed *prefered* in that position, since I get a lot of them)

 What  I'm  doing  wrong?  I even tried resorting to the TeX primitive
 \penalty,  instead  of  using  \page.  Are  penalties  ignored  when
 typesetting in columns?

 Anothe question. While testing the above code, I tried the following
 main text:

\starttext
\dorecurse{10}{
  \beginQuestion
  \input tufte
  \endQuestion
  \beginAnswer
    I don't know the answer.
  \endAnswer
 }
 \stoptext

 But I get no text in the output.

 And  a  last  question.  It  is "philosophically" correct to use text
 blocks  for  the  stated purpose? As far as I understand, text blocks
 are  provided  for  "hidding" the text until an adecuate place in the
 output,  but  in  my case I need no hidding. There is another way for
 defining start/stop pairs? (something like the LaTeX \newenvironment)

 Thanks  in  advance, and excuse the extension of the message. I'm new
 to ConTeXt, and I have yet a lot to learn.

-- 
  Jose Luis Diaz


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

end of thread, other threads:[~2001-10-25 16:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-25  8:45 Q: Keeping blocks together Jose Luis Diaz
2001-10-25  9:54 ` Hans Hagen
2001-10-25 11:20   ` Re[2]: " Jose Luis Diaz
2001-10-25 12:10     ` Hans Hagen
2001-10-25 16:29       ` Re[3]: Q: Keeping blocks together. New problems Jose Luis Diaz

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).