Template:NumBlk

维基百科,自由的百科全书
文档图示 模板文档[查看] [编辑] [历史] [清除缓存]

此模板用于编号数学公式。可和{{EquationRef}}同时使用,用于加入来源引用。

参数

参数 {{{1}}}, {{{2}}}, 和 {{{3}}} 是必须的。另外还有可选参数 {{{RawN}}} 、 {{{LnSty}}} 和 {{{Border}}}。

  • {{{1}}}: 设置缩进。使用冒号(:)。
  • {{{2}}}: 内容。
  • {{{3}}}: 编号。
  • {{{RawN}}}: 赋给一个非空字符串,移除编号和括号的格式。
  • {{{LnSty}}}: 设置线格式。
  • {{{Border}}}: 边框。

示例

可生成HTML的公式

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

缩进

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

(3.5)

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

(1)

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

(13.7)

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

(1.2)

公式编号格式

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

3.5

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

<3.5>

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

[3.5]

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

[3.5]

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

([3.5])

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

[3.5]

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

线样式

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

(3.5)

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

(3.5)

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

[3.5]

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

[3.5]

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

[3.5]

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

[3.5]

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

[3.5]

边框

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

(Eq. 3)

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 {{clear}}-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=.}}
Fig.1: Bayesian Network representation of Eq.(6)
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.

,

Eq.(6)

If it is desirable for the numbered block to span the entire line, a {{clear}} 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=.}}
Fig.1: Bayesian Network representation of Eq.(6)
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.

,

Eq.(6)

Table caveat

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> and </dd></dl> tags for indentation instead of a leading colon (:).

For example,

<dl><dd>
{|
|<math>(f * g)[n]\,</math>      
|{{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>       ([[Convolution#Commutativity|commutativity]])
|}
</dd></dl>

produces

     

(Eq.1)
      (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.

(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 (::).