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 p1D86KGr013484 for ; Sun, 13 Feb 2011 09:06:22 +0100 Received: (qmail 26058 invoked by alias); 13 Feb 2011 08:06:15 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 13 Feb 2011 08:06:15 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx031) with SMTP; 13 Feb 2011 09:06:15 +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 p1D7w9pt021399 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 13 Feb 2011 08:58:09 +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 p1CN1CS0023645; Sun, 13 Feb 2011 08:58:00 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1205857 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Sun, 13 Feb 2011 08:58:00 +0100 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p1D7w0wj008875 for ; Sun, 13 Feb 2011 08:58:00 +0100 Received: from mail-pv0-f177.google.com (mail-pv0-f177.google.com [74.125.83.177]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p1D7vrcg021291 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Sun, 13 Feb 2011 08:57:58 +0100 Received: by pvg7 with SMTP id 7so995648pvg.22 for ; Sat, 12 Feb 2011 23:57:53 -0800 (PST) Received: by 10.142.48.2 with SMTP id v2mr1960523wfv.448.1297583873288; Sat, 12 Feb 2011 23:57:53 -0800 (PST) Received: from [10.0.1.108] (219-90-151-154.ip.adam.com.au [219.90.151.154]) by mx.google.com with ESMTPS id f5sm2132984wfo.16.2011.02.12.23.57.49 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Feb 2011 23:57:52 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) References: X-Mailer: Apple Mail (2.1081) X-Spam-Whitelist: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id p1D7w0wj008876 Message-ID: Date: Sun, 13 Feb 2011 18:27:46 +1030 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Will Robertson Subject: Re: Expandable versions of \uppercase, \MakeUppercase, \lowercase, \MakeLowercase To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p4U4jfdfC5HDevlx1X2sAZg1MkugZcpwIdDb8z5l6KEaP+LdZ7QLw+5CKzyp k5HTLZ1v8wPRqFdQdQapWq9qz59Rr52fCiljKsokHJ7zxooO6Fv4ZAON42hzu9cg2rWm4b5Sy7dh Y3GpA==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: 6595 On 13/02/2011, at 12:31 PM, Bruno Le Floch wrote: > His method yields > "\Uppercase{Som{e } {te{x}t} with $math$.}" -> "SOMe te{x}t WITH $math$." > Mine yields: > "\Uppercase{Som{e } {te{x}t} with $math$.}" -> "SOM{E } {TE{X}T} WITH $MATH$." > > Two questions: > - what precise behaviour do we want an uppercase function to have? Note that > we could even provide hooks to let the user choose. (See near the > bottom of this long email.) > - what do you think of the advantages/drawbacks described below? My personal opinion on uppercasing/lowercasing is that it should be a property of the font; some OpenType fonts allow you to do this with, e.g. in fontspec: \addfontfeature{Letters=Uppercase} (although there might not be a "Letters=Lowercase", which is weird. I guess that one is less useful.) In effect, this replaces all lowercase *glyphs* by uppercase variations. But this is highly font-dependent until we are all using LuaTeX and can dynamically add OpenType font features like this. Anyway, regarding the examples above, I think the behaviour to emulate is David Carlisle's \MakeTextUppercase: \documentclass{article} \usepackage{textcase} \begin{document} \MakeUppercase{abc {def} {g{h}i} $x+y=z$}\par \MakeTextUppercase{abc {def} {g{h}i} $x+y=z$} \end{document} So this is kinda half-way between your and Joseph's example. However, if you're just talking about *strings* and not text, then I think the "all letters uppercase" is the way to go. So if we're speaking in expl3 terms, I'd expect \tl_to_uppercase:n{abc $x+y=z$} to output "ABC $X+Y=Z$" whereas I'd expect \TextUppercase of the same to produce "ABC $x+y=z$". * * * In terms of the algorithms to perform these operations, I prefer the way Joseph's code executes (e.g., keeping the number of csnames low) but I prefer the extensibility of Bruno's (although I suspect Bruno's is faster -- but a better question to ask is whether Joseph's is too slow). For the extensibility thing, I'm wondering for Joseph's code if the "\prg_case_str:nnn {#1} { { a } { A } ..." code could be written as something like "\prg_case_str:nVn {#1} \g_uc_replacements_tl { }". Cheers, -- Will