# A quirk when using xemacs scripts to automatically expand abbreviations into LaTeX code

I am an avid fan of Oleg Alexandrov's method for customizing XEmacs to make it an efficient system for editing LaTeX files. One feature I find particularly useful is the ability to have XEmacs automagically expand abbreviations. (You may ask: why not just use macros? Answer: I like, for example, the ability to simply type \eq and, after pressing the spacebar, have my cursor be placed inside a syntactically-correct equation environment.)

One quirk of XEmacs seems to be that one cannot use capitalization in the abbreviations. For example, suppose one defines \s to be an abbreviation which is expanded into \mathsf{ (to use a sans-serif font in math mode). Then typing \S will be expanded into \Mathsf, which will not compile. This behavior is undesirable if one also wants to be able to use the ordinary \S command in LaTeX to typeset a "section" symbol. One workaround is to define \sec or something similar as an "abbreviation" to be expanded into \S, but this is sort of annoying.

(Another example: if -- for some reason -- one wants to avoid using macros, one can use abbreviations for the same functionality. But one cannot define \gl to be $\mathfrak{gl}$ and \GL to be \mathrm{GL} because of the same capitalization issue; the latter will be expanded to \Mathfrak{gl}, I believe.)

My question: is there a more satisfying workaround for this problem?

P.S. If this question is more appropriate for stackoverflow or a different stackexchange site, please let me know.

-