Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id s48IVDqt031861 for ; Thu, 8 May 2014 20:31:14 +0200 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx006) with ESMTPS (Nemesis) id 0MeLct-1WTHSm1bqx-00QDxw for ; Thu, 08 May 2014 20:31:07 +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 s48ISZox014626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 May 2014 20:28:35 +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 s48D2Ica007492; Thu, 8 May 2014 20:28:34 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 10929428 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 8 May 2014 20:28:34 +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 s48ISYpQ007970 for ; Thu, 8 May 2014 20:28:34 +0200 Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com [74.125.83.47]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id s48ISPCk014565 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Thu, 8 May 2014 20:28:28 +0200 Received: by mail-ee0-f47.google.com with SMTP id c13so1977288eek.6 for ; Thu, 08 May 2014 11:28:25 -0700 (PDT) X-Received: by 10.14.225.132 with SMTP id z4mr7648515eep.92.1399573705209; Thu, 08 May 2014 11:28:25 -0700 (PDT) Received: from mellon.site (p54805309.dip0.t-ipconnect.de. [84.128.83.9]) by mx.google.com with ESMTPSA id o5sm5916296eeg.8.2014.05.08.11.28.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 May 2014 11:28:24 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 References: <5366C875.9040709@googlemail.com> <5367453E.3030906@morningstar2.co.uk> <5369962B.2020905@gmail.com> <5369D54F.10503@googlemail.com> <5369E218.4090809@morningstar2.co.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Message-ID: <536BCCC6.7050902@googlemail.com> Date: Thu, 8 May 2014 20:28:22 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Heiko Oberdiek Subject: Re: \__dim_strip_bp:n To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <5369E218.4090809@morningstar2.co.uk> 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:/eumJFFmp7o=:csaOI28O7gGBX+KGf8zh3YF9SF FqRvMjxdx/6s6KDU3AmCE5fTc/Bi+jX9+J6Q7KgBuqBB+8YagM2BuE8UiUKIH6ejymD8ty6aG 8USmJr2XElCj52NRlhG5Nre2+PcrFraTaMsRcZfIHEEI+DdxQJh/LWWSdafioxTeqhDQH/7Mk LNSAeu/GtXesb/jA4Ow9fHK3wGsYSHyNpwzdK76N+JMCgKOlzzVQmObnfEIqPwuommLQYLRxb Y+mo3HnN54mHh8YGqpAevFYrqq4FrBkw5eMzD7H3E38xu/SGTCky4TcM7Q0D9u6tX5doJVMlg zknttOGr3R2eK21OGqS2f0kprHCrO71COxM2ysHReBa48kiGqWH8cpEI8SDJOZbjSM5zIpM5J tRmR1t/8OKiri8XVFmxzGxlBp8h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X-UI-Loop:V01:LnGmBaMjjFw=:Cob99fO4MwnkAF8IxtUfkoc5ki3NTaa4iRnkpoZKiBQ= Status: R X-Status: X-Keywords: X-UID: 7407 On 07.05.2014 09:34, Joseph Wright wrote: > On 07/05/2014 07:40, Heiko Oberdiek wrote: >> On 07.05.2014 04:10, Qing Lee wrote: >>> On 2014-05-05 at 16:01:02 +0800 GMT, Joseph Wright wrote: >>>> On 05/05/2014 00:08, Heiko Oberdiek wrote: >> >>>>> \cs_new:Npn \__dim_strip_bp:n #1 >>>>> { \__dim_strip_pt:n { 0.996 26 \__dim_eval:w #1 \__dim_eval_end: >>>>> } } >> >>>>> \dimexpr 0.99626\dimexpr #1\relax\relax >> >>>>> Improved version with higher precision: >>>>> >>>>> \cs_new:Npn \__dim_strip_bp:n #1 >>>>> { >>>>> \__dim_strip_pt:n >>>>> { >>>>> \__dim_eval:w ( #1 ) * 800 / 803 \__dim_eval_end: >>>>> } >>>>> } >> >>> The new definition will be broken if its argument contains additional >>> units. E.g., >>> >>> \__dim_strip_bp:n { 1 bp pt } Thanks Quing Lee for noticing that there is a "feature" that I have overlooked: > 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. > As I say, before I make any further change here it would be useful to > have a proper idea of what is actually required. Either way, \dimexpr 0.99626\dimexpr belongs to the past and can/should be replaced by a "scaling" operation of \dimexpr. Best regards. Heiko Oberdiek