ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: solutions and problems
Date: Sun, 23 Feb 2014 20:51:14 +0100	[thread overview]
Message-ID: <8CD41798-D6F3-4C5B-A134-E7D79D44A1A1@gmail.com> (raw)
In-Reply-To: <20140223200945.4cc7e7a24161e9dd3f367440@telefonica.net>


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


Am 23.02.2014 um 20:09 schrieb Xan <dxpublica@telefonica.net>:

>> Am 22.02.2014 um 18:45 schrieb Xan <dxpublica at telefonica.net>:
>> 
>>> No, it does not work.
>>> 
>>> I have this:
>>> 
>>> % Questions
>>> \defineenumeration
>>> [exercici]
>>> [alternative=serried,text={\startcolor[darkblue]Exercici\stopcolor},stopper={.\space},left={\bgroup},right={\egroup},width=fit,headstyle=\ss,distance=0.25em,width=fit,before={\incrementcounter[resposta]}]
>>> 
>>> % Answers
>>> \defineenumeration[resposta][headstyle=\ss,text={Solucions de l'exercici \getnumber[exercici]},width=fit,alternative=serried,before={\decrementcounter[resposta]},number=no]
>>> 
>>> \defineblock[resposta]
>>> \hideblocks[resposta]
>>> 
>>> 
>>> % Exercises
>>> 
>>> \startexercici Bla...
>>> \beginresposta
>>> \resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, \item No té relació, \item D, \item D, \item No té relació, \item No té relació, \item D.\stopitemize) \par
>>> \endresposta
>>> \stopexercici
>>> 
>>> \startexercici Bla 2
>>> \stopexercici
>>> 
>>> \startexercici Bla 3
>>> \beginresposta
>>> \resposta (Solucions: \startitemize[a,text] \item D, \item I, \item D, \item No té relació, \item D, \item D, \item No té relació, \item No té relació, \item D.\stopitemize) \par
>>> \endresposta
>>> \stopexercici
>>> 
>>> \subject{Answers}
>>> 
>>> \selectblocks[resposta][criterium=section]
>>> 
>>> 
>>> I get \getnumber[exercici] as the last, not the counter of 'exercici' in which I have the answer. How can I do thaT?
>> 
>> Make a complete minimal example.
>> 
>> Wolfgang
> 
> 
> Simply put starttext and stoptext. Here it’s:

For a minimal example you don’t need so many setups for the enumerations and also text should be kept to a minimum.

> Can you help me?

Your counter settings are useless because context stores only the environment plus content for the answers, nothing is done with them at this point. When you flush the answer blocks context sees them for the first time and the counter for the questions is 3 at this point and this is why you get always the same value.

\defineenumeration[exercici][text=Exercici]
\defineenumeration[resposta][text=Solucions]

\defineblock[resposta]
\hideblocks[resposta]

\starttext

\startexercici Question 1
\beginresposta
\resposta Answer 1 \par
\endresposta
\stopexercici

\startexercici Question 2
\beginresposta
\incrementcounter[resposta]
\endresposta
\stopexercici

\startexercici Question 3
\beginresposta
\resposta Answer 3 \par
\endresposta
\stopexercici

\subject{Answers}

\selectblocks[resposta]

\stoptext

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 4158 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
___________________________________________________________________________________

  reply	other threads:[~2014-02-23 19:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20  9:15 Xan
2014-02-20 10:50 ` Otared Kavian
2014-02-20 12:22 ` Xan
2014-02-20 12:57   ` Thomas A. Schmitz
2014-02-20 19:29     ` Jaroslav Hajtmar
2014-02-20 13:13   ` Wolfgang Schuster
2014-02-20 19:31     ` Jaroslav Hajtmar
2014-02-21  9:28   ` Xan
2014-02-22 17:45     ` Xan
2014-02-22 18:57       ` Wolfgang Schuster
2014-02-23 19:09       ` Xan
2014-02-23 19:51         ` Wolfgang Schuster [this message]
2014-02-23 20:12         ` Xan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8CD41798-D6F3-4C5B-A134-E7D79D44A1A1@gmail.com \
    --to=wolfgang.schuster@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).