ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Vnpenguin <vnpenguin@vnoss.org>
To: ConTeXt list <ntg-context@ntg.nl>
Subject: LuaTeX & printf() function ?
Date: Fri, 23 Jul 2010 22:25:44 +0200	[thread overview]
Message-ID: <AANLkTimsSVvoY=Oc6v6UC0fDwqs1J=Fmqg_DQeEvtgXN@mail.gmail.com> (raw)

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.
<inserted text>
                }
<*> ./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
___________________________________________________________________________________


             reply	other threads:[~2010-07-23 20:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 20:25 Vnpenguin [this message]
2010-07-23 20:38 ` luigi scarso
2010-07-23 20:39   ` luigi scarso
2010-07-23 20:53     ` Vnpenguin
2010-07-23 21:23       ` Hans Hagen
2010-07-23 21:29         ` Vnpenguin
2010-07-23 21:36           ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimsSVvoY=Oc6v6UC0fDwqs1J=Fmqg_DQeEvtgXN@mail.gmail.com' \
    --to=vnpenguin@vnoss.org \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).