Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id oAAHlnUV007531 for ; Wed, 10 Nov 2010 18:47:50 +0100 Received: (qmail 17627 invoked by alias); 10 Nov 2010 17:47:43 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 10 Nov 2010 17:47:43 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx043) with SMTP; 10 Nov 2010 18:47:43 +0100 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 oAAHjGMF013295 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 10 Nov 2010 18:45:16 +0100 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id oAAEsdPH004690; Wed, 10 Nov 2010 18:45:52 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 699305 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 10 Nov 2010 18:45:52 +0100 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id oAAHjqJn028721 for ; Wed, 10 Nov 2010 18:45:52 +0100 Received: from ueamailgate02.uea.ac.uk (ueamailgate02.uea.ac.uk [139.222.131.185]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id oAAHivOP029391 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 10 Nov 2010 18:45:01 +0100 Received: from ueams02.uea.ac.uk (ueams02.uea.ac.uk [139.222.131.131]) by ueamailgate02.uea.ac.uk (8.13.8/8.13.8) with ESMTP id oAAHjcTf011348 for ; Wed, 10 Nov 2010 17:45:38 GMT Received: from [139.222.114.143] by ueams02.uea.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1PGEjl-00019u-3J; Wed, 10 Nov 2010 17:45:33 +0000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 References: <5912573863497554.WA.remyoudomphenggmail.com@listserv.uni-heidelberg.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, outgoing) X-CanIt-Geo: ip=139.222.131.131; country=GB; region=I9; city=Norwich; latitude=52.6333; longitude=1.3000; http://maps.google.com/maps?q=52.6333,1.3000&z=6 X-CanItPRO-Stream: UEA:outgoing (inherits from UEA:default,base:default) X-Canit-Stats-ID: 62732648 - 6d76cd65875e - 20101110 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 139.222.131.185 Message-ID: <4CDADA41.7090507@morningstar2.co.uk> Date: Wed, 10 Nov 2010 17:45:37 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: Rewriting polyglossia in LaTeX3 To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <5912573863497554.WA.remyoudomphenggmail.com@listserv.uni-heidelberg.de> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p4U4jfdfC5HDevlx1X2sAZgAaLl3DbFfW0PXxL7WgvovMFXXSEPrACW/b9IW Qp+GhEViZlUW4mdBntgP1X8KwB5tjHCA/yxSZMYzm4ZTjPJ5/Fr7D0QgNt/3lmuFSuOJGxtBQaM0 OMz0Q==V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6470 On 10/11/2010 17:25, Rémy Oudompheng wrote: > Hello everybody, > > I am interested in Unicode-capable TeX engines, and as such felt > that after fontspec and unicode-math, polyglossia would deserve > a rewrite for expl3. polyglossia currently uses etoolbox to > provide features much similar to what is offered by the LaTeX3 > packages, notably a lot of keyval-like features. I found benefits > in the nice syntax offered by l3keys, and the \prg_case_str > function for example. > > You may find a Git repository at > http://github.com/remyoudompheng/polyglossia > > I am looking for help in testing this, hoping that you will like it, > and I have also a question: for some reason, in polyglossia > we need to (un)capitalize words for use in csnames. > > I think I can produce somthing like this in LaTeX 3: > > \def\art{abc} > \def\func#1{\tl_to_uppercase:n{\tl_head:n{#1}}{\tl_tail:n #1}} > \def\frou#1{\exp_args:Nf\func#1} > \frou\art > > produces Abc as expected. > > The TeX code is polyglossia is like this: > > \def\xpg@uppercasefirst#1{\expandafter\xpg@@uppercasefirst #1} > \def\xpg@@uppercasefirst#1{% > \if a#1A\else > \if b#1B\else > \if c#1C\else > \if d#1D\else > ... \fi\fi\fi\fi > > I have been trying to replace it by something like > > \cs_new:Npn \polyg_uppercase_first:x{\tl_to_uppercase:n{\tl_head:n{#1}{\tl_tail:n > #1}} > > or some combination using \exp_args but the result was never > equivalent, since in polyglossia the input may be a complicated > macro and the output will be surrounded by \csname..\endcsname > > How should I do that ? > > Regards, > Rémy Oudompheng. > Hello Rémy, The issue of \tl_uppercase:n / \tl_lowercase:n is one that is on the list of things for the team to revisit and sort out properly. I guess now might be a good time to do that! For the moment, my approach to get this expandable would be to use \prg_case_str:nnn, which works nicely: \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \cs_new_nopar:Npn \tl_upper_first:n #1 { \prg_case_str:nnn { \tl_head:n {#1} } { { a } { A } { b } { B } { c } { C } { d } { D } { e } { E } { f } { F } { g } { G } { h } { H } { i } { I } { j } { J } { k } { K } { l } { L } { m } { M } { n } { N } { o } { O } { p } { P } { q } { Q } { r } { R } { s } { S } { t } { T } { u } { U } { v } { V } { w } { W } { x } { X } { y } { Y } { z } { Z } } { \tl_head:n {#1} } \tl_tail:n {#1} } \edef\test{\tl_upper_first:n{abc}}\show\test \ExplSyntaxOff \begin{document} \end{document} This is more-or-less the same as the current implementation you have in the sense that all cases are considered. However, to my mind it's rather easier to read. The lower-case version would be done similarly but with a reversal of the input and output cases. -- Joseph Wright