6

I presently must copy and paste Em Space, , from a website or my profile to indent text. Any easier solution without relying on other websites?

This question has probably been asked before, but I can't find an answer.

3

Em Space has its own HTML entity,  . The following text has been indented with them, see the source:

Level 0

 Level 1

  Level 2

   Level 3

2

Markdown, the markup language used by Stack Exchange, doesn't support indentation of regular text.

       The workaround of manually adding whitespace at the start of the line (e.g. non-breaking space or em space) doesn't work because it only affects the first line of the paragraph. This paragraph starts with several non-breaking spaces, but as you can see, it isn't properly indented.

HTML, which Markdown expands to, doesn't really support indentation via tags; if you want an indented paragraph in HTML, the intended method is to use CSS to specify a style for it that indents the text. An unintended method (which is commonly used to indent threaded conversation on Wikipedia) is to use the <dd> tag, which is intended for the "definition" part of a definition list (i.e. a list of terms and their definitions); browsers typically use indentation as part of the default style for the tag. However, that's something of a hacky workaround (you aren't supposed to have a definition without a corresponding term). Besides, <dd> is not one of the HTML tags whitelisted on Stack Exchange, meaning that the parser will reject this method anyway.

It may be worth thinking about what the purpose of the indentation you want is; because indentation in the sense that you want it is impossible, you may need to find a different solution that serves the same purpose. One common use of indentation is to visually show hierarchical data. You can get the same visual structure by using nested unordered lists (which handle wrapping paragraphs, etc., correctly, and which are identical to nested indents apart from the fact that they show the bullets):

  • 1
    • 1.1
    • 1.2
      • 1.2.1
    • 1.3
  • 2
    • 2.1

The other common use of indentation is in computer code. This would normally be represented using preformatted code, which preserves whitespace and doesn't add newlines, so you can safely represent the indents using regular spaces. In Markdown, you specify that formatting using four leading spaces (or the <pre> tag), which looks like this:

1
    1.1
    1.2
        1.2.1
    1.3
2
    2.1

However, because it turns off all automatic word-wrapping, line breaks, proportional fonts, etc., it isn't suitable for regular English text, only for things like programming languages and ASCII art.

2

The official "Editing Help" for "Advanced Lists - Indenting" is limited but you can use these tricks:

At least four spaces count as one space, on a gray background, or
 Five spaces,
  Six spaces &
   Seven spaces,
 Five again, if you don't care about background color over precision.

 

If you want bullets:

  • first level A - no space in front the bullet character ("-")
    • second level AA - 1 space
      • third level AAA - 5 spaces
    • second level AB - 4 spaces
  • first level B - no space

 

Use &nbsp; or &emsp; for neither background nor bullets:

        4 &nbsp;

        4 &emsp;

 

Or HTML style:

<ul>
  <li>First Level</li>
  <li>First Level again
    <ul>
      <li>Second Level</li>
      <li>Second Level again</li>
    <ul>
      <li>Third Level</li>
      <li>Third Level again</li>
    </ul></ul>
  </li>
  <li>First again</li>
</ul>
  • First Level
  • First Level again
    • Second Level
    • Second Level again
      • Third Level
      • Third Level again
  • First again

 

MathJax, if the site supports it (this site doesn't):

$\text{Text not indented}$

$\; \text{Text indented using \;}$

$\quad \text{Text indented using \quad}$

$\qquad \text{Text indented using \qquad}$

$\qquad \text{Text indented using \qquad, but overwritten using thirty-two \negthinspace or \!} \negthinspace\negthinspace\negthinspace\negthinspace \negthinspace\negthinspace\negthinspace\negthinspace \negthinspace\negthinspace\negthinspace\negthinspace \negthinspace\negthinspace\negthinspace\negthinspace \negthinspace\negthinspace\negthinspace\negthinspace \negthinspace\negthinspace\negthinspace\negthinspace \negthinspace\negthinspace\negthinspace\negthinspace \negthinspace\negthinspace\negthinspace\negthinspace \text{Other Text}$

MathJax Screenshot

[Note: You can use the edit link to read the raw source, if something isn't obvious from the above.]

1

For the specific question of how to produce the character without copying it from a website, there are a few ways.

In addition to &emsp;, you can use Unicode. This will also work in comments, unlike the HTML code.

I use AutoHotkey (with Windows) to map the character to Ctrl Space, which lets me type it anywhere. But any application that allows you to map a keystroke to a character's Unicode value will do. (To be honest, I use this to quickly type em dashes and other characters much more often than I do for non-breaking spaces.)

There are many sites where you can look up these codes. One is FileFormat.Info.

The Unicode value of em dash is U+00A0.


You can also produce these characters within certain specific programs.

For instance, in Microsoft Word (for Windows), type 00A0Alt X. Or, if you use Sublime Text, you can install the UnicodeMath package (this lets you produce a non-breaking space by typing \u00A0Space).

Neither of those methods are as simple as just typing a key to get a non-breaking space (because you will still have to copy and paste), but they will let you quickly produce any character you want that you don't have mapped to a key and without having to visit a website.

0

You can use the <pre> tag for this kind of solution for only copy paste. This will have issues on small screens.

<pre>
My Profile

  Name  : name
  Age   : 23

Other Details
</pre>

You must log in to answer this question.

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