Jump to content

Template:NumBlk/doc

From Wikisource

This template creates a numbered block which is usually used to number mathematical formulae. This template can be used together with {{EquationRef}} and {{EquationNote}} to produce nicely formatted numbered equations if a back reference to an equation is wanted.

Parameters

[edit]

Command: {{NumBlk|<1>|<2>|<3>|RawN=<>|LnSty=<>|Border=<>}}

Parameters {{{1}}}, {{{2}}}, and {{{3}}} of this template are required. In addition, there are three optional parameters {{{RawN}}}, {{{LnSty}}} and {{{Border}}}.

{{{1}}}: Specify indentation. The more colons (:) you put, the further indented the block will be, up to a limit of 20. This parameter can be empty if no indentation is needed.
{{{2}}}: The body or content of the block.
{{{3}}}: Specify the block number.
{{{RawN}}}: If a non-empty non-whitespace value, no extra formatting will be applied to the block number.
{{{LnSty}}}: Specify the line style.
{{{Border}}}: If set, put a box around the equation. (Experimental.)

Examples

[edit]

Equations may render HTML

[edit]

{{NumBlk|:|<math>y=ax+b</math>|Eq. 3}}

 

 

 

 

(Eq. 3)

{{NumBlk|:|<math>ax^2+bx+c=0</math>|Eq. 3}}

 

 

 

 

(Eq. 3)

{{NumBlk|:|<math>\Psi(x_1,x_2)=U(x_1)V(x_2)</math>|2}}

 

 

 

 

(2)

Indentation

[edit]

{{NumBlk||<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3.5}}

 

 

 

 

(3.5)

{{NumBlk|:|<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|1}}

 

 

 

 

(1)

{{NumBlk|::|<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|13.7}}

 

 

 

 

(13.7)

{{NumBlk|:::|<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|1.2}}

 

 

 

 

(1.2)

Formatting of equation number

[edit]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=3.5|RawN=.}}

 

 

 

 

3.5

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<3.5>|RawN=.}}

 

 

 

 

<3.5>

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=[3.5]|RawN=.}}

 

 

 

 

[3.5]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3='''[3.5]'''|RawN=.}}

 

 

 

 

[3.5]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''[3.5]'''</Big>}}

 

 

 

 

([3.5])

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''[3.5]'''</Big>|RawN=.}}

 

 

 

 

[3.5]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<math>(3.5)</math>|RawN=.}}

 

 

 

 

Line style

[edit]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''(3.5)'''</Big>|RawN=.|LnSty=1px dashed red}}

 

 

 

 

(3.5)

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''(3.5)'''</Big>|RawN=.|LnSty=3px dashed #0a7392}}

 

 

 

 

(3.5)

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''[3.5]'''</Big>|RawN=.|LnSty=3px solid green}}

 

 

 

 

[3.5]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''[3.5]'''</Big>|RawN=.|LnSty=5px dotted blue}}

 

 

 

 

[3.5]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''[3.5]'''</Big>|RawN=.|LnSty=0px solid green}}

 

 

 

 

[3.5]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''[3.5]'''</Big>|RawN=.|LnSty=5px none green}}

 

 

 

 

[3.5]

{{NumBlk|1=:|2=<math>\mathbf{a}(t)=\frac{d}{dt}\mathbf{v}(t)</math>|3=<Big>'''[3.5]'''</Big>|RawN=.|LnSty=3px double green}}

 

 

 

 

[3.5]

Border

[edit]

{{NumBlk|:|<math>y=ax+b</math>|Eq. 3|Border=1}}

 

 

 

 

(Eq. 3)

Positioning relative to surrounding images

[edit]

Numbered blocks should be able to be placed around images that take up space on the left or right side of the screen. To ensure numbered block has access to the entire line, consider using a {{clear}}-like template.

To illustrate, consider the example: Template:Markupv

If it is desirable for the numbered block to span the entire line, a {{clear}} should be placed before it. Template:Markupv

Table caveat

[edit]

Because {{NumBlk}} is implemented as a table, putting {{NumBlk}} within a table yields a nested table. Due to a bug in MediaWiki's handling of nested tables, {{NumBlk}} must be used carefully in this case. In particular, when indentation for the outer table is desired, use explicit <dl><dd>...</dd></dl> tags for indentation instead of a leading colon (:).

For example, Template:Markupv which shows how the outer <dl><dd>...</dd></dl> tags give the same indentation as a single colon (:) preceding the table should.

For another example,

Markup
<dl><dd>
<dl><dd>
{|
|-
|The first parameter for indentation still works when used inside table.
{{NumBlk|::::|<math>ax^2+bx+c=0</math>|Level 4}}
{{NumBlk|:::|<math>ax^2+bx+c=0</math>|Level 3}}
{{NumBlk|::|<math>ax^2+bx+c=0</math>|Level 2}}
{{NumBlk|:|<math>ax^2+bx+c=0</math>|Level 1}}
{{NumBlk||<math>ax^2+bx+c=0</math>|Level 0}}
|-
|}
</dd></dl>
</dd></dl>
Renders as
The first parameter for indentation still works when used inside table.

 

 

 

 

(Level 4)

 

 

 

 

(Level 3)

 

 

 

 

(Level 2)

 

 

 

 

(Level 1)

 

 

 

 

(Level 0)

which uses two sets of explicit tags to give the same indentation as two colons (::).