Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!kth.se!cyklop.nada.kth.se!news From: grodan@cyklop.nada.kth.se (Mats G L|fdahl) Newsgroups: comp.text.tex Subject: Re: Help on LaTeX hacking. Message-ID: Date: 30 Jan 91 10:05:40 GMT References: <20376@hydra.gatech.EDU> <1991Jan29.112220.9742@news.arc.nasa.gov> <1991Jan29.181407.20206@eng.umd.edu> Sender: news@nada.kth.se (Mr News) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 53 In-reply-to: rig@eng.umd.edu's message of 29 Jan 91 18:14:07 GMT In article <1991Jan29.181407.20206@eng.umd.edu> rig@eng.umd.edu (Ronald Greenberg) writes: [deleted stuff] Sure, I have several macros that I use this way. But it is always annoying that I sometimes forget to put in the extra \ in the all places where I need a space. Has somebody got a macro that will put in a space unless the next character is a punctuation mark? -- Ron Greenberg rig@umiacs.umd.edu I wrote a macro \AfterMacro, a couple of years ago, that I sometimes use this in macro packages intended for people with NO TeX experience at all. Myself, I think it's better to use the \Tleid\ notation. You can use \AfterMacro in macro definitions, that expands to abbreviations or names or formulas. -------------cut------------------- \def\AfterMacro#1{\if#1,,\else % Feel free to add more punctuation \if#1..\else % marks, as you need them. \if#1!!\else \if#1??\else \if#1::\else \if#1;;\else \if#1''\else \if#1))\else \if#1-\-\else % NOTE: '-' epands to '\-' \ #1\fi\fi\fi\fi\fi\fi\fi\fi\fi} \def\tEx{\TeX\expandafter\AfterMacro} \def\jon{Jonathan\expandafter\AfterMacro} \def\Tleid{\ifmmode T_{\rm Leid}\else$T_{\rm Leid}$\expandafter\AfterMacro\fi} This is how to use \tEx in a sentence, which could also end with \tEx. This is how to use \jon in a sentence, which could also end with \jon. \jon's car (owned by \jon) is green. You can use \Tleid (Yes, \Tleid!!) in the text or in a formula $\Tleid < 2\Tleid$. \bye -------------cut------------------- -- ----------------------------------------------------------------------------- Mats Lofdahl, Stockholm Observatory, S-133 36 Saltsjobaden | +46 - 8 16 44 75 ----------------------------------------------------------------------------- Internet: lofdahl@astro.su.se | Bitnet: grodan@sekth | Sunet: royacs::lofdahl -----------------------------------------------------------------------------