Sometimes math formulas become part of a word - eg:

  • "d-1-dimensional" (eg d-1-dimensional sphere, d-1-dimensional hyperplane, d-k-dimensional subspace)
  • "mxn-matrix" or mxn-dimensional (matrix for example)
  • "d=3-dimensional" (eg: in the d=3-dimensional case...)

If I write for example $d-1$-dimensional in LaTeX, the resulting spacing

enter image description here

looks very bad in my point of view as it suggest to read each math symbol as a single word ("d minus one-dimensional") instead of combining them to one word "d-minus-one-dimensional".

For the specific case of Spacing in "$d=2$-dimensional", I got already a very good answer: https://tex.stackexchange.com/a/504362/128042, now I would like to generalize this question here.

I am both interested in

  1. opinions what would be good typography- how the spacing should look like and
  2. elegant LaTeX-code that does this spacing in a more automated way - e.g. defining a command that autmomatically removes all horizontal spaces of a given argument. So that I can call something like \mathword{d-1}{dimensional}
  • While $(d-1)$\nobreakdash dimensional makes sense, $d=3$-dimensional is meaningless. Also the space of m × n matrices is $mn$\nobreakdash dimensional. – egreg Nov 21 at 16:52
  • A dash (-) is missing after \nobreakdash; i.e., it should read "While $(d-1)$\nobreakdash-dimensional [...]" – user94293 Nov 21 at 22:39

I'd avoid most of this. You gain very little in saying that

the vector space V is (m³ + n)-dimensional


the vector space V has dimension m³ + n

What meaning to attribute to

a d = 3-dimensional space

is very unclear to me: the d is completely useless and confusing. Be clear and say

a space of dimension d = 3

if you want to assign a value to the letter d.

Anyway, you can do what you ask by


and you can say

\mathprefix{d=3} dimensional
\mathprefix{m\times n}dimensional

(spaces after } are optional).

With my mathematician hat on, I'd also warn that the space of m × n matrices has dimension mn (the cross denotes a cartesian product, not a multiplication).

Note. The command \nobreakdash requires amsmath.

Technical note. You can see the seemingly redundant braces in the definition of \mathprefix; they aren't. Their purpose is twofold: first, they “freeze” the spacing, not allowing it to participate to stretching or shrinking with the other spaces in the same line; second: they disallow any line break in the formula.


Salient points:

  1. The hyphen before "dimensional" is a text, not math hyphen, brought on by using a compound adjective.

  2. I choose not to set "1", "2", or "3" as a "-dimensional" precursor in math, unless it becomes part of a larger math expression.

  3. "mxn" seems to me an exception to the rule, in that one does not see it used with proper math spacing.

  4. Other than case 3, if I am using a mathematical precursor to the hyphen, I think clarity is best achieved by placing it in parens and using proper math spacing.

My humble recommendation:



$d ={}$3-dimensional 


enter image description here

In the 3rd line, I am assuming that d refers to a dimension, rather than an integer. On the other hand, one could use the 4th line, if one was setting the variable d to a value of 3 for "d-dimensional" space.

  • The brackets are a nice idea! In your last example, you understood me wrong. I do NOT want to say "d is 3-dimensional". When I write "In the case that X is as d=3-dimensional space", I want to rimind the reader that I defined X to be a d-dimensional space in general, while telling the reader that I now consider the case where I set the integer d to be d=3, which results in X beeing a 3-dimensional space. – Jakob Nov 21 at 15:41
  • 1
    @Jakob Then I would follow the first example: $(d=3)$-dimensional – Steven B. Segletes Nov 21 at 15:43

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.