Difference between revisions of "Template:EquationRef"

From blackwiki
Jump to navigation Jump to search
imported>TedPavlic
(Added other examples showing second argument to both Ref and Note. Also tried to remove more space.)
Line 1: Line 1:
<includeonly><cite {{#ifeq:{{{noid}}}|noid||id="math_{{{1}}}"}}><span class="reference plainlinksneverexpand">'''{{#if: {{{2| }}}|[[#equation_{{{1}}}|{{{2}}}]]|[[#equation_{{{1}}}|{{{1}}}]]}}'''</span></cite></includeonly><noinclude>
+
<includeonly><cite {{#ifeq:{{{noid}}}|noid||id="math_{{{1}}}"}}><span class="reference plainlinksneverexpand">'''{{#if: {{{2| }}}|[[#equation_{{{1}}}|{{{2}}}]]|[[#equation_{{{1}}}|{{{1}}}]]}}'''</span></cite></includeonly><noinclude>{{documentation|content=
 
The pair of templates {{tl|EquationRef}} and {{tl|EquationNote}} is used for labeling equations in text.
 
The pair of templates {{tl|EquationRef}} and {{tl|EquationNote}} is used for labeling equations in text.
  
Line 30: Line 30:
 
:which may be referred to by '''<nowiki>{{EquationNote|Eq.5}}</nowiki>''' (i.e., {{EquationNote|Eq.5}}).
 
:which may be referred to by '''<nowiki>{{EquationNote|Eq.5}}</nowiki>''' (i.e., {{EquationNote|Eq.5}}).
  
</noinclude>
+
[[Category:Mathematics templates]]
 +
}}</noinclude>

Revision as of 19:54, 24 May 2012

50px Template documentation

The pair of templates {{EquationRef}} and {{EquationNote}} is used for labeling equations in text.

For example, :{{EquationRef|Eq. 1}} <math>x^2+x+1=0</math> results in:

Eq. 1 <math>x^2+x+1=0</math>

Here, the identifier "Eq. 1" is a label which can be later referred to with a call to {{EquationNote}}. That is, {{EquationNote|Eq. 1}} produces a link Eq. 1 to this equation.

Similarly, :{{EquationRef|2|Eq. 2:}} <math>x^2-2x+1=0</math> results in

Eq. 2: <math>x^2-2x+1=0</math>

which can be referred to by {{EquationNote|2}} (i.e., 2) or even {{EquationNote|2|Equation 2}} (i.e., Equation 2).

This template can be used together with {{NumBlk}} to produce nicely formatted numbered equations. For instance:

  • {{NumBlk|::|<math>x^2+x+1=0</math>|{{EquationRef|3}}}} gives

Template:NumBlk

which may then be referred to by {{EquationNote|3}} (i.e., 3) or even {{EquationNote|3|Eq. 3}} (i.e., Eq. 3).
  • {{NumBlk|::|<math>x^2+x+1=0</math>|{{EquationRef|4|Eq.4}}}} gives

Template:NumBlk

which may be referred to by {{EquationNote|4}} (i.e., 4).
  • {{NumBlk|::|<math>x^2+x+1=0</math>|{{EquationRef|Eq.5}}}} gives

Template:NumBlk

which may be referred to by {{EquationNote|Eq.5}} (i.e., Eq.5).