Non-breaking space: Difference between revisions
imported>Warudo Tagged the self-reference with TM:self-reference inline |
Corrected a mistake about usage in French. (as seen in [6], "espace mots insécable" (non-breaking space) is used before ":" and not "espace fine insécable" (narrow non-breaking space)) |
||
| Line 23: | Line 23: | ||
A second common application of non-breaking spaces is in [[plain text]] file formats such as [[Standard Generalized Markup Language|SGML]], [[HTML]], [[TeX]] and [[LaTeX]], whose rendering engines are programmed to treat sequences of [[Whitespace (computer science)|whitespace characters]] (space, newline, tab, [[form feed]], etc.) as if they were a single character (but this behavior can be overridden). Such "collapsing" of whitespace allows the author to neatly arrange the source text using line breaks, indentation and other forms of spacing without affecting the final [[typesetting|typeset]] result.<ref>{{Citation | chapter-url = http://www.w3.org/TR/1999/REC-html401-19991224/struct/text.html#h-9.1 | publisher = W3 | date = 1999-12-24 | title = HTML 4.01 | chapter = Structure}}.</ref><ref>{{Citation | chapter-url = http://www.w3.org/TR/CSS21/text.html#white-space-prop | publisher = W3 | title = CSS 2.1 | chapter = Text}}.</ref> | A second common application of non-breaking spaces is in [[plain text]] file formats such as [[Standard Generalized Markup Language|SGML]], [[HTML]], [[TeX]] and [[LaTeX]], whose rendering engines are programmed to treat sequences of [[Whitespace (computer science)|whitespace characters]] (space, newline, tab, [[form feed]], etc.) as if they were a single character (but this behavior can be overridden). Such "collapsing" of whitespace allows the author to neatly arrange the source text using line breaks, indentation and other forms of spacing without affecting the final [[typesetting|typeset]] result.<ref>{{Citation | chapter-url = http://www.w3.org/TR/1999/REC-html401-19991224/struct/text.html#h-9.1 | publisher = W3 | date = 1999-12-24 | title = HTML 4.01 | chapter = Structure}}.</ref><ref>{{Citation | chapter-url = http://www.w3.org/TR/CSS21/text.html#white-space-prop | publisher = W3 | title = CSS 2.1 | chapter = Text}}.</ref> | ||
In | ===Non-void or non-missing behavior <span class="anchor" id="Nonvoid behavior"></span>=== | ||
In programming languages or in software analysis languages (such as [[SAS (software)|SAS]] or [[R (programming language)|R]]) non-breaking spaces can be useful to fill character-type variables with spaces that are not to be considered insignificant. In general, a string filled with spaces can be interpreted as an empty string or a string of missing data. Replacing ordinary spaces with non-breaking spaces helps resolving the ambiguity between "space", "void" and "missing". | |||
== Variations <span class="anchor" id="Width variation"></span> == | == Variations <span class="anchor" id="Width variation"></span> == | ||
| Line 29: | Line 30: | ||
{{unichar|202f|NARROW NO-BREAK SPACE|html=|note=<code>NNBSP</code>}} is another non-breaking space, but with a smaller width than the standard non-breaking space (U+00A0). When used with [[Mongolian language|Mongolian]], its width is usually one third of the normal space;<ref>{{cite web |title=Writing Systems and Punctuation |url=https://www.unicode.org/versions/Unicode7.0.0/ch06.pdf |work=The Unicode Standard 7.0 |publisher=[[Unicode Consortium|Unicode Inc.]] |year=2014 |access-date=2014-11-02}}</ref> in other contexts, its width is about 70% of the normal space, but may resemble that of the [[thin space]] (U+2009), at least with some fonts.{{citation needed|date=April 2025}} | {{unichar|202f|NARROW NO-BREAK SPACE|html=|note=<code>NNBSP</code>}} is another non-breaking space, but with a smaller width than the standard non-breaking space (U+00A0). When used with [[Mongolian language|Mongolian]], its width is usually one third of the normal space;<ref>{{cite web |title=Writing Systems and Punctuation |url=https://www.unicode.org/versions/Unicode7.0.0/ch06.pdf |work=The Unicode Standard 7.0 |publisher=[[Unicode Consortium|Unicode Inc.]] |year=2014 |access-date=2014-11-02}}</ref> in other contexts, its width is about 70% of the normal space, but may resemble that of the [[thin space]] (U+2009), at least with some fonts.{{citation needed|date=April 2025}} | ||
It was introduced in Unicode 3.0 for Mongolian,<ref>{{cite web |title=AMENDMENT 29: Mongolian |url=https://www.unicode.org/L2/L1999/99381-fdam29.pdf |publisher=ISO/IEC |work=Information technology — Universal Multiple-Octet Coded Character Set (UCS) — Part 1: Architecture and Basic Multilingual Plane |year=1999 |id=ISO/IEC 10646-1:1993/FDAM 29:1999(E)}}</ref> to separate a suffix from the word stem without indicating a word boundary. It also triggers special shaping of those suffixes.<ref name="Unicode Standard 15 - NNBSP">{{cite book |title=The Unicode Standard Version 15.0 – Core Specification |date=September 2022 |chapter=6.2.3 Space Characters |publisher=The Unicode Consortium |isbn=978-1-936213-32-0 |url=https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf#page=268 |page=268}}</ref> Starting in Unicode 16.0, it is no longer recommended for this purpose, with the Mongolian vowel separator (U+180E) being recommended for this purpose instead.<ref name="Unicode Standard 16 - NNBSP">{{cite book |title=The Unicode Standard Version 16.0 – Core Specification |date=September 10, 2024 |chapter=6.2.3 Space Characters |publisher=The Unicode Consortium |isbn=978-1-936213-34-4 |url=https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf#page=327 |page=327}}</ref><ref name="Unicode Standard 16 - Mongolian">{{cite book |title=The Unicode Standard Version 16.0 – Core Specification |date=September 10, 2024 |chapter=13.5.1 Mongolian: U+1800–U+18AF |publisher=The Unicode Consortium |isbn=978-1-936213-34-4 |url=https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf#page=651 |page=651 |quote=Prior to Unicode Version 16.0, U+202F NARROW NO-BREAK SPACE (NNBSP) was used to represent this small whitespace; it retains its Script_Extensions value of “Mong” to facilitate backward compatibility. However, its role has been taken over by U+180E MONGOLIAN VOWEL SEPARATOR (MVS), which not only prevents word breaking and line breaking, but also triggers special shaping for the following separated suffix.}}</ref> | It was introduced in 1999 in Unicode 3.0 for Mongolian,<ref>{{cite web |title=AMENDMENT 29: Mongolian |url=https://www.unicode.org/L2/L1999/99381-fdam29.pdf |publisher=ISO/IEC |work=Information technology — Universal Multiple-Octet Coded Character Set (UCS) — Part 1: Architecture and Basic Multilingual Plane |year=1999 |id=ISO/IEC 10646-1:1993/FDAM 29:1999(E)}}</ref> to separate a suffix from the word stem without indicating a word boundary. It also triggers special shaping of those suffixes.<ref name="Unicode Standard 15 - NNBSP">{{cite book |title=The Unicode Standard Version 15.0 – Core Specification |date=September 2022 |chapter=6.2.3 Space Characters |publisher=The Unicode Consortium |isbn=978-1-936213-32-0 |url=https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf#page=268 |page=268}}</ref> Starting in Unicode 16.0, it is no longer recommended for this purpose, with the Mongolian vowel separator (U+180E) being recommended for this purpose instead.<ref name="Unicode Standard 16 - NNBSP">{{cite book |title=The Unicode Standard Version 16.0 – Core Specification |date=September 10, 2024 |chapter=6.2.3 Space Characters |publisher=The Unicode Consortium |isbn=978-1-936213-34-4 |url=https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf#page=327 |page=327}}</ref><ref name="Unicode Standard 16 - Mongolian">{{cite book |title=The Unicode Standard Version 16.0 – Core Specification |date=September 10, 2024 |chapter=13.5.1 Mongolian: U+1800–U+18AF |publisher=The Unicode Consortium |isbn=978-1-936213-34-4 |url=https://www.unicode.org/versions/Unicode16.0.0/UnicodeStandard-16.0.pdf#page=651 |page=651 |quote=Prior to Unicode Version 16.0, U+202F NARROW NO-BREAK SPACE (NNBSP) was used to represent this small whitespace; it retains its Script_Extensions value of “Mong” to facilitate backward compatibility. However, its role has been taken over by U+180E MONGOLIAN VOWEL SEPARATOR (MVS), which not only prevents word breaking and line breaking, but also triggers special shaping for the following separated suffix.}}</ref> | ||
In [[French language|French]] typography, it is called {{lang|fr|espace fine insécable}}<ref name="Unicode Standard 16 - NNBSP"/> and is used before <code>;</code>, <code>?</code>, and <code>!</code>.<ref name="IN Group"/><ref name="Quebec"/> Additionally, footnotes are preceded by a narrow non-breaking space<ref name="Quebec"/> (unless they are enclosed by parentheses, in which case a regular non-breaking space is used).<ref name="IN Group"/> | In [[French language|French]] typography, it is called {{lang|fr|espace fine insécable}}<ref name="Unicode Standard 16 - NNBSP"/> and is used before <code>;</code>, <code>?</code>, and <code>!</code> (with the exception of <code>:</code> before which a regular non-breaking space is used).<ref name="IN Group"/><ref name="Quebec"/> Additionally, footnotes are preceded by a narrow non-breaking space<ref name="Quebec"/> (unless they are enclosed by parentheses, in which case a regular non-breaking space is used).<ref name="IN Group"/> | ||
The narrow non-breaking space is used in numbers as a [[Decimal separator#Digit grouping|group separator]] in French (starting in Unicode CLDR 34<ref>{{cite web |title=CLDR 34 Release Note |url=https://cldr.unicode.org/downloads/cldr-34#h.q1mr39yetx2z_l |publisher=The Unicode Consortium |date=2018-10-15 |quote=French grouping separator changed from no-break space U+00A0 to narrow no-break space U+202F.}}</ref>) and [[Venetian language|Venetian]] (starting in Unicode CLDR 44<ref>{{cite web |title=CLDR v44.0 — By-Type Chart: Numbers:Symbols |url=https://www.unicode.org/cldr/charts/44/by_type/numbers.symbols.html#a1ef41eaeb6982d |publisher=The Unicode Consortium |date=2023-10-25}}</ref>). In Spanish, the [[Royal Spanish Academy]] and [[Association of Academies of the Spanish Language]]'s ''[[Diccionario panhispánico de dudas]]'' prescribes the use of a small space as the number group separator,<ref>{{Cite book |title=Diccionario panhispánico de dudas |url=https://www.rae.es/dpd/punto |access-date=2022-01-07 |publisher=[[Royal Spanish Academy]] and [[Association of Academies of the Spanish Language]] |language=es |chapter=punto |trans-chapter=Period |edition=2nd (provisional version) |quote=Para facilitar la lectura de los números cuya parte entera conste de más de cuatro cifras, se recomienda escribirlos separando con un pequeño espacio los grupos de tres dígitos, contados de derecha a izquierda}}</ref> although this is not the case in Unicode's [[Common Locale Data Repository]] (CLDR).<ref>{{cite web |title=CLDR v47.0 — By-Type Chart: Numbers:Symbols |url=https://unicode.org/cldr/charts/47/by_type/numbers.symbols.html#a1ef41eaeb6982d |publisher=The Unicode Consortium |date=2025-03-11}}</ref> | The narrow non-breaking space is used in numbers as a [[Decimal separator#Digit grouping|group separator]] in French (starting in Unicode CLDR 34<ref>{{cite web |title=CLDR 34 Release Note |url=https://cldr.unicode.org/downloads/cldr-34#h.q1mr39yetx2z_l |publisher=The Unicode Consortium |date=2018-10-15 |quote=French grouping separator changed from no-break space U+00A0 to narrow no-break space U+202F.}}</ref>) and [[Venetian language|Venetian]] (starting in Unicode CLDR 44<ref>{{cite web |title=CLDR v44.0 — By-Type Chart: Numbers:Symbols |url=https://www.unicode.org/cldr/charts/44/by_type/numbers.symbols.html#a1ef41eaeb6982d |publisher=The Unicode Consortium |date=2023-10-25}}</ref>). In Spanish, the [[Royal Spanish Academy]] and [[Association of Academies of the Spanish Language]]'s ''[[Diccionario panhispánico de dudas]]'' prescribes the use of a small space as the number group separator,<ref>{{Cite book |title=Diccionario panhispánico de dudas |url=https://www.rae.es/dpd/punto |access-date=2022-01-07 |publisher=[[Royal Spanish Academy]] and [[Association of Academies of the Spanish Language]] |language=es |chapter=punto |trans-chapter=Period |edition=2nd (provisional version) |quote=Para facilitar la lectura de los números cuya parte entera conste de más de cuatro cifras, se recomienda escribirlos separando con un pequeño espacio los grupos de tres dígitos, contados de derecha a izquierda}}</ref> although this is not the case in Unicode's [[Common Locale Data Repository]] (CLDR).<ref>{{cite web |title=CLDR v47.0 — By-Type Chart: Numbers:Symbols |url=https://unicode.org/cldr/charts/47/by_type/numbers.symbols.html#a1ef41eaeb6982d |publisher=The Unicode Consortium |date=2025-03-11}}</ref> | ||
| Line 56: | Line 57: | ||
Lorem{{nbsp}}ipsum{{nbsp}}{{nbsp}}dolor{{nbsp}}{{nbsp}}{{nbsp}}sit{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}amet,{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}consectetur{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}adipiscing{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}elit,{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}sed{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}do{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}eiusmod{{nbsp}}{{nbsp}}{{nbsp}}{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p}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}Ut{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}enim{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}ad{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}{{nbsp}}minim}} | ||
In contrast, the | In contrast, the first few words of this phrase have been separated with many ordinary spaces but are displayed (rendered by the [[Browser engine]]) as single spaces: | ||
{{quote| | {{quote| | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim}} | ||
}} | |||
Here, they are separated with narrow non-breaking spaces, to show the width of those: | Here, they are separated with narrow non-breaking spaces, to show the width of those: | ||
{{quote| | {{quote| | ||
Lorem{{nnbsp}}ipsum{{nnbsp}}dolor{{nnbsp}}sit{{nnbsp}}amet,{{nnbsp}}consectetur{{nnbsp}}adipiscing{{nnbsp}}elit,{{nnbsp}}sed{{nnbsp}}do{{nnbsp}}eiusmod{{nnbsp}}tempor{{nnbsp}}incididunt{{nnbsp}}ut{{nnbsp}}labore{{nnbsp}}et{{nnbsp}}dolore{{nnbsp}}magna{{nnbsp}}aliqua.{{nnbsp}}Ut{{nnbsp}}enim{{nnbsp}}ad{{nnbsp}}minim | Lorem{{nnbsp}}ipsum{{nnbsp}}dolor{{nnbsp}}sit{{nnbsp}}amet,{{nnbsp}}consectetur{{nnbsp}}adipiscing{{nnbsp}}elit,{{nnbsp}}sed{{nnbsp}}do{{nnbsp}}eiusmod{{nnbsp}}tempor{{nnbsp}}incididunt{{nnbsp}}ut{{nnbsp}}labore{{nnbsp}}et{{nnbsp}}dolore{{nnbsp}}magna{{nnbsp}}aliqua.{{nnbsp}}Ut{{nnbsp}}enim{{nnbsp}}ad{{nnbsp}}minim }} | ||
}} | |||
==Unicode <span class="anchor" id="Encodings"></span>== | ==Unicode <span class="anchor" id="Encodings"></span>== | ||
Latest revision as of 13:56, 26 December 2025
Template:Short description Template:Redirect-distinguish Template:Infobox punctuation mark
In word processing and digital typesetting, a non-breaking space (Template:Char), also called NBSP, required space,[1] hard space, or fixed space (in most typefaces, it is not of fixed width), is a space character that prevents an automatic line break at its position. In some formats, including HTML, it also prevents consecutive whitespace characters from collapsing into a single space. Non-breaking space characters with other widths also exist.
Uses
Despite having layout and uses similar to those of whitespace, it differs in contextual behavior.[2][3]
Non-breaking behavior
Text-processing software typically assumes that an automatic line break may be inserted anywhere a space character occurs; a non-breaking space prevents this from happening (provided the software recognizes the character).
For example, if the text "100 km" will not quite fit at the end of a line, the software may break the line between "100" and "km". Using a non-breaking space between "100" and "km" will prevent this behaviour. This guarantees that the text "100 km" will not be broken—if it does not fit at the end of a line, it is moved in its entirety to the next line. For this reason, many style guides recommend using a non-breaking space between numbers and their associated units.[4][5]
In French typography, non-breaking spaces are used before "high punctuation" (:, ;, ?, and !), on the interior side of guillemets (« and »), and before footnotes. In the case of ;, ?, !, and footnotes (unless enclosed by parentheses), it is specifically the narrow non-breaking space that is used.[6][7]
In German typography, it is used between multi-part abbreviations (e.g., "z.Template:NnbspB.", "d.Template:Nnbsph.", "v.Template:Nnbspl.Template:Nnbspn.Template:Nnbspr.").[8]
Non-collapsing behavior
A second common application of non-breaking spaces is in plain text file formats such as SGML, HTML, TeX and LaTeX, whose rendering engines are programmed to treat sequences of whitespace characters (space, newline, tab, form feed, etc.) as if they were a single character (but this behavior can be overridden). Such "collapsing" of whitespace allows the author to neatly arrange the source text using line breaks, indentation and other forms of spacing without affecting the final typeset result.[9][10]
Non-void or non-missing behavior
In programming languages or in software analysis languages (such as SAS or R) non-breaking spaces can be useful to fill character-type variables with spaces that are not to be considered insignificant. In general, a string filled with spaces can be interpreted as an empty string or a string of missing data. Replacing ordinary spaces with non-breaking spaces helps resolving the ambiguity between "space", "void" and "missing".
Variations
Narrow non-breaking space
Template:Unichar is another non-breaking space, but with a smaller width than the standard non-breaking space (U+00A0). When used with Mongolian, its width is usually one third of the normal space;[11] in other contexts, its width is about 70% of the normal space, but may resemble that of the thin space (U+2009), at least with some fonts.Script error: No such module "Unsubst".
It was introduced in 1999 in Unicode 3.0 for Mongolian,[12] to separate a suffix from the word stem without indicating a word boundary. It also triggers special shaping of those suffixes.[13] Starting in Unicode 16.0, it is no longer recommended for this purpose, with the Mongolian vowel separator (U+180E) being recommended for this purpose instead.[14][15]
In French typography, it is called Script error: No such module "Lang".[14] and is used before ;, ?, and ! (with the exception of : before which a regular non-breaking space is used).[6][7] Additionally, footnotes are preceded by a narrow non-breaking space[7] (unless they are enclosed by parentheses, in which case a regular non-breaking space is used).[6]
The narrow non-breaking space is used in numbers as a group separator in French (starting in Unicode CLDR 34[16]) and Venetian (starting in Unicode CLDR 44[17]). In Spanish, the Royal Spanish Academy and Association of Academies of the Spanish Language's Diccionario panhispánico de dudas prescribes the use of a small space as the number group separator,[18] although this is not the case in Unicode's Common Locale Data Repository (CLDR).[19]
Other variations
Other non-breaking variants defined in Unicode.
- Template:Unichar
- Produces a space equal to the figure (0–9) characters.
- Template:UnicharScript error: No such module "anchor".
- Encoded in Unicode since version 3.2. The word joiner does not produce any space and prohibits a line break at its position.
Example
On browsers, resizing the window will demonstrate the effect of non-breaking spaces on the texts below.
To show the non-breaking effect of the non-breaking space, the following words have been separated with non-breaking spaces: Template:Quote
To show the non-collapsing behavior of the non-breaking space, the following words have been separated with an increasing number of non-breaking spaces: Template:Quote
In contrast, the first few words of this phrase have been separated with many ordinary spaces but are displayed (rendered by the Browser engine) as single spaces:
Here, they are separated with narrow non-breaking spaces, to show the width of those:
Unicode
See also
- Hyphens in computing, for information about hard and non-breaking hyphens
- List of XML and HTML character entity references
- Template:Annotated link
- Template:Annotated link
- Template:Annotated link
- Template:Annotated link
- Template:Section link, for applications
- Template:Annotated link, a non-spacing break
- Template:Annotated link
- Template:Annotated link
- Template:Section link
Notes
References
<templatestyles src="Reflist/styles.css" />
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ a b c Script error: No such module "citation/CS1".
- ↑ a b c Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1"..
- ↑ Script error: No such module "citation/CS1"..
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ a b Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
Script error: No such module "Check for unknown parameters".