home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / text / tex / 14664 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  1.3 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!uknet!mcsun!sun4nl!ruuinf!nico
  2. From: nico@cs.ruu.nl (Nico Verwer)
  3. Newsgroups: comp.text.tex
  4. Subject: question: making `environments' from macros
  5. Keywords: question for TeXperts
  6. Message-ID: <1993Jan6.110418.13211@cs.ruu.nl>
  7. Date: 6 Jan 93 11:04:18 GMT
  8. Sender: network-news@cs.ruu.nl
  9. Organization: Utrecht University, Dept. of Computer Science
  10. Lines: 31
  11.  
  12. I know this question has been asked before, but I couldn't find the
  13. answer in my files. It probably also appears in TeX By Topic, which is
  14. lent by our library, so I cannot look it up.
  15.  
  16. The problem is that I want to make an `environment-like' construction
  17. from a macro.
  18. Suppose I have defined
  19.    \def\zap#1{something with #1}
  20.  
  21. I now want to define control sequences \bzap and \ezap such that
  22.    \bzap blah\ezap
  23. gives the same result as
  24.    \zap{blah}
  25. (I know I shouldn't, but I want it anyway).
  26.  
  27. The obvious solution
  28.    \def\bzap#1\ezap{\zap{#1}}
  29. is not right, because it cannot be nested.
  30. This means that
  31.    \bzap foo \bzap bar\ezap\ezap
  32. will go wrong, because the first \bzap will get ``foo \bzap bar'' as its
  33. argument.
  34.  
  35. I played around with \bgroup, \egroup and expandafter, but I could not
  36. get it working. :-(
  37. TeX refuses to parse the input up to the right \ezap.
  38.  
  39. Is there some kind TeXnician who is willing to help me?
  40.  
  41. Best regards,
  42. Nico.
  43.