Template:Ref/doc

From Wikipedia, the free encyclopedia

This is a documentation subpage for Template:Ref (see that page for the template itself).
It contains usage information, categories and other content that is not part of the original template page.

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.

Contents

[edit] Alternative referencing style

The Cite.php <ref> and <references/> system is an alternative style of referencing to the templates discussed on this page. For details on this system, please see Wikipedia:Footnotes and Wikipedia:Cite sources.

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

[edit] Usage

For multiple links to one citation in the Reference section, use different id values ("a", "b", etc.), beginning with the first citation. The "id" is used to make multiple backlinks from the note.

[edit] Ref-family templates and Links

The {{ref}} family of templates is used to place links into an article. Each link is identified with a reference_name parameter which is used to generate an invisible name to link it with a matching {{note}} template sharing that invisible name. {{note}} templates are usually located just prior to a footnote or other referenced item. It is sometimes useful to use {{ref}} templates more than once with the same reference_name. Whenever that is done, an optional parameter noid=noid should be specified, in exactly that form. The backlink supplied by the matching {{note}} template will be paired with the {{ref}} template instance with the matching reference-name parameter and in which the optional noid=noid parameter was not supplied.

[edit] Simple

fuu{{ref|reference_name_A}}
fuu{{ref|reference_name_B}}
fuu{{ref|reference_name_B|noid=noid}}
fuu{{ref|reference_name_C|label}}
fuu{{ref|reference_name_C|label|noid=noid}}

This creates simple links to three separate footnotes, with "reference_name_A", etc. being unique invisible names which are used to create a clickable link to a matching {{note}} template placed at the footnote locations. The backlink from the {{Note}} template at the footnote location would pair with the {{ref}} template for which the noid=noid parameter was not supplied. A superscripted clickable link surrounded by square brackets is generated. If supplied, the optional second parameter is used to label the clickable link.

fuu[1]
fuu[2]
fuu[3]
fuulabel
fuulabel

[edit] Complex

There are three complex Ref-family templates: {{ref label}}, {{ref harvard}} and {{ref harv}}. These all pair up with a matching {{note label}} template. All of these, and the matching {{note label}} template have three required parameters: reference_name, label, and id. The invisible name used to link these templates to the matching {{note label}} template is formed by concatenating the first and third parameters (i.e., "referencenameid"). If a particular reference_name and id parameter pair is used more than once, the optional noid=noid parameter should be supplied in all but one instance.

[edit] Ref label

{{ref label}} displays the clickable link using the label parameter, surrounded by square-brackets and superscripted.

fuu{{ref label|reference_name_D|label|id}}
fuu[label]

[edit] Harvard

{{ref harvard}} displays the clickable link using the label parameter, surrounded by parentheses but not superscripted. {{ref harv}} displays the clickable link using the 'label parameter, surrounded by parentheses and superscripted.

fuu{{ref harvard|reference_name_E|Harvard reference|id_1}}
fuu{{ref harv|reference_name_E|Harvard reference|id_2}}
fuu{{ref harv|reference_name_E|Harvard reference|id_2|noid=noid}}
fuu(Harvard reference)
fuu(Harvard reference)
fuu(Harvard reference)

[edit] Note templates and backlinks

There are two Note-family templates: {{note}} and {{note label}}. These templates are usually placed just prior to the location of a footnote or other item referenced in the text by matching {{ref}} family templates. The parameters in these templates match the parameters in the {{ref}}, and it is often convenient to copy a particular {{ref}} template instance to the {{note}} location, and change the name of the copied template from ref to note or from ref (whatever) to note label . Any parameters which are not required by {{note}} templates are ignored if supplied.

[edit] Simple

*{{note|reference_name_A}}bar
*{{note|reference_name_C|label}}bar


Creates a simple footnote for the reference with the invisible unique id reference_name and generates a clickable backlink to the {{ref}} template with the matching reference_name and in which the noid=noid is not specified.

[edit] Complex

*{{note label|reference_name|number|id}}bar

Creates a clickable link labeled with the id parameter, and paired with the {{ref label}} instance which has matching reference_name and id parameters. The label parameter is not used and is ignored.

A footnote which is cited from multiple locations in the text might have multiple {{note label}} instances associated with it.

*{{note label|Smith2000|Smith 2000:12|a}}{{note label|Smith2000|Smith 2000:45:|b}} Smith (2000), "A book about yammering".

which could produce something like

  • a b  Smith (2000), "A book about yammering".

[edit] Examples

[edit] Combining Ref and Note 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.<ref name=smith2000>Smith wrote the definitive book on yammering.{{ref|Smith2000|Smith 2000}}
</ref>Yammer yammer yammer.<ref name=smith2000/>
...
==References==
<References/>
...
==Bibliography==
*{{note|Smith2000}}, Smith 2000, "A book about yammering".

which could produce something like:

Yammer yammer yammer.[1]Yammer yammer yammer.[1]
...
==References==
  1. ^ a b Smith wrote the definitive book on yammering.Smith 2000
...
==Bibliography==
  • ^ , Smith 2000, "A book about yammering".

Also see examples and explanation in Wikipedia:Footnote3.

[edit] Table footnotes

One common application for {{ref}} and {{notes}} templates is in placing footnotes below tables, as in the following example taken from Kent#Economy:

