Command to write MIMO configurations

I want to write something like MIMO (multiple-input and multiple-output) configuration 2 x 2, 2 x 4, etc. and be consistent all over the document. For now I have defined a command to do that as I put in the MWE. However, I don't know if it is the best approach. Furthermore, how would you typeset IEEE standards, like IEEE 802.11g?

\documentclass{article}

\newcommand*{\mimo}[2]{\mbox{\ensuremath{\mathrm{#1\,\times\,#2}}}}

\begin{document}

MIMO configuration \mimo{2}{2}, \mimo{2}{4}, and \mimo{4}{4} would be good for \mbox{IEEE\,802.11g}.

\end{document}

-

\newcommand*{\mimo}[2]{\mbox{\ensuremath{\mathrm{#1\,\times\,#2}}}}


the \mbox means that you are definitely not in math mode so the tests that \ensuremath do to get into math mode are redundant. If you keep the \mbox you could just use $..$. Putting the code in a box does have the disadvantage that the space around the \times is frozen to its natural length so can not stretch or shrink to help linebreak the surrounding paragraph and match the word spacing on the line.

Assuming that you only use digits the \mathrm is redundant as digits come from that font anyway.

Finally, perhaps it's the style in this context (which I don't know at all) but \,\times\, looks a bit spaced out to me. I'd probably do

\newcommand*{\mimo}[2]{$\binoppenalty\@M#1\times#2$}


which will prevent line breaking at the \times while still allowing some flexibility in the white space.

-
Your approach seems ok. I tried it (enclosing the command in a \makeatletter makeatother) and I liked the final result. However, if I have not only digits, shall I use then \newcommand*{\mimo}[2]{$\binoppenalty\@M\mathrm{#1\times#2}$}? –  cacamailg May 8 '13 at 0:05
@cacamailg yes although I'd do \mathrm{#1}\times\mathrm{#2} which typesets to the same thing but seems more natural markup for a product of two (roman) identifiers the fact that \mathrm doesn't affect the \times so you can just use one \mathrm it is more of an implementation detail than a feature. –  David Carlisle May 8 '13 at 0:13
Ok. For the IEEE standards I will probably keep the way I was doing. –  cacamailg May 8 '13 at 0:16
I believe that $\mathrm{#1\times\nolinebreak#2}$ is easier. ;-) –  egreg May 8 '13 at 8:26