Help:Cite

From Interesting Times

<languages/> Template:PD Help Page <translate> Cite makes it possible to add footnotes to a page.

See the page on the <tvar name=1>Cite extension </tvar> for technical details.

Usage

The basic concept of the <tvar name=1><ref></tvar> tag is that it inserts the text enclosed by the ref tags as a footnote in a designated section, which you indicate with the placeholder tag <tvar name=2><references /></tvar>. This format cannot be used interchangeably with the older format—you must pick one or the other.

Additional placeholder tags <tvar name=1><references /></tvar> can be inserted in the text, and all <tvar name=2><ref></tvar> tags up to that point, in that group, will be inserted there.

If you forget to include <tvar name=1><references /></tvar> in the article, the footnotes will not disappear, but the references will be displayed at the end of the page. </translate>

<translate> This page itself uses footnotes, such as the one at the end of this sentence.</translate><ref group="note"> <translate> This footnote is used as an example in the "How to use" section.</translate> </ref> <translate> If you [<tvar name=url>https://interesting-times.frost.cx/mediawiki/index.php?title=Help:Cite&action=edit</tvar> view the source] of this page by clicking "Edit this page", you can see a working example of footnotes.</translate>

Script error: No such module "Loops".

<translate> Wikitext</translate> <translate> Rendering</translate>
<syntaxhighlight lang="xml">

<translate nowrap> The Sun is pretty big.</translate><ref><translate nowrap> E. Miller, The Sun, (New York: Academic Press, 2005), 23–25.</translate></ref> <translate nowrap> The Moon, however, is not so big.</translate><ref><translate nowrap> R. Smith, "Size of the Moon", Scientific American, 46 (April 1978): 44–46.</translate></ref>

<translate nowrap>

Notes

</translate> <references /> </syntaxhighlight>

<translate> The Sun is pretty big.</translate><ref><translate> E. Miller, The Sun, (New York: Academic Press, 2005), 23–25.</translate></ref> <translate> The Moon, however, is not so big.</translate><ref><translate> R. Smith, "Size of the Moon", Scientific American, 46 (April 1978): 44–46.</translate></ref>

<translate> Notes</translate>

<references />

<translate>

Multiple uses of the same footnote

</translate> <translate> To give a footnote a unique identifier, use {{<tvar name=1>tmpl|0=<ref Template:Attr></tvar>|name}}.</translate> <translate> You can then refer to the same footnote again by using a ref tag with the same name.</translate> <translate> The text inside the second tag doesn't matter, because the text already exists in the first reference.</translate> <translate> You can either copy the whole footnote, or you can use a terminated empty ref tag that looks like this: {{<tvar name=1>tmpl|0=<ref Template:Attr /></tvar>|name}}.</translate>

<translate> In the following example, the same source is cited three times. </translate>

<translate> Wikitext</translate> <translate> Result</translate>
<syntaxhighlight lang="xml">

<translate nowrap> This is an example of multiple references to the same footnote.</translate><ref name="multiple"><translate nowrap> Remember that when you refer to the same footnote multiple times, the text from the first reference is used.</translate></ref>

<translate nowrap> Such references are particularly useful if different statements come from the same source.</translate><ref name="multiple" /> <translate nowrap> Any reused tag should not contain extra content, that will spawn an error.</translate> <translate nowrap> Only use empty tags in this role.</translate>

<translate nowrap> A concise way to make multiple references is to use empty ref tags, which have a slash at the end.</translate> <translate nowrap> Although this may reduce redundant work, please be aware that if a future editor removes the first reference, this will result in the loss of all references using the empty ref tags.</translate><ref name="multiple" />

<translate nowrap>

Notes

</translate> <references /> </syntaxhighlight>

<translate> This is an example of multiple references to the same footnote.</translate><ref name="multiple"><translate> Remember that when you refer to the same footnote multiple times, the text from the first reference is used.</translate></ref>

<translate> Such references are particularly useful when citing sources, if different statements come from the same source</translate><ref name="multiple" /> <translate> Any reused tag should not contain extra content, that will spawn an error.</translate> <translate> Only use empty tags in this role.</translate>

<translate> A concise way to make multiple references is to use empty ref tags, which have a slash at the end.</translate> <translate> Although this may reduce redundant work, please be aware that if a future editor removes the first reference, this will result in the loss of all references using the empty ref tags.</translate><ref name="multiple" />

<translate> Notes</translate>

<references />

Template:Note

<translate>

The <tvar name=1><references /></tvar> tag

</translate> <translate> The <tvar name=1><references /></tvar> tag inserts the text of all the citations which have been defined in <tvar name=2><ref></tvar> tags up to that point in the page.</translate> <translate> For example, based on the citations above, there should be reference for the <tvar name=1>note</tvar> group.</translate>

<translate> Wikitext</translate> <translate> Result</translate>
<syntaxhighlight lang="html4strict">

<references group="note"/> </syntaxhighlight>

<references group="note"/>

<translate> The reference list [[<tvar name=1>Special:MyLanguage/Contributors/Projects/Columns for references</tvar>|can have a responsive width]] (displaying in some cases the references in several columns).</translate> <translate> In that case, the <tvar name=1>responsive</tvar> attribute is used to configure that behavior.</translate> <translate> On wikis with the default configuration, this will happen on every page; on others, you need to activate it.</translate>

<translate> If a page includes more than one <tvar name=1><references /></tvar> list, each list includes the <tvar name=2><ref></tvar> tags defined after the previous references list.</translate> <translate> If these references lists are produced by templates, each one lists the ref tags defined before the first references list, and there is an error message saying that there is a ref tag but not a references list.</translate>

<translate>

Grouped references

This may be disabled by <tvar name=1><syntaxhighlight lang=php inline>$wgAllowCiteGroups = false;</syntaxhighlight></tvar> if desired.

The following example generates separate reference lists for citations and miscellaneous footnotes: </translate>

<translate> Wikitext</translate> <translate> Result</translate>
<syntaxhighlight lang="xml">

<translate nowrap> According to scientists, the Sun is pretty big.</translate><ref><translate nowrap> E. Miller, The Sun, (New York: Academic Press, 2005), 23–25.</translate></ref> <translate nowrap> In fact, it is very big.</translate><ref group="footnotes"> <translate nowrap> Take their word for it.</translate> <translate nowrap> Don't look directly at the sun!</translate></ref>

<translate nowrap>

Notes

</translate> <references group="footnotes" />

<translate nowrap>

References

</translate> <references /> </syntaxhighlight>

<translate> According to scientists, the Sun is pretty big.</translate><ref><translate> E. Miller, The Sun, (New York: Academic Press, 2005), 23–25.</translate></ref> <translate> In fact, it is very big.</translate><ref group="footnotes"> <translate> Take their word for it.</translate> <translate> Don't look directly at the sun!</translate></ref>
<translate> Notes</translate>

<references group="footnotes" />

<translate> References</translate>

<references />

<translate> The anonymous group works as before, while references destined for the named group will only show up in the designated <tvar name=1><references /></tvar> element. </translate>

Template:Note

<translate> The rendering of a given group can be customized across the wiki by creating {{<tvar name=1>tmpl|0=Template:Blue</tvar>|name}} and listing the used signs in the order they appear, separated by spaces or newlines.</translate>

<translate> For example, if <tvar name=1>Template:Blue</tvar> is created with the content <tvar name=2>

a b c d e f g h i j k l m n o p q r s t u v w x y z

</tvar> then the first <tvar name=3><syntaxhighlight lang="xml" inline><ref group="lower-alpha">...</ref></syntaxhighlight></tvar> renders <tvar name=4>[a]</tvar>, the second one renders <tvar name=5>[b]</tvar>, and so on, the 26th renders <tvar name=6>[z]</tvar>.</translate>

<translate> It is an error to use more footnotes in a custom-rendered group than the number of signs defined, so the 27th footnote in this group causes an error.</translate>

<translate> The following group names are often defined as custom groups by the following messages respectively: </translate>

<translate> group name</translate> <translate> message</translate>
upper-alpha MediaWiki:Cite link label group-upper-alpha
lower-alpha MediaWiki:Cite link label group-lower-alpha
upper-roman MediaWiki:Cite link label group-upper-roman
lower-roman MediaWiki:Cite link label group-lower-roman
lower-greek MediaWiki:Cite link label group-lower-greek

Template:Note

Script error: No such module "Loops". <translate>

Citing different parts of the same source

</translate> <translate> When several parts from the same work are used as references in an article, you can cluster them in the reference section.</translate> <translate> This gives readers a way to identify which references originate from the same source.</translate> <translate> It also allows you to cite different parts of the same source without repeating the entire source every time.</translate>

<translate> Wikitext</translate> <translate> Result</translate>
<syntaxhighlight lang="xml">

<translate nowrap> According to scientists, the Sun is pretty big.</translate><ref name="Miller"><translate nowrap> E. Miller, The Sun, (New York: Academic Press, 2005).</translate></ref> <translate nowrap> In fact, it is very big.</translate><ref extends="Miller">p. 123</ref> <translate nowrap> Take their word for it.</translate> <translate nowrap> Don't look directly at the sun!</translate><ref extends="Miller">p. 42</ref>

<translate nowrap>

References

</translate> <references /> </syntaxhighlight>

<translate> According to scientists, the Sun is pretty big.</translate>[1] <translate> In fact, it is very big.</translate>[1.1] <translate> Take their word for it.</translate> <translate> Don't look directly at the sun!</translate>[1.2]
<translate> References</translate>

<translate> 1. E. Miller, The Sun, (New York: Academic Press, 2005)</translate>
   1.1 ↑ p. 123
   1.2 ↑ p. 42

Template:Note

<translate>

Separating references from text

</translate> <translate> In-text references make it easy to copy the text to another page; on the other hand, they make it hard to read.</translate> <translate> References containing a lot of data, quotes or elaborate citation templates can make up a significantly larger fraction of the source than the text that will actually be visible.</translate> <translate> To avoid this, recent versions of the extension allow moving some or all of the references into the <tvar name=1><references /></tvar> section, to the place where they will actually appear to the reader.</translate>

<translate> Wikitext</translate> <translate> Result</translate>
<syntaxhighlight lang="html4strict">

<translate nowrap> According to scientists, the Sun is pretty big.</translate><ref name="miller" /> <translate nowrap> The Moon, however, is not so big.</translate><ref name="smith" />

<translate>

Notes

</translate> <references> <ref name="miller"><translate nowrap> E. Miller, The Sun, (New York: Academic Press, 2005), 23–25.</translate></ref> <ref name="smith"><translate nowrap> R. Smith, "Size of the Moon", Scientific American, 46 (April 1978): 44–46.</translate></ref> </references> </syntaxhighlight>

<translate> According to scientists, the Sun is pretty big.</translate><ref name="miller" /> <translate> The Moon, however, is not so big.</translate><ref name="smith" />

<translate> Notes</translate>

<references> <ref name="miller"><translate> E. Miller, The Sun, (New York: Academic Press, 2005), 23–25.</translate></ref> <ref name="smith"><translate> R. Smith, "Size of the Moon", Scientific American, 46 (April 1978): 44–46.</translate></ref> </references>

<translate> Thus, the code above will have the same output as the [[<tvar name=1>#Example</tvar>|first example]] above, although the numbering and order of the references will not in general be the same.

Substitution and embedded parser functions

</translate> <translate> Since Cite's <tvar name=1><ref></tvar> tag is parsed before MediaWiki's parser functions (e.g. <tvar name=2>{{#ifexpr:…}}</tvar>) or variables (e.g. <tvar name=3>{{PAGENAME}}</tvar>) or before <tvar name=4>subst:</tvar>, these will not work inside of citation references.</translate> <translate> Instead, you have to use the [[<tvar name=1>Special:MyLanguage/Help:Magic words#Miscellaneous</tvar>|magic word <tvar name=2>{{#tag:…}}</tvar>]].</translate>

<translate> Wikitext</translate> <translate> Result</translate>
<syntaxhighlight lang="xml">

Foo<ref><translate nowrap> This is not working, see {{<tvar name=1>cite journal|url=https://www.google.com |author= |date= |accessdate={{subst:#time:Y-m-d|now}}</tvar>|title=Search}}</translate></ref> bar baz… Foo<ref><translate nowrap> Whereas this does, see {{<tvar name=1>cite journal|url=https://www.google.com |author= |date= |accessdate={{subst:#time:Y-m-d|now}}</tvar>|title=Search}}</translate></ref> bar baz… <references /> </syntaxhighlight>

Foo<ref><translate> This is not working, see {{<tvar name=1>cite journal|url=https://www.google.com |author= |date= |accessdate={{subst:#time:Y-m-d|now}}</tvar>|title=Search}}</translate></ref> bar baz… Foo<ref><translate> Whereas this does, see {{<tvar name=1>cite journal|url=https://www.google.com |author= |date= |accessdate=2021-03-11</tvar>|title=Search}}</translate></ref> bar baz…

<references />

<translate>

Adding an automatic heading before the references list

</translate> <translate> Up to MediaWiki 1.28, one could use the system message <tvar name=1>MediaWiki:Cite references prefix</tvar> to define a wiki-wide heading which would be automatically inserted before each references list.</translate> <translate> In MediaWiki 1.29, this system message was removed.</translate> <translate> A hacky way to enter a headline now is to add the following code to <tvar name=1>MediaWiki:Common.js</tvar>:</translate>

<syntaxhighlight lang="javascript"> $(document).ready(function(){

$('.mw-references-wrap').before('

<translate nowrap> References</translate>

');

}); </syntaxhighlight>

<translate> Note that this adds the header unconditionally, i.e. if you already have the header it gets added again thus creating duplicated headers.

If you only need a text heading (no link or other active elements) you could add the following to <tvar name=1>MediaWiki:Common.css</tvar> (Chrome 4, IE9, FF 3.5, Safari 3.1, Opera 7): </translate>

<syntaxhighlight lang="css"> .mw-references-wrap::before {

 content: "Blue references";
 color: #0645ad;
 text-decoration: none;
 background: none;
 font-style: italic;
 font-size: 100%;
 font-weight: bold;
 line-height: 1.6;
 direction: ltr;
 font-family: sans-serif;

} </syntaxhighlight>

<translate>

Merging two texts into a single reference

</translate> <translate> A typical Wikisource issue are references that span multiple pages in the source material.</translate> <translate> These can be merged using a {{<tvar name=1>tmpl|0=<ref Template:Attr></tvar>|name}} tag for the first part of the reference, and tagging the following parts with a tag {{<tvar name=2>tmpl|0=<ref Template:Attr></tvar>|name}} using the same name.</translate>

<translate> Example: </translate>

<translate> Wikitext</translate> <translate> Result</translate>
<syntaxhighlight lang="xml">

<translate nowrap> This is an example of merging multiple texts into the same footnote.</translate><ref name="main"><translate nowrap> Remember that all the texts will be included into the reference containing the <tvar name=1>name="…"</tvar> attribute.</translate></ref>

<ref follow="main"><translate nowrap> Simply include the additional text in a tag with the <tvar name=1>follow="…"</tvar> attribute, matching the first ref's name.</translate></ref>

<translate>

References

</translate> <references/> </syntaxhighlight>

<translate> This is an example of merging multiple texts into the same footnote.</translate><ref name="main"><translate> Remember that all the texts will be included in the reference containing the <tvar name=1>name="…"</tvar> attribute.</translate></ref>

<ref follow="main"><translate> Simply include the additional text in a tag with the <tvar name=1>follow="…"</tvar> attribute, matching the first ref's name.</translate></ref>

<translate> References</translate> <references/>

<translate> When using this syntax, take care that the "<tvar name=1>follow</tvar>" part of the footnote is included on the same page as the first part of the reference.</translate>

<translate> Note that reference names cannot start with a number, so always include some text like, <tvar name=2><syntaxhighlight lang=html inline><ref name="p32"></syntaxhighlight></tvar> and <tvar name=3><syntaxhighlight lang=html inline><ref follow="p32"></syntaxhighlight></tvar>.</translate>

<translate>

Customization

The format of the output of <tvar name=1><ref></tvar> and <tvar name=2><references></tvar> is almost completely customizable through MediaWiki [[<tvar name=3>Special:MyLanguage/Help:System message</tvar>|messages]], that can be modified, for example, through the MediaWiki namespace depending on the configuration of the wiki.

For a list of messages that control the output of <tvar name=ref><ref></tvar> and <tvar name=references><references></tvar> and the values, if any, that are passed to them ($1, $2, $3 ...), see [<tvar name=url>https://www.mediawiki.org/w/index.php?title=Special%3AAllMessages&prefix=Cite_ref&filter=all&lang=en&limit=300</tvar> an up-to-date listing of the default values] that can be obtained directly from MediaWiki. </translate>

<translate> Incomplete list</translate>
  • cite_reference_link_key_with_num
    1. key
    2. num
  • cite_reference_link_prefix
  • cite_reference_link_suffix
  • cite_references_link_prefix
  • cite_references_link_suffix
  • cite_reference_link
    1. <translate> ref ID</translate>
    2. <translate> backlink ID</translate>
    3. <translate> count to display</translate>
  • cite_references_link_one
    • <translate> Used to format the source list that <tvar name=1><references /></tvar> outputs, it configures 3 things: the backlink ID, the ref ID, and text of note.</translate>
    1. <translate> backlink ID</translate> — <translate> Used for creating the number order of the source list.</translate>
    2. <translate> ref ID</translate> — <translate> Used to link back to the actual reference in the text, this is where you can configure the <tvar name=1>^</tvar> symbol.</translate>
    3. <translate> text of note</translate> — <translate> text used above describing the source info</translate>
  • cite_references_link_many
    1. <translate> backlink ID</translate>
    2. <translate> list of links</translate>
    3. <translate> text of note</translate>
  • cite_references_link_many_format
    1. <translate> ref ID</translate>
    2. <translate> numeric value to use as a backlink</translate>
    3. <translate> custom value (as defined in <tvar name=1>cite_references_link_many_format_backlink_labels</tvar> to use as a backlink)</translate>
  • cite_references_link_many_format_backlink_labels
  • cite_references_link_many_sep
  • cite_references_link_many_and
  • cite_references_suffix

<translate>

Set references to use <tvar name=1>^</tvar> and letters

</translate> <translate> To replace the default uparrow (<tvar name=1>↑</tvar>) with caret (<tvar name=2>^</tvar>), modify the following [[<tvar name=3>Special:MyLanguage/Help:System message</tvar>|system message]].</translate> <translate> All of these pages can be found on <tvar name=1>Special:AllMessages</tvar>.</translate>

MediaWiki:Cite reference backlink symbol
<translate> From</translate> <translate> To</translate>
<syntaxhighlight lang="xml">

↑ </syntaxhighlight>

<syntaxhighlight lang="xml">

^ </syntaxhighlight>

MediaWiki:Cite references link many format

<translate> Replacing $2 with $3 changes the links from 1.0, 1.1, 1.2 to a, b, c etc… </translate>

<translate> From</translate> <translate> To</translate>
<syntaxhighlight lang="xml">

$2 </syntaxhighlight>

<syntaxhighlight lang="xml">

$3 </syntaxhighlight>

<translate> Searching for these pages for the first time will result in no matches.</translate> <translate> Simply click "Create this page" to edit the code.</translate> <translate> The changes will not show up until a page with references is rebuilt.</translate>

<translate>

Set reference and reference number highlighting

</translate>

Template:Note

<translate> Add the following code to the <tvar name=1>MediaWiki:Common.css</tvar> page. </translate>

<syntaxhighlight lang="css"> /* <translate nowrap> make the Cite extension list of references look smaller and highlight clicked reference in blue</translate> */ ol.references { font-size: 90%; } ol.references li:target { background-color: #ddeeff; } sup.reference:target { background-color: #ddeeff; } </syntaxhighlight>

<translate>

Broken references

</translate>

<translate> If the <tvar name=ref><ref></tvar> or <tvar name=references><references /></tvar> tags are used incorrectly, the Cite extension will add an error message to the page, and will add the "<tvar name=category>⧼cite-tracking-category-cite-error⧽</tvar>" category.</translate> <translate> These error messages will appear in the user interface language, either in the article content or in the References section.</translate> <translate> For example:</translate>

<translate> Wikitext</translate> <translate> Result</translate>
<syntaxhighlight lang="xml">

<translate nowrap> This is an example of a references error message.</translate><ref broken><translate nowrap> Intended text.</translate></ref>

<translate nowrap>

Notes

</translate> <references /> </syntaxhighlight>

<translate> This is an example of a references error message.</translate><ref broken> <translate> Intended text.</translate> </ref>

<translate> Notes</translate>

<references />

<translate> See the [[<tvar name=1>Specs/HTML/Extensions/Cite#Error representation</tvar>|spec for Parsoid's Cite error representation]].

See also

</translate>

[[Category:Extension help{{#translation:}}|Cite]]