Sentence spacing in digital media

Sentence spacing in digital media concerns the horizontal width of the space between sentences in computer- and web-based media. Digital media allow sentence spacing variations not possible with the typewriter. Most digital fonts permit the use of a variable space or a no-break space. Some modern font specifications, such as OpenType, have the ability to automatically add or reduce space after punctuation, and users may be able to choose sentence spacing variations.

Modern fonts allow spacing variations that the average user can easily manipulate, such as: non-breaking short spaces (thin spaces), non-breaking normal spaces (thick spaces), breaking normal spaces (thick spaces), and breaking long spaces (em spaces).

Word processors and text input programs
The typesetting software TeX treats horizontal runs of whitespace as a single space, but uses a heuristic to recognize sentence endings—typesetting the spaces after them slightly wider than a normal space. This is the default for TeX, although the " " TeX macro will disable this feature in favor of using the same amount of space between sentences as it does between words.

Computer word processors will allow the user to input as many spaces as desired. Although the default setting for many applications' grammar-checkers (e.g., Microsoft Word) is single sentence spacing, they can be adjusted to recognize double sentence spacing as correct also. A program called PerfectIt is an "MS Word add-in that helps professionals to proofread faster". The producer states that a feature was added to the most recent version of their program (as of August 2009), "to convert two spaces at the end of a sentence into one", but they have "never had any requests to convert one space into two".

Some plaintext editors, such as Emacs and vi, originally relied on double-spacing to recognize sentence boundaries. By default, Emacs will not break a line at a single space preceded by a period, but this behavior is configurable (with the option ). More than one space will be preserved, but no additional space will be added automatically if it lacks. There are also functions to move the cursor forward or backward to the next double-space in the text. In Vim the  setting indicates whether extra spaces are inserted when joining lines together, and the   flag in   indicates whether a sentence must be followed by two spaces. The GNU coding standards recommend using two spaces when coding comments. This also applies to software documentation in the GNU project. The optional Emacs mode LaTeX provides a toggling option  which, if set to , creates single sentence spacing after terminal punctuation.

Web browsers
Web browsers follow the HTML display specification and for programmers' convenience ignore runs of white space when displaying them. This convention originally comes from the underlying SGML standard, which collapses multiple spaces because of the clear division between content and layout information. In order to force a web browser to display multiple spaces, a special character sequence must be used (such as " " for an en-space followed by a thin space, " " for an em-space, or " " for two successive full spaces). However, using a non-breaking space can lead to uneven justified text and additional unwanted spaces or line breaks in the text in certain programs. Alternatively, sentence spacing can be controlled in HTML by separating every sentence into a separate element (e.g., a span), and using CSS to finely control sentence spacing. This is seldom done in practice.

To specify and allow multiple spaces to be rendered without collapsing in a web browser, the HTML tag or CSS white-space property can be employed.

Character encodings
ASCII and similar early character encodings provide only a single space, which is breaking and fixed-width (the particular width specified by the respective font). EBCDIC, although earlier than ASCII, provided a breaking fixed-width space (SP), a non-breaking fixed-width space (RSP: "Required SPace"), and an alternate-width non-breaking fixed-width space intended for use in numeric lists with fixed-width (but not necessarily em-width) digits (NSP: "Numeric SPace"). HTML and Unicode can both record runs of consecutive spaces—including multiple-width spaces, and breaking and non-breaking spaces. HTML provides four variations on space width and one fixed-width non-breaking space:,  ,  , and   (all breaking); and   (non-breaking). In a typewriter font,  will equal , but will vary according to the font designer's specification in all other fonts, whether proportional or monospace. The HTML standard also specifies display behavior, not just character encoding, so web browsers following the HTML standard will collapse multiple s to a single. Non-browser applications that use HTML encoding will not necessarily behave this way at display-time, e.g., later versions of Microsoft Word. Unicode provides 15 variations on space width and breakability, including: THIN SPACE &amp;#8201; and NARROW NO-BREAK SPACE &amp;#8239. The following examples demonstrate the effect of these variations on a web browser—using space before punctuation to illustrate identical possible spacing variations following terminal punctuation. These spacing variations, combined with a standard word space, enable users to create custom sentence spacing—as alternatives to a single or double standard word space.
 * No space before the exclamation mark!
 * A no-break space before the exclamation mark !
 * A THIN SPACE before the exclamation mark !
 * A NARROW NO-BREAK SPACE before the exclamation mark!
 * A small-formatted no-break space before the exclamation mark !