From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/47950 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Two questions - Cross Referencing (Automated label generation + Random items) Date: Wed, 4 Mar 2009 14:26:54 +0100 Message-ID: <567CE7CB-9D51-4180-9B30-2AE8CFCB9CA2@gmail.com> References: <6A462629-D6C0-4A9C-81E7-E5B130A4CB7D@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v930.3) Content-Type: text/plain; charset="us-ascii"; Format="flowed"; DelSp="yes" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1236175691 21356 80.91.229.12 (4 Mar 2009 14:08:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Mar 2009 14:08:11 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Mar 04 15:09:27 2009 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1Lermp-0005IA-0k for gctc-ntg-context-518@m.gmane.org; Wed, 04 Mar 2009 15:09:27 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 205FC1FB5B; Wed, 4 Mar 2009 15:07:38 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10715-04-2; Wed, 4 Mar 2009 15:06:35 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 66FD91FB57; Wed, 4 Mar 2009 15:06:20 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4C4A31FB1F for ; Wed, 4 Mar 2009 15:05:57 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14451-02-2 for ; Wed, 4 Mar 2009 15:04:29 +0100 (CET) Original-Received: from filter3-til.mf.surf.net (filter3-til.mf.surf.net [194.171.167.219]) by ronja.ntg.nl (Postfix) with ESMTP id 761961FB1D for ; Wed, 4 Mar 2009 14:29:17 +0100 (CET) Original-Received: from mail-fx0-f167.google.com (mail-fx0-f167.google.com [209.85.220.167]) by filter3-til.mf.surf.net (8.13.8/8.13.8/Debian-3) with ESMTP id n24DRa6a005055 for ; Wed, 4 Mar 2009 14:28:32 +0100 Original-Received: by fxm11 with SMTP id 11so3102276fxm.2 for ; Wed, 04 Mar 2009 05:27:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=GEPevZB1yzZxlw0URLT8PFAt1C6v7OSDtakT7+Vwyz0=; b=hCi6DgCVyppROQdBwCPBYOgLZAYRWMMeUGOOStRq4BAYFg7aKAI6nsGa/5l/m2nJ4/ 8tDLMhZ7QZqozNY0W+2Ex1KmEms1axrE9WazJ7a/26cu8IgnuJfaSsSaAErqRjUB3gRK oLEnAs7ffEdnpYSxL2nOZBBXRVLZ8lJItVTzc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=pAqckf5SbME1oSXcfWquWhaPE5Kb1EEwXzKCwflThNgtMV8O24+q8cSB5jEon7uP5X 5hZnnPKTffBtnKF18G+SmR//Pgxp4tBKDLUAmK88aOGe447UpfjVyiBk3spAKHS8SIiz LI/4Q+iOmDeTkreSeLi5hYNsxvAHlZTc5aOrc= Original-Received: by 10.86.74.4 with SMTP id w4mr62506fga.57.1236173256162; Wed, 04 Mar 2009 05:27:36 -0800 (PST) Original-Received: from ?10.40.148.122? ([82.113.121.153]) by mx.google.com with ESMTPS id e11sm1928431fga.40.2009.03.04.05.27.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 04 Mar 2009 05:27:35 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.930.3) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.220.167; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 188464013 - 2b1d98adb18d X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.219 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.11 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 X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:47950 Archived-At: Am 04.03.2009 um 13:54 schrieb Curious Learn: > Awesome solution. Works great. Thanks very much Wolfgang. I can now > use your > solution. If it is not too difficult to explain, I would appreciate > if someone > could explain why the following does not work. It is not necessary > because > Wolfgang's solution is great but will help me understand it better. > > \def\AnsT > {\doglobal\increment\choicecounter > \startitem[\choicecounter]#1\stopitem} > \def\eAns{\stopitem} > > With these commands if I use > > \AnsT This is the CORRECT answer. \eAns > \startwrongitem Yet another wrong answer. \stopwrongitem > > I get the error "File ended while scanning use of \startitem" It has to do with the that for randomized items ConTeXt has to know the text for each item, to do this the normal \item ... is not enough and \startitem ... \stopitem is needed. Each \startitem ... \stopitem pair collects the text between it and add it to a list. The collecting works in the way that \startitem grab everything untill it sees a \stopitem command. If you want to write your own command you need a similiar mechanism where your \AnsT grab everything till \eAns but this did not work in the way you defined the command yourself. The low level way to do this is: \def\AnsT#1\eAns {\doglobal\increment\choicecounter \startitem[\choicecounter]#1\stopitem} Another way to do this with a few ConTeXt commands is: \define[1]\Rightitem {\doglobal\increment\choicecounter \startitem[\choicecounter]#1\stopitem} \define\AnsT {\grabuntil{eAns}\Rightitem} 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________