🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10978

question: making `environments' from macros

#10978
From: Nico Verwer
Date: Wed, 06 Jan 1993 11:04
31 lines
1374 bytes
I know this question has been asked before, but I couldn't find the
answer in my files. It probably also appears in TeX By Topic, which is
lent by our library, so I cannot look it up.

The problem is that I want to make an `environment-like' construction
from a macro.
Suppose I have defined
   \def\zap#1{something with #1}

I now want to define control sequences \bzap and \ezap such that
   \bzap blah\ezap
gives the same result as
   \zap{blah}
(I know I shouldn't, but I want it anyway).

The obvious solution
   \def\bzap#1\ezap{\zap{#1}}
is not right, because it cannot be nested.
This means that
   \bzap foo \bzap bar\ezap\ezap
will go wrong, because the first \bzap will get ``foo \bzap bar'' as its
argument.

I played around with \bgroup, \egroup and expandafter, but I could not
get it working. :-(
TeX refuses to parse the input up to the right \ezap.

Is there some kind TeXnician who is willing to help me?

Best regards,
Nico.
Technical Details
Message-ID: <1993Jan6.110418.13211@cs.ruu.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!bnr.co.uk!uknet!mcsun!sun4nl!ruuinf!nico

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!bnr.co.uk!uknet!mcsun!sun4nl!ruuinf!nico
From: nico@cs.ruu.nl (Nico Verwer)
Newsgroups: comp.text.tex
Subject: question: making `environments' from macros
Keywords: question for TeXperts
Message-ID: <1993Jan6.110418.13211@cs.ruu.nl>
Date: 6 Jan 93 11:04:18 GMT
Sender: network-news@cs.ruu.nl
Organization: Utrecht University, Dept. of Computer Science
Lines: 31