From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/36780 Path: news.gmane.org!not-for-mail From: Vyatcheslav Yatskovsky Newsgroups: gmane.comp.tex.context Subject: luatex "success story" Date: Sat, 29 Sep 2007 00:41:56 +0300 Message-ID: <988857753.20070929004156@gmail.com> References: Reply-To: Yatskovsky , mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1191015738 9648 80.91.229.12 (28 Sep 2007 21:42:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 28 Sep 2007 21:42:18 +0000 (UTC) To: "ntg-context-request@ntg.nl" Original-X-From: ntg-context-bounces@ntg.nl Fri Sep 28 23:42:12 2007 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 1IbNb7-0006hB-Fo for gctc-ntg-context-518@m.gmane.org; Fri, 28 Sep 2007 23:42:09 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 564701FCA2; Fri, 28 Sep 2007 23:42:04 +0200 (CEST) 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 29975-04-3; Fri, 28 Sep 2007 23:41:54 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 89EFD1FC93; Fri, 28 Sep 2007 23:41:54 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 7CF7C1FC93 for ; Fri, 28 Sep 2007 23:41:51 +0200 (CEST) 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 29975-04-2 for ; Fri, 28 Sep 2007 23:41:46 +0200 (CEST) Original-Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by ronja.ntg.nl (Postfix) with ESMTP id E3D541FC24 for ; Fri, 28 Sep 2007 23:41:45 +0200 (CEST) Original-Received: by ug-out-1314.google.com with SMTP id h2so1633327ugf for ; Fri, 28 Sep 2007 14:41:45 -0700 (PDT) Original-Received: by 10.66.252.8 with SMTP id z8mr5580371ugh.1191015705376; Fri, 28 Sep 2007 14:41:45 -0700 (PDT) Original-Received: from damndestly.feud.volia.net ( [77.121.145.195]) by mx.google.com with ESMTPS id p38sm7963699fke.2007.09.28.14.41.42 (version=SSLv3 cipher=OTHER); Fri, 28 Sep 2007 14:41:44 -0700 (PDT) X-Mailer: The Bat! (v3.99.3) Professional X-Priority: 3 (Normal) In-Reply-To: X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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:36780 Archived-At: Hello all, Let me share my luatex "success story". I teach computer science, and current topics I deliver are Numbering Systems and Data Representation. Yesterday, I needed to prepare about twenty test papers with 10 questions per a paper. Examples: "1. convert Dec 36 into Hex", "2. convert Bin 10010101 into Dec", etc. The wording of every question has not to be changed through papers, only numbers had. Instead of filling in numbers manually, I took more intelligent approach and (with Hans' help) wrote simple lua scripts to generate random numbers right inside my document: % question involving random decimal number Convert \ctxlua{n=math.random(30,60) ; tex.print(n) ;}\low{10} into Bin. % question involving random binary number Convert \startluacode for c = 1, 16 do n = math.random(0,1) tex.sprint(n) end \stopluacode\low{2} into Hex. and so on... I specified the lower and upper limits as two arguments of random function, and that was very easy indeed. Then I copied my finished test text and pasted it many-many times. (It was probably not very wise approach, but I'm not familiar with looping TeX commands at the moment.) Luatex did the rest of the job perfectly, and in minute I had test papers with identical questions but all different figures! I only had to cut papers apart and hand out to my students. Best regards, Vyatcheslav Yatskovsky ___________________________________________________________________________________ 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 ___________________________________________________________________________________