Template:NumBlk/doc

From Quantum kot
< Template:NumBlk
Revision as of 06:46, 28 February 2016 by imported>Eugene (Created page with "This template creates a numbered block which is usually used to number mathematical formulae. This template can be used together with {{tl|EquationRef}} and {{tl|EquationNote}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Parameters

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}}}: Assigned with a non-empty or non-whitespaced string to remove the formatting on the number and the parentheses surrounding the number.
{{{LnSty}}}: Specify the line style.
{{{Border}}}: If set, put a box around the equation. (Experimental.)


Examples

Equations may render HTML

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): y=ax+b

 

 

 

 

(Eq. 3)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): ax^2+bx+c=0

 

 

 

 

(Eq. 3)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \Psi(x_1,x_2)=U(x_1)V(x_2)

 

 

 

 

(2)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Indentation

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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

(3.5)

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

(1)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=::}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

(13.7)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=::}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:::}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

(1.2)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:::}}}}

Formatting of equation number

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

3.5

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

<3.5>

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

[3.5]

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

[3.5]

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

([3.5])

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

[3.5]

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): (3.5) \,

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Line style

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

(3.5)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

(3.5)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

[3.5]

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

[3.5]

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

[3.5]

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

[3.5]

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \bold{a}(t)=\frac{d}{dt}\bold{v}(t)

 

 

 

 

[3.5]

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Border

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

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): y=ax+b

 

 

 

 

(Eq. 3)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Positioning relative to surrounding images

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 Template:Tl-like template.

To illustrate, consider the example:

[[Image:Bnet_fan2.png|frame|right|Fig.1: Bayesian Network representation of Eq.(6)]]
[[Image:Bnet_fan2.png|frame|left|Fig.1: Bayesian Network representation of Eq.(6)]]
<br><br>A Bayesian network (or a belief network) is a probabilistic graphical model that represents a set of
variables and their probabilistic independencies. For example, a Bayesian network could represent the
probabilistic relationships between diseases and symptoms. Given symptoms, the network can be used to compute
the probabilities of the presence of various diseases.
{{NumBlk|1=:|2=<math>
P(a, b, \lambda) = P(a| \lambda) P(b | \lambda) P(\lambda)\,
</math>,|3='''Eq.(6)'''|RawN=.}}
File:Bnet fan2.png
Fig.1: Bayesian Network representation of Eq.(6)
File:Bnet fan2.png
Fig.1: Bayesian Network representation of Eq.(6)



A Bayesian network (or a belief network) is a probabilistic graphical model that represents a set of variables and their probabilistic independencies. For example, a Bayesian network could represent the probabilistic relationships between diseases and symptoms. Given symptoms, the network can be used to compute the probabilities of the presence of various diseases.

{{#invoke:String|rep|

|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): P(a, b, \lambda) = P(a| \lambda) P(b | \lambda) P(\lambda)\, ,

 

 

 

 

Eq.(6)

{{#invoke:String|rep|

|{{safesubst:#invoke:String|len|s=:}}}}

Template:Clear If it is desirable for the numbered block to span the entire line, a Template:Tl should be placed before it.

[[Image:Bnet_fan2.png|frame|right|Fig.1: Bayesian Network representation of Eq.(6)]]
[[Image:Bnet_fan2.png|frame|left|Fig.1: Bayesian Network representation of Eq.(6)]]
<br><br>A Bayesian network (or a belief network) is a probabilistic graphical model that represents a set of
variables and their probabilistic independencies. For example, a Bayesian network could represent the
probabilistic relationships between diseases and symptoms. Given symptoms, the network can be used to compute
the probabilities of the presence of various diseases.
{{clear}}
{{NumBlk|1=:|2=<math>
P(a, b, \lambda) = P(a| \lambda) P(b | \lambda) P(\lambda)\,
</math>,|3='''Eq.(6)'''|RawN=.}}
File:Bnet fan2.png
Fig.1: Bayesian Network representation of Eq.(6)
File:Bnet fan2.png
Fig.1: Bayesian Network representation of Eq.(6)



A Bayesian network (or a belief network) is a probabilistic graphical model that represents a set of variables and their probabilistic independencies. For example, a Bayesian network could represent the probabilistic relationships between diseases and symptoms. Given symptoms, the network can be used to compute the probabilities of the presence of various diseases. Template:Clear

{{#invoke:String|rep|

|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): P(a, b, \lambda) = P(a| \lambda) P(b | \lambda) P(\lambda)\, ,

 

 

 

 

Eq.(6)

{{#invoke:String|rep|

|{{safesubst:#invoke:String|len|s=:}}}}

Template:Clear

Table caveat

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

For example,

<dl><dd>
{|
|<math>(f * g)[n]\,</math>&nbsp; &nbsp; &nbsp; 
|{{NumBlk||<math>\stackrel{\mathrm{def}}{=}\sum_{m=-\infty}^{\infty} f[m]\cdot g[n - m]\,</math>|
3=<span style="color:darkred">'''(Eq.1)'''</span>|RawN=.}}
|-
|
|<math>= \sum_{m=-\infty}^{\infty} f[n-m]\cdot g[m].\,</math> &nbsp; &nbsp; &nbsp; ([[Convolution#Commutativity|commutativity]])
|}
</dd></dl>

produces

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): (f * g)[n]\,

     

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \stackrel{\mathrm{def}}{=}\sum_{m=-\infty}^{\infty} f[m]\cdot g[n - m]\,

 

 

 

 

(Eq.1)

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): = \sum_{m=-\infty}^{\infty} f[n-m]\cdot g[m].\,
      (commutativity)

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

For another example,

<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>

produces

The first parameter for indentation still works when used inside table. {{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=::::}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): ax^2+bx+c=0

 

 

 

 

(Level 4)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=::::}}}} {{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:::}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): ax^2+bx+c=0

 

 

 

 

(Level 3)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:::}}}} {{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=::}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): ax^2+bx+c=0

 

 

 

 

(Level 2)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=::}}}} {{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): ax^2+bx+c=0

 

 

 

 

(Level 1)

{{#invoke:String|rep|
|{{safesubst:#invoke:String|len|s=:}}}}

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): ax^2+bx+c=0

 

 

 

 

(Level 0)

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