neilc@natmlab.dms.oz (Neil Crellin) (07/30/89)
Any tips on how I can get abbrev-mode to do what I want in the following situation. When typing a document I want an abbrev so that whenever I type Z, it's expanded to {\bf Z}. Using C-x + or C-x C-a in abbrev-mode with any sort of number prefix doesn't give me what I want. It either doesn't give me enough of the text or grabs the words beyond. Worse, if I edit the abbrev file directly, even avoiding the problems caused by \b meaning backspace, the `b' in \bf is always capitalised, which LaTeX isn't happy with. I've got around it for the moment by not using abbrev mode and having {\bf Z} in my keyboard macro and getting it typed in with C-x e. Any suggestions appreciated. -- Neil Crellin, CSIRO Maths & Stats, Sydney, Australia. (neilc@natmlab.dms.oz.au) PO Box 218, Lindfield, NSW 2070. (ph) +61 2 413 7721 (fax) +61 2 416 9317
bard@THEORY.LCS.MIT.EDU (07/31/89)
Probably the easiest thing to do is \newcommand{\Z}{{\bf Z}} or \def\Z{\bf Z} Probably the hardest sensible thing to do is to write an abbrev hook which turns {\Bf Z} to {\bf Z}, and install that hook in edit-abbrevs. I haven't done this kind of thing recently, but it was easy after a bit of tinkering. -- Bard the latex/emacs gargoyle
jthomas@nmsu.EDU (08/01/89)
Presumably Neil understood that the easiest way is to type "z" instead of "Z", since the abbreviation replacement is taking the case of the entered text. So, a better solution is to edit the abbrev entry to look something like: "Z" 5 "{" (lambda nil (insert "\\bf Z}")) . Yeah, that's a hack, but .... ::-{)} Jim Thomas
merlyn@iwarp.intel.com (Randal Schwartz) (08/03/89)
In article <8907311924.AA26177@NMSU.Edu>, jthomas@nmsu writes: | Presumably Neil understood that the easiest way is to type "z" instead of | "Z", since the abbreviation replacement is taking the case of the entered | text. | | So, a better solution is to edit the abbrev entry to look something like: | | "Z" 5 "{" (lambda nil (insert "\\bf Z}")) | | . Yeah, that's a hack, but .... ::-{)} | | Jim Thomas or, 26 lines like: "a" 0 "a" (lambda () (forward-char -1) (insert "{\\bf ") (forward-char 1) (insert "}")) replacing "a" with "b", etc. Of course, the *real* way would be to stick that lambda expression into a function. And then, instead, why even use abbrev's? Why not just code them, and do a global sub later? I mean, look for all the @A, and replace with {\bf A}... ? Maybe that wouldn't handle some other concern? Curious, -- /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel, Hillsboro, Oregon, USA | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/
neilc@natmlab.dms.oz (Neil Crellin) (08/05/89)
In article <4749@omepd.UUCP>, merlyn@iwarp (Randal Schwartz) writes: >In article <8907311924.AA26177@NMSU.Edu>, jthomas@nmsu writes: >| Presumably Neil understood that the easiest way is to type "z" instead of >| "Z", since the abbreviation replacement is taking the case of the entered >| text. This was something I had forgotten, and I apologise for that. >or, 26 lines like: > >"a" 0 "a" (lambda () (forward-char -1) (insert "{\\bf ") (forward-char 1) (insert "}")) > Actually, just one line: "z" 0 "z" (lambda .............as above..) This is exactly what I was after for the letter Z only. (that's zed. not zee) >And then, instead, why even use abbrev's? Why not just code them, and >do a global sub later? I mean, look for all the @A, and replace with >{\bf A}... ? Sure. Or I could use bard's suggestions and \newcommand in LaTeX or \def in TeX. I didn't want to, that's all there was to it. I figured abbrev-mode should be able to handle it and couldn't see how to make it. Now I know. Many thanks for all the help. -- Neil Crellin, CSIRO Maths & Stats, Sydney, Australia. (neilc@dmssyd.dms.oz.au) "In the week before their departure to Arrakis, when all the final scurrying about had reached a nearly unbelievable frenzy, an old crone came to visit the mother of the boy, Paul." - Frank Herbert, Dune