From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/71974 Path: news.gmane.org!not-for-mail From: Patrick Gundlach Newsgroups: gmane.comp.tex.context Subject: Re: xml and lua again Date: Fri, 28 Oct 2011 08:44:07 +0200 Message-ID: <83BD5F74-4BB7-41D2-9C1E-F5F31084E6AC@gundla.ch> References: <4EA2F34E.6080202@uni-bonn.de> <4EA53B44.1040105@wxs.nl> <4EA55792.9090408@uni-bonn.de> <4EA5598A.4060109@wxs.nl> <4EA599BE.2050304@uni-bonn.de> <4EA5B2F2.2050700@wxs.nl> <4EA684D9.2040702@uni-bonn.de> <4EA68CB4.30809@wxs.nl> <4EA68F04.4090706@uni-bonn.de> <4EA9231F.6080001@uni-bonn.de> <4EA93348.6030308@uni-bonn.de> <4EA93AE0.2000805@wxs.nl> <4EAA4A61.4090707@uni-bonn.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1319784265 20312 80.91.229.12 (28 Oct 2011 06:44:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 28 Oct 2011 06:44:25 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Oct 28 08:44:15 2011 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 1RJgAo-0002ST-HA for gctc-ntg-context-518@m.gmane.org; Fri, 28 Oct 2011 08:44:14 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 52936CB0A2; Fri, 28 Oct 2011 08:44:14 +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 UdFcIDb59Fo0; Fri, 28 Oct 2011 08:44:14 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9302CCB0A3; Fri, 28 Oct 2011 08:44:11 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B4CA3CB0A4 for ; Fri, 28 Oct 2011 08:44:09 +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 GCz80ww093MI for ; Fri, 28 Oct 2011 08:44:07 +0200 (CEST) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id 6DE3CCB0A3 for ; Fri, 28 Oct 2011 08:44:07 +0200 (CEST) Original-Received: from unimail.uni-dortmund.de (mx1.HRZ.Uni-Dortmund.DE [129.217.128.51]) by filter2-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p9S6i6ql023535 for ; Fri, 28 Oct 2011 08:44:06 +0200 Original-Received: from [192.168.1.100] (g225150106.adsl.alicedsl.de [92.225.150.106]) (authenticated bits=0) by unimail.uni-dortmund.de (8.14.5/8.14.5) with ESMTP id p9S6i5jb016238 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Fri, 28 Oct 2011 08:44:06 +0200 (CEST) In-Reply-To: <4EAA4A61.4090707@uni-bonn.de> X-Mailer: Apple Mail (2.1251.1) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=129.217.128.51; country=DE; region=07; city=Dortmund; latitude=51.5167; longitude=7.4500; http://maps.google.com/maps?q=51.5167,7.4500&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0bFO6I6jj - 6371caceaaca - 20111028 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 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:71974 Archived-At: >>>> >>>> context.blackrule{ width = number.topoints(tex.dimen["textwidth"]/2) } >> >> or just tex.dimen["textwidth"]/2 .. "sp" > > Wait, just so I understand: your solution would imply that tex.dimen["textwidth"] holds a number, not a dimension, right? (Because you simply concatenate it with a dimension unit). Which makes sense when I think of it because lua has no concept of dimensions, only of strings, functions, tables, numbers... Whereas the Wolfgang implies that the result is already in sp. So who's right? both :) tex.dimen holds a number, that is the size in points, multiplied by 65536/1pt, so for example 3pt becomes 3pt * 65536 ----------- = 3 * 65536 = 196608 1pt This number is also known "sp". So if you store the number 3*65536 in tex.dimen[...], you can say: my width is \directlua{ tex.dimen[...] / 2}sp (results to "my width is 196608sp", which you can use as an argument to whatever needs a length) or my width is \directlua{ number_to_points(tex.dimen[...]) } where number_to_points is something like number_to_points = function (amount_in_sp) in_pt = tostring(amount_in_sp / 65536) return in_pt .. "pt" end which gives "3pt". Patrick ___________________________________________________________________________________ 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 ___________________________________________________________________________________