ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Get "right" numbers using blocks and enumerations
@ 2016-09-01 19:18 Mikael P. Sundqvist
  2016-09-06 19:29 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael P. Sundqvist @ 2016-09-01 19:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

I'm trying to use blocks for answers in a text, but cannot get the
numbering to work as I want. I have read about \processblocks at the
wiki (http://wiki.contextgarden.net/Command/processblocks), but I'm
not sure that is my cure. I probably miss something easy...

The problem is probably easiest shown by an example:

%%%
\defineblock[A]
\hideblocks[A]

\defineenumeration[A][
text=A,
prefix=yes,
prefixsegments=chapter,
way=bychapter,
]

\starttext

\chapter{First chapter}

\beginA
\startA
My first answer in the first chapter.
\stopA
\endA

\beginA
\startA
My second answer in the first chapter.
\stopA
\endA


\chapter{Second chapter}

\beginA
\startA
My first answer in the second chapter.
\stopA
\endA

\beginA
\startA
My second answer in the second chapter.
\stopA
\endA

\chapter{Answers}
\useblocks[A]
\stoptext
%%%

I get, in the Answer chapter

A 3.1, A 3.2, A 3.3 and A 3.4.

What I want to have in the answer chapter is

A 1.1, A 1.2, A 2.1 and A 2.2.

(to follow the numbering in the chapters where the blocks were defined).

Is it possible? What have I missed?

Related: Is there a better way to set answers to questions? (Perhaps
not having to write both the \begin... \start... \stop... \end... for
every question?

/Mikael
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Get "right" numbers using blocks and enumerations
  2016-09-01 19:18 Get "right" numbers using blocks and enumerations Mikael P. Sundqvist
@ 2016-09-06 19:29 ` Wolfgang Schuster
  2016-09-06 19:52   ` Mikael P. Sundqvist
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2016-09-06 19:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1758 bytes --]

> Mikael P. Sundqvist <mailto:mickep@gmail.com>
> 1. September 2016 um 21:18
> Hi,
>
> I'm trying to use blocks for answers in a text, but cannot get the
> numbering to work as I want. I have read about \processblocks at the
> wiki (http://wiki.contextgarden.net/Command/processblocks), but I'm
> not sure that is my cure. I probably miss something easy...
>
> The problem is probably easiest shown by an example:
>
> %%%
> \defineblock[A]
> \hideblocks[A]
>
> \defineenumeration[A][
> text=A,
> prefix=yes,
> prefixsegments=chapter,
> way=bychapter,
> ]
>
> \starttext
>
> \chapter{First chapter}
>
> \beginA
> \startA
> My first answer in the first chapter.
> \stopA
> \endA
>
> \beginA
> \startA
> My second answer in the first chapter.
> \stopA
> \endA
>
>
> \chapter{Second chapter}
>
> \beginA
> \startA
> My first answer in the second chapter.
> \stopA
> \endA
>
> \beginA
> \startA
> My second answer in the second chapter.
> \stopA
> \endA
>
> \chapter{Answers}
> \useblocks[A]
> \stoptext
> %%%
>
> I get, in the Answer chapter
>
> A 3.1, A 3.2, A 3.3 and A 3.4.
>
> What I want to have in the answer chapter is
>
> A 1.1, A 1.2, A 2.1 and A 2.2.
>
> (to follow the numbering in the chapters where the blocks were defined).
>
> Is it possible? What have I missed?
Blocks only store their content without expanding counters etc. and when
you flush them you have the same result as putting them into the appendices
by hand.
> Related: Is there a better way to set answers to questions? (Perhaps
> not having to write both the \begin... \start... \stop... \end... for
> every question?
\setupblock[A][before=\startA,after=\stopA]

but you can’t use the optional argument for a enumerations anymore (e.g. 
to set a title) with this method.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 3287 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Get "right" numbers using blocks and enumerations
  2016-09-06 19:29 ` Wolfgang Schuster
@ 2016-09-06 19:52   ` Mikael P. Sundqvist
  0 siblings, 0 replies; 3+ messages in thread
From: Mikael P. Sundqvist @ 2016-09-06 19:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Sep 6, 2016 at 9:29 PM, Wolfgang Schuster
<schuster.wolfgang@gmail.com> wrote:
> Mikael P. Sundqvist
> 1. September 2016 um 21:18
> Hi,
>
> I'm trying to use blocks for answers in a text, but cannot get the
> numbering to work as I want. I have read about \processblocks at the
> wiki (http://wiki.contextgarden.net/Command/processblocks), but I'm
> not sure that is my cure. I probably miss something easy...
>
> The problem is probably easiest shown by an example:
>
> %%%
> \defineblock[A]
> \hideblocks[A]
>
> \defineenumeration[A][
> text=A,
> prefix=yes,
> prefixsegments=chapter,
> way=bychapter,
> ]
>
> \starttext
>
> \chapter{First chapter}
>
> \beginA
> \startA
> My first answer in the first chapter.
> \stopA
> \endA
>
> \beginA
> \startA
> My second answer in the first chapter.
> \stopA
> \endA
>
>
> \chapter{Second chapter}
>
> \beginA
> \startA
> My first answer in the second chapter.
> \stopA
> \endA
>
> \beginA
> \startA
> My second answer in the second chapter.
> \stopA
> \endA
>
> \chapter{Answers}
> \useblocks[A]
> \stoptext
> %%%
>
> I get, in the Answer chapter
>
> A 3.1, A 3.2, A 3.3 and A 3.4.
>
> What I want to have in the answer chapter is
>
> A 1.1, A 1.2, A 2.1 and A 2.2.
>
> (to follow the numbering in the chapters where the blocks were defined).
>
> Is it possible? What have I missed?
>
> Blocks only store their content without expanding counters etc. and when
> you flush them you have the same result as putting them into the appendices
> by hand.
>
> Related: Is there a better way to set answers to questions? (Perhaps
> not having to write both the \begin... \start... \stop... \end... for
> every question?
>
> \setupblock[A][before=\startA,after=\stopA]
>
> but you can’t use the optional argument for a enumerations anymore (e.g. to
> set a title) with this method.
>
> Wolfgang
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

Many thanks for your reply, Wolfgang (also in the other thread, but I
don't reply there, since I have nothing more to add at the moment). I
then leave the idea of having the blocks processed "where they are
written".

For now, I solve this by adding labels on all exercises, and refer to
them in the answers. It works, but my fantasy for naming the labels
are soon reaching the limit... :)

Best regards, Mikael
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2016-09-06 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 19:18 Get "right" numbers using blocks and enumerations Mikael P. Sundqvist
2016-09-06 19:29 ` Wolfgang Schuster
2016-09-06 19:52   ` Mikael P. Sundqvist

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