Template:Numbered block 2
This template is {{Numbered block}}'s wrapper template. Roughly speaking, this template can be thought of as a combination of {{Numbered block}} and {{EquationRef}}. Therefore, in general, this template can be used directly with {{EquationNote}} and avoids the use of {{EquationRef}}.
This template provides destination highlighting similar to {{Visible anchor}}—by specifying id
attribute to make the entire {{Numbered block 2}} template an HTML anchor, that is, a target that can be linked to. When clicking on a self-link displayed to the right of the {{Numbered block 2}} template or links elsewhere pointing to the {{Numbered block 2}} template (for example, [[#id|...]]
), the background color of the {{Numbered block 2}} template will change, visually highlighting the entire template.
Warning: Since this template is a wrapper template for {{Numbered block}}, lint errors may result when it is used with leading colons :
, leading asterisks *
, or leading hash symbols #
. For more information, see the warning for {{Numbered block}}.
Parameters
[edit]Parameters |1=
, |2=
, and |3=
of this template are required. In addition, there are nine optional parameters |Id=
, |IdPfx=
, |IdSfx=
, |Lbl=
, |Attr=
, |RawN=
, |LnSty=
, |Border=
and |Cl=
.
|3=
- This parameter is used as the basis for determining the
id
attribute and label by default. See the descriptions of|IdSfx=
and|Lbl=
.
- This parameter is used as the basis for determining the
|Id=
- Specify the
id
attribute of the template. The default value of this parameter is the string obtained by concatenating the value of|IdPfx=
and the value of|IdSfx=
in that order. Theid
attribute must be unique in an HTML document.
- Specify the
|IdPfx=
: Specify the default prefix for theid
attribute. Default ismath_
.|IdSfx=
: Specify the default suffix for theid
attribute. Default is the value of|3=
.|Lbl=
- Specify the label, which is the content to be displayed in the self-link on the right side of the template. Default is the value of
|3=
.
- Specify the label, which is the content to be displayed in the self-link on the right side of the template. Default is the value of
|Attr=
- The default value is some appropriate attribute settings to make the template comply with the description of this document. It is not recommended that ordinary users assign values to this parameter and overwrite the default value.
The meanings of parameters |1=
, |2=
, |RawN=
, |Cl=
, |LnSty=
and |Border=
remain basically unchanged. Please refer to the description of {{Numbered block}}, which will not be repeated here.
Examples
[edit]This section's examples will include both the original {{Numbered block}} and rewritten versions using {{Numbered block 2}} for comparison. Links to the {{Numbered block}} and {{Numbered block 2}} examples may also be provided.
Remark: The numbering may be modified and different from the numbering in the source to ensure that the id
attributes are unique. The original template names may be replaced with clearer names.
Example 1
[edit]This example contains a comparison between the following two approaches:
- {{Numbered block}} + {{EquationRef}} + {{EquationNote}}
- {{Numbered block 2}} + {{EquationNote}}
Numbered block
[edit]{{Numbered block|:|<math>\Delta E = W + Q + E_\text{matter} .</math>|{{EquationRef|1A}}}}
1A |
Numbered block 2
[edit]{{Numbered block 2|:|<math>\Delta E = W + Q + E_\text{matter} .</math>|1B}}
1B |
You can see that the rendered {{Numbered block 2}} has a label on the right that is a self-link displayed as number (1B).
Because |Id=
, |IdPfx=
and |IdSfx=
are not assigned values, their values are all default values. The default value of |IdPfx=
is math_
, the default value of |IdSfx=
is the value of |3=
, which is 1B
, and the default value of |Id=
is the concatenation of the values of |IdPfx=
and |IdSfx=
, which is math_1B
, so the id
attribute of the rendered {{Numbered block 2}} here is math_1B
.
Links
[edit]We can use {{EquationNote}} or directly use [[#id|...] ]
to link to the template.
- 1A
- 1B
Example 2
[edit]Numbered block
[edit]{{Numbered block|:|<math>F_\text{net} = F_\text{external} - F_\text{friction}</math>|<math>(\text{2A})</math>|RawN=y}}
Numbered block 2
[edit]{{Numbered block 2|:|<math>F_\text{net} = F_\text{external} - F_\text{friction}</math>|(no effect)|RawN=y|IdSfx=2B|Lbl=<math>(\text{2B})</math>}}
In the example above, the number (label) on the right is still a clickable link. In fact, the following examples demonstrate that nearly identical results can be achieved using different parameter settings:
{{Numbered block 2|:|<math>F_\text{net} = F_\text{external} - F_\text{friction}</math>|2C|RawN=y|Lbl=<math>(\text{2C})</math>}}
{{Numbered block 2|:|<math>F_\text{net} = F_\text{external} - F_\text{friction}</math>|<math>(\text{2D})</math>|RawN=y|IdSfx=2D}}
{{Numbered block 2|:|<math>F_\text{net} = F_\text{external} - F_\text{friction}</math>|<math>(\text{2E})</math>|RawN=y|Id=math_2E}}
Links
[edit]- (2A) does not use {{EquationRef}} and cannot be linked.
{{EquationNote|2B}}
produces 2B.[[#math_2B|2B]]
produces 2B.{{EquationNote|2C}}
produces 2C.[[#math_2C|2C]]
produces 2C.{{EquationNote|2D}}
produces 2D.[[#math_2D|2D]]
produces 2D.{{EquationNote|2E}}
produces 2E.[[#math_2E|2E]]
produces 2E.
Example 3
[edit]Numbered block
[edit]{{Numbered block|:|<chem>CO2(aq) + H2O -> H2CO3</chem>|{{EquationRef|3A}}}}
3A |
Numbered block 2
[edit]{{Numbered block 2|:|<chem>CO2(aq) + H2O -> H2CO3</chem>|3B|IdPfx=chem-}}
3B |
Because we are numbering a chemical formula rather than a mathematical formula, we can use the more appropriate id
attribute prefix chem-
instead of the original math_
. This can be achieved by assigning appropriate values to |IdPfx=
.