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 s4RG1bli011328 for ; Tue, 27 May 2014 18:01:39 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx010) with ESMTPS (Nemesis) id 0MKcbv-1Wp2R21Iz1-001vdU for ; Tue, 27 May 2014 18:01:32 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s4RFwhf5017370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 May 2014 17:58:43 +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 s4REW0Ps015714; Tue, 27 May 2014 17:58:42 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 11211649 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 27 May 2014 17:58:42 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s4RFwg6L028086 for ; Tue, 27 May 2014 17:58:42 +0200 Received: from mail-qg0-f47.google.com (mail-qg0-f47.google.com [209.85.192.47]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s4RFwU5L017254 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Tue, 27 May 2014 17:58:33 +0200 Received: by mail-qg0-f47.google.com with SMTP id j107so14091265qga.20 for ; Tue, 27 May 2014 08:58:30 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.140.36.105 with SMTP id o96mr41224096qgo.25.1401206310426; Tue, 27 May 2014 08:58:30 -0700 (PDT) Received: by 10.96.19.42 with HTTP; Tue, 27 May 2014 08:58:30 -0700 (PDT) References: <5366C875.9040709@googlemail.com> <5367453E.3030906@morningstar2.co.uk> <5369962B.2020905@gmail.com> <5369D54F.10503@googlemail.com> <5369E218.4090809@morningstar2.co.uk> <536BCCC6.7050902@googlemail.com> Content-Type: text/plain; charset=UTF-8 Message-ID: Date: Tue, 27 May 2014 11:58:30 -0400 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: \__dim_strip_bp:n To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <536BCCC6.7050902@googlemail.com> 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:f/vYDWkn7I4=:XDT9fGTtkmQ29w8hZ5238WUIEu X7G5V2tQBCnjnm+bX7LUi8qk1srH9vnvYx1geXZSP1h0OPk5d9A7ePlcOXGH9Eo7c8mJo1VRW 8LgvGKYz8RehiRuByI6BG+Fn/tcaGRFsoCIeuxGy36V9ekqKBSr08Mc7PJIBQZSI5sZkyLwHr JVuUbeZUGHnldYg316f+huM9DTYYg+6ueHmuP/n0Y78WUrmdEqrc6afqRhx2ggzKlhnWGDNxz 9UJtPfhH0OusxofJE3pAPD5BNg56LfP+VkqAc8lsQ5afmhDsK+UE1Sl2mux3ypSZ8XqWLZr9G SfP47+UX9UD6kdeT5PEmmDe/wvxpyqIzb2/iyAoWtRN3CULmwYD1Z1GZmQ46l3Q6B8VEqBuGT z9pv163vH0MhHc0zMaQrv57zcQwyA9CcjTDPCkN5+EbBEcJbox7Xq/eGrG8xWlp+/vAsycAtg LWNb2JzZaM7uyS5kukoCBPQfizTJsknOftIIC5aLxkImEcOVjxaBzlhXcvGnZqmvyzjXItw4Z yE7olSXOBwJ805L1xNdHu4pzrnN/ErmubvobZLm+wBgg8UkVQ58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QqsY= Status: R X-Status: X-Keywords: X-UID: 7454 Thanks Heiko for the more accurate 800/803. My mistake I believe. On 5/8/14, Heiko Oberdiek wrote: > On 07.05.2014 09:34, Joseph Wright wrote: >> >> Before making any further changes (and adding tests for the defined >> behaviour), I think it's worth briefly considering why \__dim_strip_pt:n >> and \__dim_strip_bp:n are (currently) documented as accepting multiple >> units in the argument. (I was drafting this message before Heiko's >> reply!) >> >> While it's not in the sources, from memory the idea was that allowing >> input such as >> >> \__dim_strip_bp:n { 1 bp pt } >> >> means that at a 'higher level' something like >> >> \cs_new:npn \foo #1 >> { \_dim_strip_bp:n { #1 pt } } >> >> will work with >> >> \foo { 1 bp } >> >> and >> >> \foo { 1 } % Assumes pt >> >> will work. The idea was, I think, allowing an approach something like >> \@defaultunits in the LaTeX2e kernel or \Gin@defaultbp in graphics but >> in an expandable form. >> >> Now, that may not be a good plan: the functions here are supposed to be >> relatively low-level (they are for writing driver code), and it is >> likely to be better to require 'properly defined' units on the input. > > IMHO, the feature "default unit" belongs to the "toolbox level" for > defining user interfaces. I tend to agree with you that we should not let \__dim_strip_pt:n and \__dim_strip_bp:n accept arbitrary junk. That's easy to change, as they are only used internally. On the other hand, the public \dim_to_pt:n and \dim_to_unit:n are documented as allowing multiple units, for the use-case Joseph describes. Perhaps a way out would be to make \dim_to_pt:n and \dim_to_unit:nn check their units, and provide some \dim_cleanup:n function which hits its argument with a dimexpr then removes everything after the pt. \cs_new:Npn \dim_cleanup:n #1 { \exp_after:wN \@@_cleanup:w \dim_use:N \__dim_eval:w #1 \__dim_eval_end: \q_stop } \group_begin: \char_set_catcode_other:N \P \char_set_catcode_other:N \T \tl_to_lowercase:n { \cs_new:Npn \@@_cleanup:w #1 PT #2 \q_stop { #1 PT } } \group_end: Regards, Bruno