ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: solutions and problems
Date: Thu, 20 Feb 2014 14:13:19 +0100	[thread overview]
Message-ID: <61E33008-2B95-4DA6-BE14-91B2A659221D@gmail.com> (raw)
In-Reply-To: <20140220132233.a836d8f54fcf1cad6c02abd1@telefonica.net>


Am 20.02.2014 um 13:22 schrieb Xan <dxpublica@telefonica.net>:

> Not exactly. If you don't have the same number of answers that the number of questions, so your counter is not properly set. See that:
> 
> \defineblock[question]
> \defineblock[hint]
> \defineblock[answer]
> 
> \defineenumeration[question][alternative=hanging,width=2.5cm,text={Question},stopper={.}]
> \defineenumeration[hint]    [alternative=hanging,width=4cm,text={Hint for question},stopper={.}]
> \defineenumeration[answer]  [alternative=hanging,width=4.5cm,text={Answer to question},stopper={.}]
> 
> \keepblocks[question]
> \hideblocks[hint]
> \hideblocks[answer]
> 
> \starttext
> 
> \section{Questions}
> 
> \beginquestion
> \startquestion
>  Compute $4\times 5$.
> \stopquestion
> \endquestion
> 
> 
> \beginhint
> \starthint
>  Use the fact that $2\times 5 = 10$.
> \stophint
> \endhint
> 
> %\beginanswer
> %\startanswer
> %  $20$.
> %\stopanswer
> %\endanswer
> 
> \beginquestion
> \startquestion
>  What is the value of $100/10$?
> \stopquestion
> \endquestion
> 
> \beginhint
> \starthint
> Remember that $10\times 10 = 100$.
> \stophint
> \endhint
> 
> \beginanswer
> \startanswer
> $10$
> \stopanswer
> \endanswer
> 
> \section{Hints}
> 
> \useblocks[hint]
> 
> \section{Answers}
> 
> \useblocks[answer]
> 
> \stoptext
> 
> If you comment one solution, then, you get "Answer to question 1", instead of "Answer of question 2", which is really. No always a question has an answer provided by me ;-)


You can add a answer block which increments the answer counter.

\defineblock[question]
\defineblock[answer]

\defineenumeration[question][text={Question}]
\defineenumeration[answer]  [text={Answer}]

\keepblocks[question]
\hideblocks[answer]

\starttext

\chapter{Question}

\beginquestion
	\startquestion
		Question 1.
	\stopquestion
\endquestion

\beginanswer
	\startanswer
		Answer 1.
	\stopanswer
\endanswer

\beginquestion
	\startquestion
		Question 2.
	\stopquestion
\endquestion

\beginanswer
	\incrementcounter[answer]
\endanswer

\beginquestion
	\startquestion
		Question 3.
	\stopquestion
\endquestion

\beginanswer
	\startanswer
		Answer 3.
	\stopanswer
\endanswer

\chapter{Answers}

\useblocks[answer]

\stoptext

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
___________________________________________________________________________________


  parent reply	other threads:[~2014-02-20 13:13 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 [this message]
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
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=61E33008-2B95-4DA6-BE14-91B2A659221D@gmail.com \
    --to=schuster.wolfgang@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).