Year Regional GVA[A] Agriculture Industry[B] Services[C]
County of Kent (excluding Medway)
1995 12,369 379 3.1% 3,886 31.4% 8,104 65.5%
2000 15,259 259 1.7% 4,601 30.2% 10,399 68.1%
2003 18,126 287 1.6% 5,057 27.9% 12,783 70.5%
Medway
1995 1,823 21 3.1% 560 31.4% 1,243 68.2%
2000 2,348 8 1.7% 745 30.2% 1,595 67.9%
2003 2,671 10 1.6% 802 27.9% 1,859 69.6%
A  Components may not sum to totals due to rounding
B  includes energy and construction
C  includes financial intermediation services indirectly measured

[edit] Further examples

The following examples from {{Ref/examples}} are rendered as a template in the following table:

What to type What it makes

Linking and footnote templates

Tags attached to links in text area:

  • "{{ref}} example{{ref|reference1}}" — Links to a citation in the Reference section labeled "reference1".
  • "Deprecated {{ref num}} example{{ref num|reference1|1}}" — Links to a citation in the Reference section labeled "reference1", but marked in the text with the number "1" instead of an automatically generated number. NOTE: {{ref num}} is deprecated. {{ref label}} should be used instead.
  • "{{ref label}} example{{ref label|example.com|2|none}}" — Links to a citation in the Reference section labeled "example.com". Text is marked with the number "2".

For two links to the same footnote labeled "example.com", you would:

  • "{{ref label}} example{{ref label|example.com|3|a}}"
  • "{{ref label}} example{{ref label|example.com|3|b}}"
  • "{{ref label}} example{{ref label|nextexample.com|4|4}}"
  • "{{ref harvard}} example {{ref harvard|lastexample.com|Jones 1999|none}}" — Links to a citation in the Reference section labeled "lastexample.comnone", and marked in the text with (Jones 1999).
  • "{{ref harv}} example {{ref harv|lastexample.com|Jones 1999|none}}" — Links to a citation in the Reference section labeled "lastexample.comnone", and marked in the text with (Jones 1999).
  • "{{ref harvard}} example {{ref harvard|finalexample.com|Smith 2000|a}}(a)"
  • "{{ref harv}} example {{ref harv|finalexample.com|Smith 2000|a}}(a)"
  • "{{ref harvard}} example {{ref harvard|finalexample.com|Smith 2000|b}}(b)"
  • "{{ref harv}} example {{ref harv|finalexample.com|Smith 2000|b}}(b)"

Tags attached to links in References or Footnote section:

"#{{note|reference1}} example of {{note}}" — In References section, citation labeled "reference1".

"#{{note label|example.com|2|none}}"— In References section, citation labeled "example.comnone". Creates backlink to matching {{ref label}} entry in the text labeled "example.comnone".

Now, if you have two links to the same footnote labeled "example.com", you would do:

"#{{note label|example.com|3|a}}{{note label|example.com|3|b}} example of {{note label}}"

"{{note label|nextexample.com|4|4}} example of {{note label}}"

  • "{{note label|lastexample.com|Jones 1999|none}}Jones (1999) {{note label}}" -- Note that when the 3rd unnamed parameter is specified as "none", the ^ symbol is rendered for the backlink.
  • "{{note label|finalexample.com|Smith 2000|a}}{{note label|finalexample.com|Smith 2000|b}}Smith (2000)"


In text area:


In References or Footnote section:

  1. ^  example of {{note}}
  2. ^  example of {{note label}}
  3. a b  example of {{note label}}

4  example of {{note label}}


Also see examples and explanation in Wikipedia:Footnote3.


[edit] Instructions

In an article, a reference link to supporting material can be made with the {{ref}} template, such as this[5]. (Note the link to the reference's footnote; at present it appears as a small number.)

A significant advantage of using this method is that the reference contains a named link which allows recovery from various edit problems. Otherwise, connections to references can be lost if only numbers are used and editors alter footnote numbers.

  • For multiple references to the same work it is suggested that the page number be used to make each reference unique, i.e. {{ref|Jones1954a-25}}.
  • For journal articles it is suggested a reference similar to AuthorYear be used, i.e. {{ref|Jones1954a}}.
  • Instructions for adding a citations using these templates:
Footnotes use names, not numbers. Please see Wikipedia:Footnote3 for details.
1) Assign your footnote a unique name, for example "TheSun_Dec9".
2) Add the template {{ref|TheSun_Dec9}} to the body of the article where you want the new footnote.
3) Take note of the name of the footnote that immediately proceeds yours in the article body.
4) Add #{{Note|TheSun_Dec9}} to the reference list, immediately below the footnote you noted in step 3.
5) Multiple sources in the text pointing to the same reference will not work: each source must have uniquely-named notes in the References section.
It is important to add the citations in the right order in the Reference (or Notes) list.

[edit] References (example for Notes)

  1. (used earlier)
  2. ^  This is a footnote with supporting material to the above reference. This footnote is created with the template syntax: {{note|ref_example}}. The {{note}} template presently creates a small symbol ("^") that contains a link back up to the source in the text. Readers thus have links back and forth within the text. The number at the beginning of this line was created with the Wiki notation # placed at the beginning of the line, which only displays a numbered list. The matching number is not necessary, and Wikipedia:Cite sources suggests using the bulleted list notation: *

[edit] See also