LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Date: Tue, 19 Aug 2014 23:24:59 +0200
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
Message-ID: <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
In-Reply-To: <[log in to unmask]>
Content-Type: text/plain; charset=us-ascii
From: Stephan Hennig <[log in to unmask]>
Parts/Attachments: text/plain (53 lines)
Am 19.08.2014 um 21:58 schrieb Bruno Le Floch:
> On 8/19/14, Stephan Hennig <[log in to unmask]> wrote:
>> It's actually a language string that I'm evaluating to a number via
>>   \int_use:N\cs:w l@#1\cs_end:     in LaTeX3
> Avoid using \cs:w ... \cs_end: constructions.  It is much better to
> use a c-type argument, so for your case, \int_use:c { l@#1 }.

Didn't notice that.  Great, thank you!

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@<lang> 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

    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
    <chardef tokens> 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