Are spaces necessary between operators when we write a math formula?

Professional Mathematicians/ Math Writers I ask for your help.

According to the dictates of your style guides, do we need spaces between operators when we write a formula?

i.e., x - y = z

Or can we exclude the spaces?

i.e., x-y=z

What does your style guide say (I can’t seem to find one on the net)?

What’s the rationale for having a preference of one over the other.

Thanks a lot for your help in this pretty trivial, but important to me right now (work wise), problem.

As a programmer, I find that spaces greatly improve readability, especially when looking at someone else’s code.

In professional publications, you will see a space (really a half-space) between common operators.

In many programming languages, you do need the spaces to avoid ambiguity. “x-y” could be a variable, or it could be subtracting variable y from variable x.

Most professionals in mathematics and the sciences use LaTeX when creating professional documents with mathematical formulae. LaTeX automatically includes a small amount of space around math symbols, which seems to be a fairly standard convention. Obviously, if you are coding, you would follow whatever convention exists (if there is one).

LaTeX spacing

The Chicago Manual of Style says the following (bolding mine):

  • 1

Many? Name one. All programming languages I’m familiar with are lexed such that ‘x-y’, ‘x - y’, and ‘x -y’ become the same stream of tokens.

Thanks all. Spaces (medium and thick) it is.

You helped me out.

MikeS - I found that Chicago Manual of Style, and checked in the mathematics section but couldn’t find that part you quoted. My internet blindness must be acting up again.

You know what sucks? When writing “COBOL” as the reply to a post, the Board thinks you’re shouting.

Anyway, COBOL.

Bah. I should have known. (The interesting thing is that old-fashioned FORTRAN worked precisely the opposite way: “DO 10 I = 1.10” (a typo for “DO 10 I = 1,10”, which begins a counted loop setting I from 1 to 10, inclusive) creates a variable DO10I and assigns it the value 1.10, because FORTRAN lexers ignored all spaces outside of quoted strings.)

For the record, it’s section 14.14, “Basic Spacing in Mathematics.”

Hiding it in plain sight - how devious of them :stuck_out_tongue: