I have been using m \times n to denote the size of a matrix. But lately I've decided that it has too much space and doesn't look quite right (to me). Presumably the largish spaces are present because LaTeX treats \times as a mathematical operator -- it thinks I'm writing $m$ multiplied by $n$.

So, I'd like to define a \by symbol, so that I can write m \by n instead of m \times n, and get reduced spacing. The obvious approach is to define \by to be \hspace{-0.1em}\times\hspace{-0.1em}, or something like that.

Does that seem like a good approach? I'm a bit worried about what will happen if I use this in superscripts.

Edit: I ended up using

  • 1
    do you want the result of $m{\times}n$ or is that too tight? – David Carlisle Jan 22 '16 at 14:12
  • Looks pretty good. Because the "times" glyph has some space built into it, I suppose. That was easy. Thanks again. – bubba Jan 22 '16 at 14:23
  • @bubba, you edited over my edited. – Sigur Jan 22 '16 at 14:32
  • @bubba, now I edited again. If you wish, please, change but be careful. – Sigur Jan 22 '16 at 14:34
  • 3
    \newcommand*\by{{\times}} would be the nice approach that david suggested and then use $m \by n$. – Manuel Jan 22 '16 at 17:46

You could use $m{\times}n$ so that you get mathord spacing (i.e. no extra space) rather than the default mathbin spacing,


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.