TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

\newcommand{\by}{\hspace{0.05em}{\times}\hspace{0.05em}}
share|improve this question
1  
do you want the result of $m{\times}n$ or is that too tight? – David Carlisle Jan 22 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 at 14:23
    
@bubba, you edited over my edited. – Sigur Jan 22 at 14:32
    
@bubba, now I edited again. If you wish, please, change but be careful. – Sigur Jan 22 at 14:34
2  
\newcommand*\by{{\times}} would be the nice approach that david suggested and then use $m \by n$. – Manuel Jan 22 at 17:46
up vote 18 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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