Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The digits in the Arial font supplied with Windows are monospaced, in that they each take up the same horizontal space, but they seem to have neglected to provide a "monospaced" version of the space character. This means that you can't format a column of digits right-justified in (say) 12 spaces and have the right-hand edge be aligned. For example:


works because the font used for code examples has spaces the same width as digits. This however doesn't work if the same text is displayed in Arial (I can't demonstrate because I can't figure out how to defeat SU's reformatting at the moment!).

It just so happens that with Tahoma 8 point you can cheat because a space is exactly half the number of pixels as a digit, but that is messy and very specific.

share|improve this question

Try using a figure space which should be the same width as a digit even in a proportional font:

A figure space is a typographic unit equal to the size of a single typographic figure (numeral or letter), minus leading. Its size can fluctuate somewhat depending on which font is being used. In fonts with monospaced digits, it is equal to the width of one digit.

share|improve this answer
Perfect. I combined this with a 'thin space' to get beautifully aligned money representations. Let me clarify in a separate answer. – Timo Nov 26 '13 at 15:17

Yes, if you're willing to pay for it, monotype has a varient of arial for sale that's monospaced.

On the other hand, if you want a good, sans serif font that's free, and works well in many situations, i'd suggest looking at droid sans mono

share|improve this answer
Hmm. I wanted just the digits and space mono - I quite like the tahoma and arial proportional text. Also the demo on the page you provided doesn't go down to 8pt - 12px is 9pt on my machine. Also for some reason my display messes with the fonts and actually makes them less readable – rossmcm Aug 26 '11 at 4:33

I used the figure space (as suggested by user1458424) to align numbers and the thin space to separate thousands.

In, say, JavaScript or C, you can type the corresponding unicode char codes anywhere in a string:

  • \u2007: Figure space.
  • \u202F: Thin space.

Using the thin space as a thousands separator has some significant advantages:

  • The intent is clear to both US and European readers, as opposed to using a , or ..
  • You can add it regardless of whether the value is >= 1000, since the space is invisible to the eye.
  • It is thinner than the regular space that separates the currency sign from the value, which makes it look better when there is only one space after the currency sign.

Below, I will describe what I did to get the following format (European decimal separator , in this ex.):

  • €       1,75
  • €     100,00
  • €     199,97
  • €  10 350,00
  • €  21 003,18
  • € 121 018,33

    1. Remove from input all non-digit characters: price.replace(/[^\d]+/g, '').
    2. Count the 'missing characters': missingDigits = maxDigits - price.length.
    3. Set the output value to '€'.
    4. For each missing digit, append a figure space to output: '\u2007'.
    5. Append all the input digits except for the last two, then a decimal separator, then the input's last two digits.
    6. Return all characters of the output except the last six, appended by a thin space '\u202F', appended by the last six characters.

The input can be any string representation of a number, with or without punctuation and illegal characters. The output will be as seen above. You have to choose the maximum number of digits allowed.

share|improve this answer
Note that there are additional interesting related characters to be found, such as the figure dash. – Timo Feb 25 '14 at 14:55
Think you might be better to edit the original answer to include these useful extras. Helpful though. – O'Rooney Feb 18 at 1:12

You must log in to answer this question.

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