Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id s7JMOSeR008683 for ; Wed, 20 Aug 2014 00:24:29 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx108) with ESMTPS (Nemesis) id 0LwWjz-1WIB3p3b27-018JOf for ; Wed, 20 Aug 2014 00:24:23 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id s7JMLmEQ012567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 20 Aug 2014 00:21:48 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s7JM14J9027399; Wed, 20 Aug 2014 00:21:48 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 11313286 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 20 Aug 2014 00:21:48 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s7JMBlwe028714 for ; Wed, 20 Aug 2014 00:11:47 +0200 Received: from mail-qg0-f50.google.com (mail-qg0-f50.google.com [209.85.192.50]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id s7JMBcqS008728 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Wed, 20 Aug 2014 00:11:41 +0200 Received: by mail-qg0-f50.google.com with SMTP id z107so3065643qgd.23 for ; Tue, 19 Aug 2014 15:11:38 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.224.15.72 with SMTP id j8mr73665332qaa.8.1408486297954; Tue, 19 Aug 2014 15:11:37 -0700 (PDT) Received: by 10.140.160.130 with HTTP; Tue, 19 Aug 2014 15:11:37 -0700 (PDT) References: <53F382C3.30901@arcor.de> <53F3877C.2070304@googlemail.com> <53F3931A.4080203@arcor.de> <53F3C0AB.2060407@arcor.de> Content-Type: text/plain; charset=UTF-8 Message-ID: Date: Wed, 20 Aug 2014 00:11:37 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Michal Hoftich Subject: Re: \directlua in LaTeX3 To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <53F3C0AB.2060407@arcor.de> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:pHqCW5Kq/zs=:OQh3WtimFd4aYi/IMvcTzEv+HD /v0KMpyhB/rOB99Y7gJeuK6ZCRl+o4aAQqh5blTGB9N6+xNegNrs1S6PLfysDpdFw7JcUdlXo jrrye94CbmzVDb2+hZ2EcsgqrNEQ33vVp31BKPcI8AI69rHcoMR7dHATSQqxxtlLVTDOSmK0X uRgTH5Ng44L7pUX9A/xftv4+/Rb4hL0WfItcJoW7NCIY7BpyFopGuK/JywiTUaeB1iiCbuCbh TVAJrDNNh3zwfphRUTu++CPceLop6EPiI/V2rVZd2BHdj1TTek+q4u0izcHV05CX5vawOBf1N 8BiXOQ4KiBAQRT3urZ+b+Gq0QCbKYiNGwGIm7TcZ8UaOQcygf/dRU0roST5Qc6+qKm1VAzrzH 5Q8OH+/hu6lTewPElv4ba+nl+2Ni7yg2DbK9MmeKETZnjMbwobnwtIV1vHFR6WYUOc5UTBbyK ps2KmckZOS3b67Q6/6vus7w6vH/qlfWGrROck/zxwlNO/cIgdVMTVT7+2BNG6z6fiPQPl878c TJcT3NxPJd4mHWxUGRHP1Y6A/SjTMDqm5ZS8q5uNBpZUsVREBe7C4lmIEEMY39SYC/LvMdzQ3 PjGcML0zC0e1mRJSQyjvsvKpyrxj/hmwnqZDZpWqDLfoK3BG3a+gxAhI6PawSnYDUG6x3NubD +5qMRIrWGgnRvpDtZqQ518JQ/j7bujHmbJVsyHQlArmmRQinz3eUjUpTaHEVHbzXLA/M9cySG pcBOQy/QEcY34Uvi5WUrlUq/fhS9eOMg6HGXrztXwe71Fv6JaFdYWKS3xjEMzSRuOA65qZ9Vb 6fuLlhUCRbVvzfbHbY93oYhlAJDk/Rjp0bGpR8qgHDMLRWFE0geQJkqIv8ewLuASeiV3AyLEQ mkk6RxI53F1DPMw8mrCj0btYHfY1d8Si21CpZcx6kopW9bxI5xDiKegLEPAXeFIcda1lQJr3q jqvWRzvshjsV7fVAI1Rh9XVKpEtJqtau2nm2iYMOZIpaWj7YdcRQLG6kvWVHCFVWs4LioL4he W0vA1vsN/2sMM6FeOYVbrdS6fr2FRcLlKzz/++rSPUfe5i5PHMgKEXjQAoViGG6gPYfLjTk0y yHvTu38ZL5YHWqnzFoJ+qwxUGNkP59aRDflmS1X+ImSXUrcuqyUTlsWuG22Csldn+n/1BcTtq rKFChpKqp7zQs5cnhLmLgQxyshO0+dgpHeHaD18zs6ShJsiBA5l4uh1n6AphiwHD2FLYM+i33 NcFMmjoymznjgruPpp9ujSs1GK0umhl1ywyfwcSsikWhzDVTQIB9y+jQhxEN4GrJgVNItvOCU 3tx04wxGPHY+jwKAWSrq0NqSdovuufZzP57C08oqyeZgwyOnNlgSD7htGJyGGL8vKSVwRR5GQ VoDL9lNgDB8437mMzKyiCrSknAfJutEx/dlaHZA2O/cNF6k8Cy73a9bopov4SLOzQkXEm/BtP qxTnafyhphCZhieeuLAQBxCFjsLeu9Of3CWIGEd3Vqd2kHoWZzrY75ASxAemDLucFOW4Orrw= = X-UI-Loop:V01:UmJrMdCqC+w=:0kqeB+W1sfOkhZPm8Qd5eriPqXUmicHNvRdivYzYAG0= X-UI-Out-Filterresults: notjunk:1; Status: R X-Status: X-Keywords: X-UID: 7565 I was solving the same problem and only solution I've found was to parse `language.dat` file, see (some example is at the bottom of the file): https://github.com/michal-h21/luavlna/blob/master/langno.lua note that this method doesn't work universally, some formats exists which doesn't use `language.dat` (csplain is the one I know about), but if you want to support only LaTeX, this method should be fine. also note that there is file `language.dat.lua`, which contains lua table with language names and properties, but unfortunately, language numbers aren't recorded here and language names are used as table keys, so this table isn't useful for querying language numbers. If someone knows about less hackish solution, I would be happy to use it instead. Best regards, Michal Best > While we're at it, this code does the language identifier to number > conversion in LaTeX and passes the result to Lua. Anybody know of a way > to do the conversion in Lua? Given a Lua string, say, 'UKenglish', how > do you get the corresponding language number that is referred to in, > e.g., glyph nodes? A solution to that problem would save users of my > code from having to specify language identifiers on the LaTeX side in > addition to the Lua side. > > Looking at the Babel package, I infer that \l@ is actually a > \chardef definition (whatever that is ...). The LuaTeX manual contains > in sec. 4.14.4 "Attribute, count, dimension, skip and token registers" a > statement > > TeX's attributes (\attribute), counters (\count), dimensions > (\dimen), skips (\skip) and token (\toks) registers can be > accessed and written to using two times five virtual > sub-tables of the tex table: > > tex.attribute tex.dimen tex.toks > tex.count tex.skip > > It is possible to use the names of relevant \attributedef, > \countdef, \dimendef, \skipdef, or \toksdef control sequences > as indices to these tables: > > tex.count.scratchcounter = 0 > enormous = tex.dimen['maxdimen'] > > In this case, LuaTeX looks up the value for you on the fly. > You have to use a valid \countdef (or \attributedef, or > \dimendef, or \skipdef, or \toksdef), anything else will > generate an error (the intent is to eventually also allow > and even macros that expand into a number). > > Does that mean I have to wait until LuaTeX provides access to \chardefs > on the Lua side? Or is there any other way to get the language number > in Lua? > > Best regards, > Stephan Hennig