What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 150 Stack Exchange communities.

I want to write multiple spaces in code say

many       spaces

but I want to do this in code block ``. But in this case spaces are merged into one. I found this question but there is no solution... Maybe now somebody knows how to do this?

share|improve this question
You're asking the same question, which has workaround in the answers – CharlesB Feb 16 '12 at 7:44
@CharlesB can you make the workaround work? I wasn't able to. :/ – Shadow Wizard Feb 16 '12 at 8:13
@ShaDowWizArd: My fault, it doesn't work – CharlesB Feb 16 '12 at 9:00

3 Answers 3

up vote 10 down vote accepted

Looks like the hack suggested in the answer to the question you referring to no longer works, neither in post body nor in comments. (with `` multiple `` `` spaces)

The backticks are not exactly code blocks.. they won't highlight the code inside them they're used more to "escape" tags so they appear in the post or to distinguish code parts written as part of the sentence.

You can write multiple           spaces as part of a paragraph using   - it wil be parsed as a single space.

However when part of backtick      code it's not parsed.

You also have the <pre></pre> tags, and whatever written between them will be indeed preserved as-is, for example:

many       spaces

However this can't be inline, even

if it's part of existing paragraph
(see the source) it will be parsed into its own line.

share|improve this answer
Thanks it was very useful! – Ademiban Feb 16 '12 at 8:15
Cheers, you decided to use the &nbsp; approach then? – Shadow Wizard Feb 16 '12 at 8:16
Actually, if you refer to the original question, it gives a workaround in the question body itself. None of the workarounds mentioned here work in comments. But if you use Alt+0160 (on Windows this is the Unicode NBSP), it works in comments: sed /    / /. – Abel Mar 21 '12 at 20:50
@Abel works with ALT+0160 and ALT+255 as well - but I don't like this hack as the team might "bust" those characters at some point and treat them exactly like blank space thus rendering all those efforts meaningless. Might be good and dandy for now, but we can't depend it will stay in this format for long time. – Shadow Wizard Mar 22 '12 at 7:00
It's nothing more than a workaround. I doubt they will revert the ten-or-so Unicode spaces as collapsible spaces at some point, but you never know. However, that counts for any workaround. Since nothing else works in comments, this is the only way as far as I know, that works. Until the SO-team fixes this permanently. – Abel Mar 22 '12 at 9:21

To type spaces at a random place, I use two different methods:

  • &nbsp; &nbsp; &nbsp; ...
    Every space between each entity is also rendered. Instead of typing &nbsp; for each space, use a &nbsp;<space> combination.
  • +U2003 Unicode character. This is called an "Em space", and is bigger than a normal space. It effectively adds a long space at any point in your post. Copy-paste the gap between the following words for a demo:
    Start:          End. Between it, I used 10 em spaces.
share|improve this answer
Unicode world is full with gaps and spaces, lol! – Shadow Wizard Mar 22 '12 at 7:02

You can use the real unbreakable space : ALT+0160 like a boss.

Note that the the block itself can't start or end with a space:
. .
. .
. .

is in fact

`    .   .`
`.   .    `
`.       .`

screenshot: In case it gets changed in the future.

share|improve this answer

You must log in to answer this question.

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