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 Jun 23 '15 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. – Pascal Romon Jun 24 '15 at 11:27
\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 :) – Sean Allred Jun 23 '15 at 20:14
  • @SeanAllred and me by half that:-) – David Carlisle Jun 23 '15 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 :) – Sean Allred Jun 23 '15 at 20:16
  • 2
    @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 Jun 23 '15 at 20:18
  • @Manuel Superscripts... good point :) – Sean Allred Jun 23 '15 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}. – Pascal Romon Jun 24 '15 at 19:00

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.