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 p04933dY001703 for ; Tue, 4 Jan 2011 10:03:04 +0100 Received: (qmail 24731 invoked by alias); 4 Jan 2011 09:02:58 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 04 Jan 2011 09:02:58 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx078) with SMTP; 04 Jan 2011 10:02:58 +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 p048pENT030276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Jan 2011 10:00:56 +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 p048mEib001020; Tue, 4 Jan 2011 09:49:05 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 774773 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 4 Jan 2011 09:47:11 +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 p048l5kP012746 for ; Tue, 4 Jan 2011 09:47:05 +0100 Received: from mail-bw0-f49.google.com (mail-bw0-f49.google.com [209.85.214.49]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p048khu3020943 for ; Tue, 4 Jan 2011 09:46:47 +0100 Received: by bwz5 with SMTP id 5so14775402bwz.22 for ; Tue, 04 Jan 2011 00:46:43 -0800 (PST) Received: by 10.204.23.6 with SMTP id p6mr4531888bkb.123.1294130803350; Tue, 04 Jan 2011 00:46:43 -0800 (PST) Received: from irwin.vpn.uni-freiburg.de (p5484721A.dip.t-dialin.net [84.132.114.26]) by mx.google.com with ESMTPS id v1sm12030185bkt.17.2011.01.04.00.46.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 04 Jan 2011 00:46:42 -0800 (PST) Received: by irwin.vpn.uni-freiburg.de (Postfix, from userid 500) id E41CC800A; Tue, 4 Jan 2011 09:43:44 +0100 (CET) Mail-Followup-To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE References: <4D22486F.5000506@morningstar2.co.uk> <7C89B4BA-13CE-4976-ADB9-1C08CE25475E@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Message-ID: <20110104084343.GA7767@oberdiek.my-fqdn.de> Date: Tue, 4 Jan 2011 09:43:43 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Heiko Oberdiek Subject: Re: \box_if_empty:N(TF) To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <7C89B4BA-13CE-4976-ADB9-1C08CE25475E@gmail.com> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p4U4jfdfC5HDevlx1X2sAZgP9e9F2VTUYI/FLDAh5vXTVin+wznIYULO4W8f iu4UIHVeutAdNYNyhIIRpjhB4NMqCt7OvFNAZ3Em9oZmuR2zOKGeZpAGdnSMvI6CR2LHXlIcSoSO ckeoA==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: 6518 On Tue, Jan 04, 2011 at 05:11:34PM +1030, Will Robertson wrote: > On 04/01/2011, at 8:36 AM, Joseph Wright wrote: > > > Working on the galley (see the latest SVN checkin), I find that \box_if_empty:NTF is misleading. The test is for a void box, not an empty one: > > > > \box_new:N \l_my_box > > \hbox_set:Nn \l_my_box {} > > \box_if_empty:NTF \l_my_box { NOPE } { OOPS } > > > > I think it should be \box_if_void:NTF - any objections? > > Not at all. > Is there a need to have an actual empty test? > Oh wait, this isn't possible, right? A non-expandable test is possible: \NeedsTeXFormat{LaTeX2e} \makeatletter \newbox\test@box \def\ifboxempty#1{% \global\let\g@next\@secondoftwo \ifhbox#1% \setbox\test@box=\hbox{% \unhcopy#1\relax \ifnum\lastnodetype<\z@ \global\let\g@next\@firstoftwo \fi }% \else \ifvbox#1% \setbox\test@box=\vbox{% \unvcopy#1\relax \ifnum\lastnodetype<\z@ \global\let\g@next\@firstoftwo \fi }% \fi \fi \g@next } \makeatother \def\wrong#1{\typeout{WRONG: #1}} \def\ok#1{\typeout{OK: #1}} \begingroup \setbox0=\box0 \endgroup \ifboxempty0{\wrong{void is empty}}{\ok{void is not empty}} \setbox0=\null \ifboxempty0{\ok{null is empty}}{\wrong{null is not empty}} \setbox0=\vbox{} \ifboxempty0{\ok{vbox{} is empty}}{\wrong{vbox{} is not empty}} \setbox0=\hbox{\write16{}} \ifboxempty0{\wrong{hbox with write is empty}}% {\ok{hbox with write is not empty}} \csname @@end\endcsname\end Yours sincerely Heiko