ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \useblocks in section
@ 2005-12-21  3:16 David Arnold
  2005-12-21  9:29 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: David Arnold @ 2005-12-21  3:16 UTC (permalink / raw)


All,

This doesn't seem to work as expected. Replacing the \useblocks with  
\selectblocks also produces an unexpected result. What am I doing  
wrong? I am trying to have only the answers from the chapter show up.

%output=pdf

\defineenumeration[question][location=serried,text=Question]
\defineenumeration[answer][location=serried,text=Answer]
\defineblock[question,answer]
\hideblocks[answer]

\starttext

\chapter{First Chapter}

\input tufte

\beginquestion
\startquestion
   What is the square root of 4?
\stopquestion
\endquestion

\beginanswer
\startanswer
   2
\stopanswer
\endanswer

\section{Answers}

\useblocks[answer][criterium=chapter]

\chapter{Second Chapter}

\input tufte

\beginquestion
\startquestion
   What is the square root of 9?
\stopquestion
\endquestion

\beginanswer
\startanswer
   3
\stopanswer
\endanswer

\section{Answers}

\useblocks[answer][criterium=chapter]

\stoptext

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

* Re: \useblocks in section
  2005-12-21  3:16 \useblocks in section David Arnold
@ 2005-12-21  9:29 ` Hans Hagen
  2005-12-21 18:57   ` David Arnold
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2005-12-21  9:29 UTC (permalink / raw)


David Arnold wrote:

> All,
>
> This doesn't seem to work as expected. Replacing the \useblocks with  
> \selectblocks also produces an unexpected result. What am I doing  
> wrong? I am trying to have only the answers from the chapter show up.

ah, old code, something got lost when i added parameter support ...

\unprotect

