# Math mode commands with more semantics?

I accustomed myself to define my own little macros for any mathematical expression I use frequently. For example, I have a macro for the expected value of a random variable:

\providecommand{\ev}[1]{\mathbb{E} \left[#1 \right]}


This has proven to be incredibly useful for several reasons:

1. I have less to write.
2. My document source is uncluttered.
3. I can focus on the semantics instead of the typesetting.

In non-math mode, this is the default: I specify what I want (e.g. a subsection), not how it should look like (e.g. large and bold, with letters capitalized). Even in math mode, there are certain commands (e.g. \frac) which come with semantics attached to them. Another advantage I can think of is that it is easier to adjust documents to different tastes: Some people may be used to the \mathbb{E}, others to a bold or even a normal E for denoting an expected value. Having macros that carry semantics would allow to quickly change the notation.

With all this in mind, it seems quite surprising that I wasn't able to find a package which provides me with such commands. Am I just looking in the wrong places or is there a good reason for not doing what I try to?

-
To search package you can use CTAN. For example you can search by topic: CTAN keyword. If I understand you question correct you are looking for packages like commath or mathcmd. –  Marco Daniel Dec 16 '11 at 20:08
Check out the vector and easyvector packages that both provide semantics for representing vectors. –  Lev Bishop Dec 17 '11 at 6:05

What about cool (COntent Oriented LaTeX)? Examples here.

-
Obviously there are still lots of things to add, but this gives an excellent start. Thanks! –  blubb Dec 17 '11 at 5:55

Of course, replacing frequently used letter/character sequences with LaTeX macros -- especially if these sequences embody stylistic and aesthetic choices that may be subject to a global change (say, because of a journal's house style) -- is a great habit to have when writing TeX/LaTeX documents. You observe:

it seems quite surprising that I wasn't able to find a package which provides me with such commands.

I suspect that your own set of useful and handy macros, which obviously depend importantly on the field you are in, and the stylistic preferences that are embedded in these macros, are likely to be so tailored to your needs and work habits that they might not be of much use to anyone else. Conversely, if some others wrote a package that collected their favorite abbreviations and incorporated their preferences, the resulting package might not be of much use outside of a very small circle of persons.

That said, if you have undergraduate and/or graduate students who are learning to use TeX and Friends, you might do them a huge favor by giving them your collection of macros as a template, that they can adapt and expand. :-)

I guess it would also be a good idea for writers of LaTeX Guides for Beginners if they stressed the importance of developing good work habits -- and if they pointed out that one of these good work habits is to come up with a set of macros that will save a lot of time down the road. :-)

-
I'd expect that package to establish a shared language among people. An example: I just spent half an hour replacing every occurance of a \Var \left[X \right] macro someone else wrote with my own \var{X}. If a package existed that standardized the syntactic ground, I could have saved that work. –  blubb Dec 17 '11 at 5:58