Template:SfnRef/doc: Difference between revisions
m (1 revision imported) |
(→See also: lower case for consistency) |
||
Line 3: | Line 3: | ||
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | ||
Generate an identifier suitable as an [[Template:Citation/doc #Anchors for Harvard referencing templates|anchor for a Harvard citation]]. This template, which can be used with either the name {{tlc|SfnRef}} or the name {{tlc|harvid}}, is intended to be paired with Harvard citation templates such as {{tl|Sfn}}, {{tl|harv}}, and {{tl|harvnb}}. This | Generate an identifier suitable as an [[Template:Citation/doc #Anchors for Harvard referencing templates|anchor for a Harvard citation]]. This template, which can be used with either the name {{tlc|SfnRef}} or the name {{tlc|harvid}}, is intended to be paired with Harvard citation templates such as {{tl|Sfn}}, {{tl|harv}}, and {{tl|harvnb}}. This template uses the same arguments as the other citation templates. As explained below, this template is needed only in some cases when the Harvard citation templates are used. | ||
== Usage == | == Usage == | ||
Line 46: | Line 46: | ||
For example, a ''References'' section might contain the following markup: | For example, a ''References'' section might contain the following markup: | ||
: <code><nowiki>{{</nowiki>[[Template:vcite journal|vcite journal]]<nowiki> |author=Peh WC, Ng KH |title=Preparing the references |journal=Singapore Med J |volume=50 |issue=7 |pages= | : <code><nowiki>{{</nowiki>[[Template:vcite journal|vcite journal]]<nowiki> |author=Peh WC, Ng KH |title=Preparing the references |journal=Singapore Med J |volume=50 |issue=7 |pages=659–661 |year=2009 |pmid=19644619 |url=http://smj.sma.org.sg/5007/5007emw1.pdf |format=PDF |ref={{harvid|Peh|Ng|2009}} }}</nowiki></code> | ||
This markup uses <code><nowiki>{{harvid|Peh|Ng|2009}}</nowiki></code> to generate the anchor identifier "{{harvid|Peh|Ng|2009}}", used internally to link Harvard references to citations. (This identifier is not visible to the article's reader.) The generated citation looks like this: | This markup uses <code><nowiki>{{harvid|Peh|Ng|2009}}</nowiki></code> to generate the anchor identifier "{{harvid|Peh|Ng|2009}}", used internally to link Harvard references to citations. (This identifier is not visible to the article's reader.) The generated citation looks like this: | ||
: {{vcite journal |author=Peh WC, Ng KH |title=Preparing the references |journal=Singapore Med J |volume=50 |issue=7 |pages= | : {{vcite journal |author=Peh WC, Ng KH |title=Preparing the references |journal=Singapore Med J |volume=50 |issue=7 |pages=659–661 |year=2009 |pmid=19644619 |url=http://smj.sma.org.sg/5007/5007emw1.pdf |format=PDF |ref={{harvid|Peh|Ng|2009}} }} | ||
Article prose can link to this citation with markup like the following: | Article prose can link to this citation with markup like the following: | ||
: {{tlx|harv|Peh|Ng|2009}} | : {{tlx|harv|Peh|Ng|2009}} | ||
Line 56: | Line 56: | ||
== See also == | == See also == | ||
* {{tl|citeref}} (a wrapper for <code><nowiki>harvid</nowiki></code> to create #internal wikilinks with either superscript <sup>[n]</sup> or plain-text labels to other citations from inside a citation) | |||
{{Wikipedia referencing}} | {{Wikipedia referencing}} | ||
<includeonly> | <includeonly>{{Sandbox other|| | ||
[[Category:Author–date citation templates]] | [[Category:Author–date citation templates]] | ||
[[Category:Footnote templates]] | [[Category:Footnote templates]] | ||
Line 66: | Line 68: | ||
[[sl:Template:SfnRef]] | [[sl:Template:SfnRef]] | ||
[[simple:Template:SfnRef]] | [[simple:Template:SfnRef]] | ||
</includeonly> | }}</includeonly> |
Revision as of 06:49, 10 August 2020
This is a documentation subpage for Template:SfnRef. It contains usage information, categories and other content that is not part of the original template page. |
Generate an identifier suitable as an anchor for a Harvard citation. This template, which can be used with either the name {{SfnRef}}
or the name {{harvid}}
, is intended to be paired with Harvard citation templates such as {{Sfn}}, {{harv}}, and {{harvnb}}. This template uses the same arguments as the other citation templates. As explained below, this template is needed only in some cases when the Harvard citation templates are used.
Usage
{{SfnRef|Last name of author(s)|Year}}
or
{{harvid|Last name of author(s)|Year}}
The first parameter is the first author's last name. Up to four authors can be given as parameters; if there are more than four authors, list only the first four. The last parameter is the year of publication, possibly with a letter suffixed to avoid ambiguity if there are multiple citations by the same set of authors in the same year.
All named parameters such as |p=
are ignored.
Purpose
This template creates the proper value for the |ref=
parameter for use with {{cite journal}}, {{cite book}}, {{citation}}, and the other templates implemented via {{citation/core}}, and for use by {{vcite journal}}, {{vcite book}} and other templates that generate Vancouver system references. It is intended to be paired with {{Sfn}} and uses the same arguments. As explained below, {{SfnRef}}
/{{harvid}}
is only necessary in a subset of the cases where {{Sfn}}
is used.
{{Sfn}}
creates a short footnote that is linked to a full footnote. {{Sfn}}
creates the link automatically, but the full footnote must be assigned the proper ID value to be a valid target for that link.
When using the {{citation/core}}
family of citation templates, the ID is created via the |ref=
parameter. In most cases, the parameter should be coded as |ref=harv
: this generates the ID from the last names of the first four authors. This parameter setting is not needed for {{citation}}, which defaults to |ref=harv
. However, if |last1=
etc. are not used, such as when the author of the source is unknown and the short footnote specifies an organization name, |ref=harv
will not create the proper ID value. In those cases, use {{SfnRef}}
to create the proper value without having to know the rules for how {{Sfn}}
creates the ID.
The {{vcite journal}} etc. templates (with "vcite
", not "cite
") do not support |ref=harv
and require the use of {{SfnRef}}
/{{harvid}}
to work with Harvard citations.
Examples
- With the shortened footnote template
When citing an article published in the December 2004 edition of Rolling Stone where the author is unknown, you might create a short footnote as follows:
{{Sfn|Rolling Stone|2004}}
|ref=harv
will not work in this case because "Rolling Stone" is not the name of the author. You may code the value for the |ref=
parameter manually, or you can use {{SfnRef}}
and specify the same parameters as used with {{Sfn}}
:
{{SfnRef|Rolling Stone|2004}}
The full footnote:
{{cite news |work=[[Rolling Stone]] |title=The RS 500 Greatest Songs of All Time |ref={{SfnRef|Rolling Stone|2004}} |date=December 2004}}
You can copy and paste the {{Sfn}}
template code and change the name of the template from "Sfn" to "SfnRef". If your short footnote includes page numbers such as {{Sfn|Rolling Stone|2004|p=48}}
, you can copy and paste it to create {{SfnRef|Rolling Stone|2004|p=48}}
; the |p=48
parameter is not necessary but will do no harm.
- With other Harvard templates
For example, a References section might contain the following markup:
{{vcite journal |author=Peh WC, Ng KH |title=Preparing the references |journal=Singapore Med J |volume=50 |issue=7 |pages=659–661 |year=2009 |pmid=19644619 |url=http://smj.sma.org.sg/5007/5007emw1.pdf |format=PDF |ref={{harvid|Peh|Ng|2009}} }}
This markup uses {{harvid|Peh|Ng|2009}}
to generate the anchor identifier "CITEREFPehNg2009", used internally to link Harvard references to citations. (This identifier is not visible to the article's reader.) The generated citation looks like this:
- Peh WC, Ng KH. Preparing the references [PDF]. Singapore Med J. 2009;50(7):659–661. PMID 19644619.
Article prose can link to this citation with markup like the following:
{{harv|Peh|Ng|2009}}
which generates the following:
To see how it works, click on the "(Peh & Ng 2009)".
See also
- {{citeref}} (a wrapper for
harvid
to create #internal wikilinks with either superscript [n] or plain-text labels to other citations from inside a citation)