🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #2771

\if !#1! to test if #1 is empty

#2771
From: Ed Overman
Date: Tue, 05 Jun 1990 14:26
14 lines
1576 bytes
I suppose I am somewhat of a worrier but especially in (1) there is a real
possibility of problems since you can only use one character after the \if
statement.  (In (2) you can always do
    \def\addperiod#1{\ADDPERIOD#1!^!.!^!.!^!\END}
and the characters !^! are VERY unlikely to ever appear together.
I am thinking of using control characters (for example, ^A) instead.
Do you think this is a good or bad idea or I am really just a worrier?
(Control characters are visible in editors like emacs so there is no
real worry that a ^A might be in the text by accident but be invisible.
I have had this "invisible" bug before and it is HORRIBLE to debug.  It
happens that there can be a -0. as well as a +0. on a Sun and in FORTRAN
atan2(-0.,-1.) = -\pi  while  atan2(+0.,-1.) = +\pi !  However when printed
out -0. looks the same as +0.!)
                                        Thanks, Ed Overman
Technical Details
Message-ID: <1990Jun5.142623.8692@zaphod.mps.ohio-state.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!usenet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!usenet
From: eao@shape.mps.ohio-state.edu (Ed Overman)
Newsgroups: comp.text.tex
Subject: \if !#1!  to test if #1 is empty
Keywords: \if !#1!
    This checks if #1 is empty or not but will fail if #1 begins with the
    character ! (the Texas Physics Macro Package uses ? instead).  However I
    can think of circumstances when #1 might just contain the character !
    such as: #1 is th
Message-ID: <1990Jun5.142623.8692@zaphod.mps.ohio-state.edu>
Date: 5 Jun 90 14:26:23 GMT
Sender: usenet@zaphod.mps.ohio-state.edu
Organization: Dept of Mathematics, The Ohio State University
Lines: 14