From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/60369 Path: news.gmane.org!not-for-mail From: Vnpenguin Newsgroups: gmane.comp.tex.context Subject: LuaTeX & printf() function ? Date: Fri, 23 Jul 2010 22:25:44 +0200 Message-ID: Reply-To: 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: dough.gmane.org 1279916754 23788 80.91.229.12 (23 Jul 2010 20:25:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 23 Jul 2010 20:25:54 +0000 (UTC) To: ConTeXt list Original-X-From: ntg-context-bounces@ntg.nl Fri Jul 23 22:25:53 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 1OcOoa-0004sB-UH for gctc-ntg-context-518@m.gmane.org; Fri, 23 Jul 2010 22:25:53 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E7E97C9BF4; Fri, 23 Jul 2010 22:25:51 +0200 (CEST) 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 bZdXTOsEXqhf; Fri, 23 Jul 2010 22:25:49 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 09E1AC9AB7; Fri, 23 Jul 2010 22:25:49 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4B42BC9AB7 for ; Fri, 23 Jul 2010 22:25:47 +0200 (CEST) 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 s5CgDBFNMb2b for ; Fri, 23 Jul 2010 22:25:44 +0200 (CEST) Original-Received: from mail-wy0-f169.google.com (mail-wy0-f169.google.com [74.125.82.169]) by balder.ntg.nl (Postfix) with ESMTP id CD5EFC9A70 for ; Fri, 23 Jul 2010 22:25:44 +0200 (CEST) Original-Received: by wyg36 with SMTP id 36so673294wyg.14 for ; Fri, 23 Jul 2010 13:25:44 -0700 (PDT) Original-Received: by 10.227.140.154 with SMTP id i26mr3963035wbu.199.1279916744252; Fri, 23 Jul 2010 13:25:44 -0700 (PDT) Original-Received: by 10.216.166.195 with HTTP; Fri, 23 Jul 2010 13:25:44 -0700 (PDT) X-Google-Sender-Auth: 2HS7G6-0G37kRvNkDBjPdNySH_U 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:60369 Archived-At: Hi, Here is my test: =================================================== \setuppapersize[A4][A4] \usetypescript[postscript] \setupbodyfont[palatino,12pt] \starttext \startformula K = \frac{\sigma_1}{\sigma_2} = \frac{355}{14}= \ctxlua{tex.print(355/14)} \stopformula \stoptext =================================================== It works well and give me result = 25,357142857143. In order to obtain 2 decimal number I tried: \startformula K = \frac{\sigma_1}{\sigma_2} = \frac{355}{14}= \ctxlua{tex.printf("%0.2f",355/14)} \stopformula But it does not work. Here is the error: tex.printf("\doplaceformulanumber \stopdisplaymath \global \let \gdef \ETC. ! File ended while scanning text of \zerocount. } <*> ./test-lua.tex ? Another try: \startformula K = \frac{\sigma_1}{\sigma_2} = \frac{355}{14}= \ctxlua{tex.print(string.format("%0.2f",355/14))} \stopformula gives me the same error. So is there really a function printf() in LuaTeX engine ? Thanks ___________________________________________________________________________________ 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 ___________________________________________________________________________________