In a formula, the space between variables often corresponds implicitly to a multiplication operator. I find LaTeX's default spacing not so readable: symbols are too close to each other, and I would like to see a bit more space between them, automatically (i.e. without manually inserting it). Admittedly, it is a matter of taste, but also imho of legibility. As MWE:

$a x + b$ vs $a \hspace{0.07em} x + b$ and $y dx$ vs $y \hspace{0.07em} dx$   

ax+b and y dx with standard and extra spacing

Globally changing the math spacing might (i) be a bit complicated and (ii) mess up the fine tuned LaTeX compilation. But TeXmacs offers to do it by deciding that the symbol * should be typeset as a (thin) space. That way, one preserves the meaning in the source (a multiplication), which is still readable ( x * y vs x \, y), while obtaining a visually pleasing output.
I am not familiar with catcode, but could it be used to replace all * with a predetermined space? (I can do without the * symbol anyway.) I am aware of the previous post on this topic, but the answers have failed to convince me, and I would like to go ahead.

  • 1
    There is no need to space ax+b; actually I consider such spacing wrong.
    – egreg
    Commented Jun 23, 2015 at 20:34
  • @egreg I have seen your point, and I respect it. There are strong arguments in its favor. Nevertheless, I beg to differ, and wish to experiment something else. Commented Jun 24, 2015 at 11:27

2 Answers 2

\AtBeginDocument{\mathcode`\*="8000 }

But, regarding the differential, I would use a macro


So you would write

$a x + b$ vs $a * x + b$ and $y dx$ vs $y \dif x$
  • Beat me here by a hair. +1 :) Commented Jun 23, 2015 at 20:14
  • @SeanAllred and me by half that:-) Commented Jun 23, 2015 at 20:14
  • Regarding your macro, when possible, I like to use \newcommand\d[1]{\,d#1}, myself. Keeps the code very readable (\int f(x) \d x). My macro is very naive, though :) Commented Jun 23, 2015 at 20:16
  • 3
    @SeanAllred I don't really mind renewing commands, and I use myself \d too (although with a different definition \renewcommand*\d{\mathop{}\!d}). If you really want it to have an argument \renewcommand*\d[1]{\mathop{}\!d#1} but you should take care of ^{<superscripts>}.
    – Manuel
    Commented Jun 23, 2015 at 20:18
  • 1
    @Manuel Superscripts... good point :) Commented Jun 23, 2015 at 20:19

You might be interested in my answer to Automatic spacing of symbols . Here is it again:



$a b$ 
$a*\cos b$
$a \cos b$
$a\,\cos b$

The \mathopen{} avoids inserting two thin spaces if * is in front of a \mathop.

enter image description here

  • All right I'm convinced. I had not thought that a \mathop would tamper with the above solution, but it does, and your solution smartly prevents this. I'll stick with my preferred length though: \hspace{0.07em}. Commented Jun 24, 2015 at 19:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .