Template:Infobox settlement/densdisp/doc

This subtemplate of Infobox settlement displays a metric/imperial pair of population density values for a line in the main infobox.

Examples of density as auto
As shown in the following examples, this template calculates the density if all three of the following conditions are met: /km2 (or /sqmi) is set to auto, a number if given for population, and a number is given for area. It also strips any formatting from the numbers, such as population with commas in the examples, which would otherwise cause an error in the calculation (see mw:Help:Magic words).

Examples of missing population or area
As shown in the following examples, this template outputs nothing if density = auto, but either population or area is missing.

Examples of density as number
As shown in the following examples, this template always displays the density if given as a number, regardless of whether the population and area are defined. It also strips any formatting in the number, such as the commas in the examples.