Template:Gaps/doc
This is a documentation subpage for Template:Gaps. It contains usage information, categories and other content that is not part of the original template page. 
Template:Gaps outputs its unnamed arguments in order, applying the marginleft: 0.25em
CSS rule to all but the first, so that there will be gaps of 0.25em between the arguments. The whole output has the whitespace: nowrap
rule so that it will not be broken across several lines.
It supports up to twenty unnamed arguments. In addition, it supports the base
and e
arguments which can be used for numbers in exponential notation. The base will be assumed to be 10 unless otherwise specified; a hyphenminus "" in the exponent will be automatically substituted by a minus sign "−". It also supports the arguments lhs
and u
for putting lefthand sides and units within the nonbreaking span (see examples below).
See Wikipedia:Manual of Style (dates and numbers)#Large numbers and Wikipedia:Manual of Style (dates and numbers)#Decimal points for information about where to put the gaps in numbers.
Usage[edit]
Input  Output 

{{gaps−2.0023193043622(15)}}

−2.0023193043622(15) 
{{gaps299792458u=m/s}}

299792458 m/s 
{{gapslhs=π3.141592653589793238462643383279...}}

π = 3.141592653589793238462643383279... 
{{gapsP.A.M.}} Dirac

P.A.M. Dirac 
{{nowrap begin}}{{gapssin2''φ''}} = 2 {{gapssin''φ''}} {{gapscos''φ''}}{{nowrap end}}

sin2φ = 2 sinφ cosφ 
"She disputed his statement that 'Voltaire never said "I disapprove of what you say, but I will defend to the death your right to say {{gapsit."'"}}

"She disputed his statement that 'Voltaire never said "I disapprove of what you say, but I will defend to the death your right to say it."'" 
{{gaps1.602176487(40)e=19u=C}}

1.602176487(40)×10 ^{−19} C 
64 MB ({{gaps64base=2e=20}} bytes)

64 MB (64×2 ^{20} bytes) 
Performance impact[edit]
Template:Gaps allows up to 20 parameters, and displays the gaps by setting the leftmargin space of each group. The gaps are not actual spaces, so a copy/paste of the text is treated as connected, consecutive text. Template:Gaps is coded with minimal wikitext markup, so equivalent handcoded markup could not be much shorter. Counting the length of the spantags, there can be 15,800 instances of 2part {gaps}, or 9,500 uses of 3part gaps, or 6,800 with 4part gaps (etc.), per page. The template uses a minimal expansion depth of only 2 levels (of the ifelse nesting limit, such as 40 maximum), and if those 2 levels are exceeded, only the first portion will be shown. Although the text, as displayed, is consecutive as onscreen text, {gaps} for a number cannot be used in a calculation because the internal markup contains the invisible <span> tags which would be invalid text in typical numeric processing.
See also[edit]
 {{gapnum}}  format a number to show 3digit gaps, with decimal gaps of 3 or 4 digits
 {{Val/delimitnum}}  format a number to show commas, but decimal gaps of 3 or 4 digits
 {{convert/gaps}}  convert an amount to show 3digit gaps, with decimal gaps