From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/64656 Path: news.gmane.org!not-for-mail From: "Thomas Schmitz" Newsgroups: gmane.comp.tex.context Subject: Re: mkiv: append to buffer Date: Sun, 19 Dec 2010 12:28:58 +0100 Message-ID: References: <0458BC42-65A5-439F-9562-3724C924A585@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1292758153 7087 80.91.229.12 (19 Dec 2010 11:29:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 19 Dec 2010 11:29:13 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Dec 19 12:29:07 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PUHRr-0002ui-Er for gctc-ntg-context-518@m.gmane.org; Sun, 19 Dec 2010 12:29:07 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9736ECA91A; Sun, 19 Dec 2010 12:29:06 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ov1dUqZ7eogE; Sun, 19 Dec 2010 12:29:04 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D5E2FCA90D; Sun, 19 Dec 2010 12:29:03 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BEC2DCA90D for ; Sun, 19 Dec 2010 12:29:01 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RJVfqu3RvDbo for ; Sun, 19 Dec 2010 12:28:59 +0100 (CET) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id 621FACA8CF for ; Sun, 19 Dec 2010 12:28:59 +0100 (CET) Original-Received: from uni-bonn.de (mail1x.uni-bonn.de [131.220.15.112]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oBJBSwXw001907 for ; Sun, 19 Dec 2010 12:28:59 +0100 Original-Received: from [93.210.244.240] (account tschmit1@uni-bonn.de) by be2.uni-bonn.de (CommuniGate Pro WEBUSER 5.2.12) with HTTP id 6056379 for ntg-context@ntg.nl; Sun, 19 Dec 2010 12:28:58 +0100 X-Mailer: CommuniGate Pro WebUser v5.2.12 In-Reply-To: <0458BC42-65A5-439F-9562-3724C924A585@gmail.com> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=131.220.15.112; country=DE; region=07; city=Bonn; latitude=50.7333; longitude=7.1000; http://maps.google.com/maps?q=50.7333,7.1000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 06DIXsWl3 - 1d87166d1c6d - 20101219 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:64656 Archived-At: On Sat, 18 Dec 2010 19:35:53 +0100 Wolfgang Schuster = wrote: > = > Am 18.12.2010 um 17:52 schrieb Aditya Mahajan: > = >> I am not sure what you want to do, and why you want to = >>use buffers. Wont a simple token list work? > = > I can only agree with this, token lists are the easiest = >solution but the new cld manuals mentions the = >=93context.tobuffer=94 function which allows one to add = >content to a buffer. > = > Wolfgang Aditya, Wolfgang, thanks for your replies. I didn't want = to bore the list with lengthy explanations, but maybe I = didn't give enough information. So here comes what I hope = are the relevant bits: I'm typesetting sheets with = problems and solutions for a class. Those come from an xml = database. Unfortunately, there is one catch: depending on = the type of the problem, some problems don't have an = explicit solution. The problems are typeset as a numbered = itemization on page 1; on page 2, I want the solutions, = with matching numbers. And since I'm lazy, I don't want to = take care of this myself but have context do it for me. So = let's begin with the output. I want: PROBLEMS 1. problem without solution 2. problem with solution 3. problem without solution 4. problem with solution and then, on a new page: SOLUTIONS 2. solution to 2 4. solution to 4 So: I have been trying to write a macro that will retrieve = problems from the database (successful, with help by = Hans), pack them in an itemize list (successful), and = store the solution somewhere so it can be typeset on the = next page (unsuccessful as yet). I thought buffers were = the natural way to go, but I must admit I didn't know = about tokenlists. Aditya's suggestion unfortunately = doesn't seem to work with itemizations. Test files: This works: \newtoks\mytoks \def\TestMacro#1#2#3% {\color[darkred]{#1} \color[darkblue]{#2}\endgraf \appendtoks \color[darkgreen]{#3} \to\mytoks} \starttext \TestMacro{A}{B}{C} \TestMacro{X}{Y}{Z} \hairline \the\mytoks and this doesn't: \newtoks\mytoks \def\TestMacro#1#2#3% {\item[#1] #2\par \appendtoks \in[#1]: {#3} \to\mytoks} \starttext \startitemize[n] \TestMacro{A}{B}{C} \TestMacro{X}{Y}{Z} \stopitemize \hairline \the\mytoks I have absolutely no preference for buffers or = itemizations or whatever, so if there's a better solution, = I'm all open. But for the time being, I don't get what I = want. I'll look into "context.tobuffer" next... Thanks for any suggestions, and best wishes Thomas ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________