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: Defining commands in \start ... \stop
Date: Sun, 30 Mar 2014 19:29:49 +0200	[thread overview]
Message-ID: <1394F179-A148-46C1-8196-9AF523413935@gmail.com> (raw)
In-Reply-To: <20140330192800.10b317897d5e3e4afbfa31a5@telefonica.net>


Am 30.03.2014 um 19:28 schrieb Xan <dxpublica@telefonica.net>:

> This:
> 
> \defineblock[question]
> \defineblock[answer]
> 
> \defineenumeration[question][text={Question}]
> \defineenumeration[answer]  [text={Answer}]
> 
> \keepblocks[question]
> \hideblocks[answer]
> 
> 
> \def\mynewcommand{\dosingleempty\doMyNewCommand}
> \def\doMyNewCommand[#1]#2{%
> \iffirstargument
>     \beginquestion
>       \startquestion #2%
>       \stopquestion
>     \endquestion
>       \beginanswer \startanswer #1%
>       \stopanswer \endanswer
> \else
>     \beginquestion
>       \startquestion #2%
>       \stopquestion
>     \endquestion
>       \incrementcounter[answer]
> \fi
> }
> 
> 
> \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
> 
> \mynewcommand{Question 5}
> 
> \mynewcommand[Resposta 6]{Question 6}
> 
> \chapter{Answers}
> 
> \useblocks[answer]
> 
> \stoptext
> 
> does not work

The block commands use a buffer to store the content and buffers can’t be used in commands.

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
___________________________________________________________________________________


  reply	other threads:[~2014-03-30 17:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-30 17:13 Xan
2014-03-30 17:28 ` Xan
2014-03-30 17:29   ` Wolfgang Schuster [this message]
2014-03-30 18:42   ` 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=1394F179-A148-46C1-8196-9AF523413935@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).