0

I want to declare $5\times 5$, so that the spacing comes out right.

When I type $2 \times (8+8+1)$, the spacing next the x is always bigger than that next to the +.

In order to fix this I want to define $\times$ as a binary operator, same as the +.

I try and do this, but that fails.

\DeclareMathSymbol{\xx}{\mathbin}{AMSb}{\times}

$2\xx(8+8+1)$

outputs

2 −1,0,1,−1.3,1.3,−1,0,1 [7] ∗ 2(8 + 8 + 1).

Johan
  • 267
  • 2
    Your claim “the spacing next the x is always bigger than that next to the +” is not true. Please try $2 \times (8+8+1)$\par$2 + (8+8+1)$ and you will see that the spacing around \times is exactly the same as the +. I think you are “tricked” by the symbol itself. The \times looks smaller than the +, so you feel that there is more surrounding space. – Ruixi Zhang Jan 19 '19 at 16:37
  • @RuixiZhang Ah, I see. OK. You are right. – Johan Jan 19 '19 at 16:46
  • My problem was fixed here: https://tex.stackexchange.com/questions/55512/how-to-change-default-for-spacing-around-binary-relations The problem is that a x b is very common in the text and Latex loves to stretch these occurrences to fix its spacing issues. By limiting its room for maneuver a x b does not always look so stretched out all the time. – Johan Jan 19 '19 at 16:59

1 Answers1

6

The \times symbol is slightly narrower than +, but (at least in Computer Modern) they have equal width bounding boxes.

Add to this that the shape of \times may make the space after it look a bit wider.

Anyway, \times is declared as a binary operation symbol.

A visual comparison may clear up things:

\documentclass{article}

\makeatletter
\setlength{\fboxrule}{0.1pt} % hairline
\setlength{\fboxsep}{-\fboxrule} % don't add space
\newcommand{\bplus}{\mathbin{\fbox{$\m@th+$}}}
\newcommand{\btimes}{\mathbin{\fbox{$\m@th\times$}}}
\makeatother

\begin{document}

$2 \times (8+8+1)$

$2 + (8\times 8\times 1)$

$2 \btimes (8\bplus 8\bplus 1)$

$2 \bplus (8\btimes 8\btimes 1)$

\end{document}

enter image description here

egreg
  • 1,121,712
  • I am not on a computer, so I can't check, but... Why the m@th? Thanks! – Rmano Jan 19 '19 at 23:32
  • @Rmano Avoids the possible setting of \mathsurround. It's usually set to zero, but it's good practice to add \m@th for greater safety. – egreg Jan 19 '19 at 23:34