🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #2635

Re: detecting missing arguments in latex

#2635
From: Donald Arseneau
Date: Sat, 12 Sep 1992 09:21
38 lines
1793 bytes
In article <1992Sep12.044540.21398@cs.cornell.edu>, gambhir@cs.cornell.edu (Navindra S Gambhir) writes...
>Won't the following work?  (Yes, I need an answer.)
> 
>  \def\\{#1}
>  \ifx\empty\\
>    % null
>  \else
>    % not null
>  \fi
> 
>where \empty is already \defn'd to be {}.

Yes, this works, and it is much nicer than the other two solutions 
presented (and because of simplicity it may be considered nicer than my
solution).  But it doesn't work in all circumstances.  It is not totally
expandable, so it is "fragile" in LaTeX lingo; try

\write-1{\isthisnull{}}

where \isthisnull is defined as above.
It will not work if #1 contains any \outer tokens:

\isthisnull{\theorem....}

Also, a definition like 

\long\def\isthisnull#1{\def\nullargument{#1}\ifx\nullargument\empty}

would mean that \isthisnull cannot be skipped over in conditional 
text (it gives an extra \fi).  This can be overcome with the definition

\long\def\isthisnull#1#2#3{\def\nullargument{#1}\ifx\nullargument\empty
  #2\else#3\fi}

but that means both #2 and #3 must be read in and stored, so they can't
be overly long.

Donald Arseneau             asnd@reg.triumf.ca
Technical Details
Message-ID: <12SEP199202212383@reg.triumf.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!unixg.ubc.ca!reg.triumf.ca!asnd
References: <6725@vtserf.cc.vt.edu> <11SEP199219213030@msr.triumf.ca> <1992Sep12.044540.21398@cs.cornell.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!unixg.ubc.ca!reg.triumf.ca!asnd
From: asnd@reg.triumf.ca (Donald Arseneau)
Subject: Re: detecting missing arguments in latex
Message-ID: <12SEP199202212383@reg.triumf.ca>
News-Software: VAX/VMS VNEWS 1.41    
Sender: news@unixg.ubc.ca (Usenet News Maintenance)
Nntp-Posting-Host: reg.triumf.ca
Organization: TRIUMF: Tri-University Meson Facility
References: <6725@vtserf.cc.vt.edu> <11SEP199219213030@msr.triumf.ca> <1992Sep12.044540.21398@cs.cornell.edu>
Date: Sat, 12 Sep 1992 09:21:00 GMT
Lines: 38