\def\getblockstatus#1% is this still ok
  {\dosetfilterlevel{\@@bscriterium}\empty
   \expanded{\doifblklevelelse[#1\sectionseparator\sectionseparator0]}
     {\global\blockpermittedtrue}
     {\global\blockpermittedfalse}%
   \def\blockstatus{#1}}

\def\doselectblocks[#1][#2][#3]%
  {\begingroup
   \doifelsenothing{#3}
     {\getparameters[\??bs][\c!criterium=\v!all,#2]%
      \dodouseblocks[#1][]}
     {\getparameters[\??bs][\c!criterium=\v!all,#3]%
      \dodouseblocks[#1][#2]}}%

\def\selectblocks
  {\dotripleempty\doselectblocks}

\protect

use \selectblocks when you want a criterium

>
> %output=pdf
>
> \defineenumeration[question][location=serried,text=Question]
> \defineenumeration[answer][location=serried,text=Answer]
> \defineblock[question,answer]
> \hideblocks[answer]
>
> \starttext
>
> \chapter{First Chapter}
>
> \input tufte
>
> \beginquestion
> \startquestion
>   What is the square root of 4?
> \stopquestion
> \endquestion
>
> \beginanswer
> \startanswer
>   2
> \stopanswer
> \endanswer
>
> \section{Answers}
>
> \useblocks[answer][criterium=chapter]
>
> \chapter{Second Chapter}
>
> \input tufte
>
> \beginquestion
> \startquestion
>   What is the square root of 9?
> \stopquestion
> \endquestion
>
> \beginanswer
> \startanswer
>   3
> \stopanswer
> \endanswer
>
> \section{Answers}
>
> \useblocks[answer][criterium=chapter]
>
> \stoptext
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: \useblocks in section
  2005-12-21  9:29 ` Hans Hagen
@ 2005-12-21 18:57   ` David Arnold
  2005-12-22  9:29     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: David Arnold @ 2005-12-21 18:57 UTC (permalink / raw)


Hans, that worked. Code below. Is this something you will fix in one  
of the core files?

%output=pdf

\unprotect

\def\getblockstatus#1% is this still ok
{\dosetfilterlevel{\@@bscriterium}\empty
   \expanded{\doifblklevelelse[#1\sectionseparator\sectionseparator0]}
     {\global\blockpermittedtrue}
     {\global\blockpermittedfalse}%
   \def\blockstatus{#1}}

\def\doselectblocks[#1][#2][#3]%
{\begingroup
   \doifelsenothing{#3}
     {\getparameters[\??bs][\c!criterium=\v!all,#2]%
      \dodouseblocks[#1][]}
     {\getparameters[\??bs][\c!criterium=\v!all,#3]%
      \dodouseblocks[#1][#2]}}%

\def\selectblocks
{\dotripleempty\doselectblocks}

\protect


\starttext

\defineenumeration[question][location=serried,text=Question]
\defineenumeration[answer][location=serried,text=Answer]
\defineblock[question,answer]
\hideblocks[answer]

\chapter{First Chapter}

\input tufte

\beginquestion
\startquestion
   What is the square root of 4?
\stopquestion
\endquestion

\beginanswer
\startanswer
   2
\stopanswer
\endanswer

\section{Answers}

\selectblocks[answer][criterium=chapter]

\chapter{Second Chapter}

\input tufte

\beginquestion
\startquestion
   What is the square root of 9?
\stopquestion
\endquestion

\beginanswer
\startanswer
   3
\stopanswer
\endanswer

\section{Answers}

\selectblocks[answer][criterium=chapter]

\stoptext


On Dec 21, 2005, at 1:29 AM, Hans Hagen wrote:

> David Arnold wrote:
>
>> All,
>>
>> This doesn't seem to work as expected. Replacing the \useblocks  
>> with  \selectblocks also produces an unexpected result. What am I  
>> doing  wrong? I am trying to have only the answers from the  
>> chapter show up.
>
> ah, old code, something got lost when i added parameter support ...
>
> \unprotect
>
> \def\getblockstatus#1% is this still ok
>  {\dosetfilterlevel{\@@bscriterium}\empty
>   \expanded{\doifblklevelelse[#1\sectionseparator\sectionseparator0]}
>     {\global\blockpermittedtrue}
>     {\global\blockpermittedfalse}%
>   \def\blockstatus{#1}}
>
> \def\doselectblocks[#1][#2][#3]%
>  {\begingroup
>   \doifelsenothing{#3}
>     {\getparameters[\??bs][\c!criterium=\v!all,#2]%
>      \dodouseblocks[#1][]}
>     {\getparameters[\??bs][\c!criterium=\v!all,#3]%
>      \dodouseblocks[#1][#2]}}%
>
> \def\selectblocks
>  {\dotripleempty\doselectblocks}
>
> \protect
>
> use \selectblocks when you want a criterium
>
>>
>> %output=pdf
>>
>> \defineenumeration[question][location=serried,text=Question]
>> \defineenumeration[answer][location=serried,text=Answer]
>> \defineblock[question,answer]
>> \hideblocks[answer]
>>
>> \starttext
>>
>> \chapter{First Chapter}
>>
>> \input tufte
>>
>> \beginquestion
>> \startquestion
>>   What is the square root of 4?
>> \stopquestion
>> \endquestion
>>
>> \beginanswer
>> \startanswer
>>   2
>> \stopanswer
>> \endanswer
>>
>> \section{Answers}
>>
>> \useblocks[answer][criterium=chapter]
>>
>> \chapter{Second Chapter}
>>
>> \input tufte
>>
>> \beginquestion
>> \startquestion
>>   What is the square root of 9?
>> \stopquestion
>> \endquestion
>>
>> \beginanswer
>> \startanswer
>>   3
>> \stopanswer
>> \endanswer
>>
>> \section{Answers}
>>
>> \useblocks[answer][criterium=chapter]
>>
>> \stoptext
>>
>> _______________________________________________
>> ntg-context mailing list
>> ntg-context@ntg.nl
>> http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: \useblocks in section
  2005-12-21 18:57   ` David Arnold
@ 2005-12-22  9:29     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2005-12-22  9:29 UTC (permalink / raw)


David Arnold wrote:

> Hans, that worked. Code below. Is this something you will fix in one  
> of the core files?

sure, for the moment put the patch in cont-new.tex

(i'll post an update as soon as we have the french interface integrated; 
needs some synchronization)

Hans

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

end of thread, other threads:[~2005-12-22  9:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-21  3:16 \useblocks in section David Arnold
2005-12-21  9:29 ` Hans Hagen
2005-12-21 18:57   ` David Arnold
2005-12-22  9:29     ` 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).