Re: [NTG-context] Defining commands in \start ... \stop
And so? This has not [mathematical] solution ;-) Xan. > 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 ___
Re: [NTG-context] Defining commands in \start ... \stop
Am 30.03.2014 um 19:28 schrieb Xan : > 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 ___
Re: [NTG-context] Defining commands in \start ... \stop
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 ___ 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 ___