Template:Ref/doc

Ref-family templates
The ref family of templates is used to place labeled references and notes and references into an article, with the labels normally being clickable links for navigating from a ref to a corresponding note and back from the note to the ref. The links and backlinks are identified internally by combining the specified parameters. The templates take a variable number of unnamed parameters identified by their position and, optionally, a named parameter named noid which, if used, should be set by specifying it as "noid=noid".

Very simple example
{| class=wikitable !Article !Wikitext Text that requires a footnote.

Labels must be unique
A common error when using ref is to use it multiple times with the same label. For example:

Text that requires a footnote. Some other text that requires the same footnote.

Simple examples
ref and note

Example:  Article text more text more text.
 * Bulleted text
 * Bulleted text.
 * intervening text
 * Text for note a.
 * Text for note b.
 * Text for note a.
 * Text for note b.

This would produce: Article text more text more text.
 * Bulleted text
 * Bulleted text.
 * intervening text
 * Text for note a.
 * Text for note b.
 * Text for note a.
 * Text for note b.

Notice that the navigation back from the note to the ref does not work by clicking the backlink for refs which specify "noid=noid". In practice, if "noid=noid" is specified, it is usually specified for all refs having identical unnamed parameters, and navigation back to the associated ref is done by using the browser's "Back" button.

Also notice that browsers which support highlighting of link-accessed material highlight the active backlink by default, and that the highlighting has been extended to encompass the text for note c by specifying that text as a final template parameter instead of placing it outside of the template.

More complex examples
ref label, ref harv and ref harvard: these all pair with note label. These three complex ref family templates display differently but work the same. The note label template will normally have identical parameters with the ref template with which it is paired, and is normally created by copying the ref, pasting it into the note location, and changing its name to "note label"; this avoids having parameters mismatched because of a typo. Navigation forward uses parameters 1 and 3, navigation backward uses parameters 1 and 2. Parameter 3 is optional, and note label has an optional fourth parameter.

Example:  Article text more text more text more text  more text  more text  more text  more text.
 * intervening text
 * Text of note for ref a.
 * Text of note for ref b.
 * Text of note for ref c.
 * Text of note for ref d.
 * Text of note for ref e.
 * Text of note for ref f.
 * Text of note for ref e.
 * Text of note for ref f.

This would produce: Article text more text more text more text  more text  more text  more text  more text.
 * intervening text
 * Text of note for ref a.
 * Text of note for ref b.
 * Text of note for ref c.
 * Text of note for ref d.
 * Text of note for ref e.
 * Text of note for ref f.
 * Text of note for ref e.
 * Text of note for ref f.
 * 1) This shows the different styles for the ref links; ref harvard produces a parenthesized link, ref harv produces a superscripted parenthesized link, and ref label produces a superscripted link with square brackets.
 * 2) The note for ref e has a "^" character as its backlink, because parameter 3 was specified as "none".
 * 3) The notes for refs f and g do not have a clickable backlink, because parameter 3 was not specified.

Notice that, because the notes for refs g and h above use the same text, note h was made a part of the text passed as a final parameter to note g in order for the extended highlighting to cover both notes.

Table footnotes
One common application for ref and note templates is in placing footnotes below tables, as in the following example taken from the Kent article:

To allow the preview,  is used. to form the needed list.

  Components may not sum to totals due to rounding  includes energy and construction  includes financial intermediation services indirectly measured 

Alternative referencing style
Using ref/note tags is not the only way to do footnotes. Some people prefer to use Cite.php. Cite.php has many advantages, but is not mandatory. You can use the Ref converter to replace ref/note tags with the newer Cite.php style. If you are interested in the discussion, please see the Footnotes talk page. For details of that system, please see Footnotes.

Combining Ref family templates with the alternative referencing style
An example combining the use of Ref-family templates with the alternative referencing style might be something like

 Yammer yammer yammer. Yammer yammer yammer. ...

Third party tool
A third-party tool to translate articles using the templates described on this page into the Cite.php system is available, see Ref converter.