Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!chalmers.se!cs.chalmers.se!jeffrey From: jeffrey@cs.chalmers.se (Alan Jeffrey) Newsgroups: comp.text.tex Subject: Re: Testing for null arguments Keywords: latex Message-ID: <4409@undis.cs.chalmers.se> Date: 15 Mar 91 13:55:44 GMT References: <5396@vela.acs.oakland.edu> Sender: news@cs.chalmers.se Organization: Dept. of CS, Chalmers, Sweden Lines: 25 In article <5396@vela.acs.oakland.edu> rjohnson@vela.acs.oakland.edu (R o d Johnson) writes: [...] >I just can't figure out how to come up with an \ifnull or \ifnotnull. >Any suggestions? Thanks in advance. One simple solution is to test \def\unlikely{This is rather unlikely} \def\ifnull#1{\ifx\unlikely#1\unlikely} Then \ifnull{} A \else B \fi = \ifx\unlikely\unlikely A \else B \fi = A \ifnull{xyz} A \else B \fi = \ifx\unlikely xyz\unlikely A \else B \fi = B Actually, this is true if #1 is empty, or #1 begins with \unlikely. So as long as \unlikely is an unlikely control sequence to appear, you're OK. What a hack... Alan. Alan Jeffrey Tel: +46 31 72 10 98 jeffrey@cs.chalmers.se Department of Computer Sciences, Chalmers University, Gothenburg, Sweden