LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Proportional 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: Wed, 20 Aug 2014 19:05:25 +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 (48 lines)
Am 20.08.2014 um 00:11 schrieb Michal Hoftich:

> 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.

I have considered something like that, but the approach has some drawbacks:

1. What is the correct way to get language numbers from language
identifiers?  As far as I see, you're reading the file in Lua, assuming
LaTeX reads records from language.dat simply increasing indices
(language numbers).  I wouldn't rely on that assumption.  That is, I'd
rather read language.dat in LaTeX doing the conversion there, then pass
the result to Lua for every language encountered.  Certainly an
interesting exercise to get more into LaTeX3 (at least for me).

2. Does language.dat really contain Babel language identifiers or rather
pattern identifiers that are bound to a language identifier somewhere
else (.ldf files perhaps?)?


Reading language.dat (or language.dat.lua) in LaTeX, one could at least
convert a certain set of pattern/language identifiers into their
corresponding language number in a reliable way.  Then users would have
to declare languages manually on the LaTeX side only where this approach
failed to find the correct language identifier.


> If someone knows about less hackish solution, I would be happy to use
> it instead.

Yes, reading and parsing an already loaded file language.* isn't
desirable.  Is there a way to iterate over all command sequences
starting with a known string ('l@') in LaTeX?

Best regards,
Stephan Hennig

ATOM RSS1 RSS2