Help:List-defined references

From Wikipedia, the free encyclopedia
(Redirected from Wikipedia:LDRHOW)

List-defined references (LDR) are references that are defined in the reference list markup, as opposed to being defined in the body of the article. LDR was implemented in September 2009 as a way to make referencing articles easier and with less clutter.

This page is a continuation from a section of Help:Footnotes. This guide assumes you are familiar with the tools explained there, such as the features of <ref>...</ref> tags, and the <ref name="REFNAME" /> parameter.

Overview[edit]

LDR uses named references where each individual reference has a unique name and is defined within the reference list markup:

<references>
  <ref name="name1">reference</ref>
  <ref name="name2">reference2</ref>
</references>
Or; using {{reflist}}
{{reflist|refs=
  <ref name="name1">reference</ref>
  <ref name="name2">reference2</ref>
}}

Alternatively, references can be defined using the 'referencing' wrapper template {{r}} (for brevity the parameter names |name= and |ref= can be abbreviated to |n= and |r=):

<references>
  {{r|name="name1"|ref=reference}}
  {{r|name="name2"|ref=reference2}}
</references>
Or; with {{reflist}}
{{reflist|refs=
  {{r|name="name1"|ref=reference}}
  {{r|name="name2"|ref=reference2}}
}}

Each reference is invoked in the body of the text using <ref name="name1" /> or {{r|name}}.

Names for footnotes and groups must follow these rules:

  • Names are case-sensitive. Please do not use raNdOM capitalization.
  • Names must not be purely numeric; the software will accept something like ":31337" (which is punctuation plus a number), but it will ignore "31337" (purely numeric).
  • Names should have semantic value, so that they can be more easily distinguished from each other by human editors who are looking at the wikitext. This means that ref names like "Nguyen 2010" are preferred to names like ":31337".
  • Names must be unique. You may not use the same name to define different groups or footnotes. Try to avoid picking a name that someone else is likely to choose for a new citation, such as ":0" or "NYT".
  • Please consider keeping reference names short, simple, and restricted to the standard English alphabet and numerals. If spaces are used, the following technical restrictions become relevant:
    • Quotation marks are preferred but optional if the only characters used are letters A–Z, a–z, digits 0–9, and the symbols !$%&()*,-.:;<@[]^_`{|}~. That is, all printable ASCII characters except #"'/=<>?\ and space.
    • Inclusion of any other characters, including spaces, requires that the reference name be enclosed in quotes; for example, name="John Smith". But quote-enclosed reference names may not include a less-than sign (<) or a double straight quote symbol ("), which may however be included by escaping as &lt; and &quot; respectively.
    • The quote marks must be the standard, straight, double quotation marks ("); curly or other quotes will be parsed as part of the reference name.
  • You may optionally provide reference names even when the reference name is not required. This makes later re-use of the sourced reference easier.

Guidelines[edit]

  • All list-defined references must be named. Any name complying with the technical limitations above may be used; however, they should be consistent so that they can be edited by other users. A well-used practice is author-date, author-title or publication-date.
  • Additionally, any unused references will generate an error. All list-defined references must be used in the body and vice versa, all <ref name="ABC">...</ref> tags must have defining information.
  • List-defined references and references defined in the body of the article may be mixed on a page—this is not a technical limitation of the template. However, this may be confusing to ongoing editors, and should be normalized to a single style, per WP:CITEVAR.
  • Reference lists may be ordered in any manner (e.g. alphabetical by reference name), but the generated list will be in the order in which the references are invoked.

Examples[edit]

Markup Renders as
The Sun is pretty big.<ref name="Foot01"/> But the Moon<ref name="Foot02"/> is not so big.<ref name="Foot03"/> The Sun is also quite hot.<ref name="Foot04"/>

==Notes==
{{reflist|refs=
<ref name="Foot01">Miller, ''The Sun'', Oxford, 2005, p. 23.</ref>
<ref name="Foot02">Jones, ''The Solar System'', MacMillan, 2005, p 623.</ref>
<ref name="Foot03">Brown, ''The Moon'', 2006, Penguin, p. 46.</ref>
<ref name="Foot04">Smith, ''The Universe'', Random House, 2005, p. 334.</ref>
}}

The Sun is pretty big.[1] But the Moon[2] is not so big.[3] The Sun is also quite hot.[4]

Notes
  1. ^ Miller, The Sun, Oxford, 2005, p. 23.
  2. ^ Jones, The Solar System, MacMillan, 2005, p 623.
  3. ^ Brown, The Moon, 2006, Penguin, p. 46.
  4. ^ Smith, The Universe, Random House, 2005, p. 334.


List-defined references with explanatory footnotes using a separate reference group.
Markup Renders as
The Sun is pretty big.<ref name="Foot01"/><ref group="Note" name="Note01"/> But the Moon<ref group="Note" name="Note02"/> is not so big.<ref name="Foot02"/><ref group="Note" name="Note03"/> The Sun is also quite hot.<ref name="Foot03"/>

==Notes==
{{reflist|group=Note|refs=
<ref name="Note01">But Miller points out that the Sun is not as large as some other stars.</ref>
<ref name="Note02">The Moon goes by other names, such as Selena.</ref>
<ref name="Note03">Historically the Moon was not always considered to be large.</ref>
}}

==References==
{{reflist|refs=
<ref name="Foot01">Miller, ''The Sun'', Oxford, 2005, p. 23.</ref>
<ref name="Foot02">Brown, ''The Moon'', 2006, Penguin, p. 46.</ref>
<ref name="Foot03">Smith, ''The Universe'', Random House, 2005, p. 334.</ref>
}}

The Sun is pretty big.[1][Note 1] But the Moon[Note 2] is not so big.[2][Note 3] The Sun is also quite hot.[3]

Notes
  1. ^ But Miller points out that the Sun is not as large as some other stars.
  2. ^ The Moon goes by other names, such as Selena.
  3. ^ Historically the Moon was not always considered to be large.
References
  1. ^ Miller, The Sun, Oxford, 2005, p. 23.
  2. ^ Brown, The Moon, 2006, Penguin, p. 46.
  3. ^ Smith, The Universe, Random House, 2005, p. 334.

Usage notes[edit]

The use of list-defined references means that while editing, the references and footnotes formatted this way are all inserted in the source section where the template {{reflist|refs= }} is located. This is primarily a change in the source code and does not affect the display of the article to a reader. The primary effects are for editors, as described below.

The LDR method removes any citation details or notes that could disrupt the edit window while editing the body of the text, which is especially useful if they are vertical or otherwise span multiple lines. Additionally, this centralised reference list section can be opened by itself if any of the citation entries need modification, which can be especially helpful if attempting to modify a reference that is used multiple times—avoiding any need to search the entire source for it.

A drawback of the approach is that these references can be harder to insert into the source, because they are separated from the text. The editor must either open the entire document to see the source for both the text and the reference list, or alternatively use a two-step procedure, first entering the identifier <ref name="name" /> in the main text and then opening the reference listing section to enter the source or footnote as <ref name="name">content</ref>. Another overhead of this approach is that the list at the end of the article must be organised so that they can be found easily by an editor—most likely arranged alphabetically in the edit window by refname as this is most likely to retain source integrity and usefulness, even if the sections of the text are changed.

While it is often tidier to remove all citations from the source text, an acceptable compromise (especially for small articles) could be to only use LDR for citations used multiple times. This is because they already use the refname code so that they can be in multiple places—a simple move of the reference's source code from its first appearance to the reflist is a minor change. Additionally, these citations are more likely to need reviewing or modification, because they are more important to the article and contain more details, and making them easier to find and modify can be very helpful. Finally, this also maintains source integrity if the first instance of the reference changes, as noted above.

Additionally, a user-made script User:PleaseStand/References segregator allows you to automatically separate citations from the edit window, and temporarily collect them in a separated "inline citation" window. In this format the citations can be manually inserted into the reference list. This can have some of the benefits of permanent LDRs where their use is not practical or is against consensus. However, please note that before saving the page, any contents of this window will be replaced into the main text source at the first matching <ref name="name" /> tag unless it is manually emptied. As outlined on its page and below, it has an automatic conversion script that can process existing citations into a reference list by itself, but it is uncertain whether it can do this migration while editing.

Finally, there are some misconceptions about list-defined footnotes:

  1. One of these is that the creation of separated footnote lists requires the use of list-defined footnotes. However, using a 'group' name to differentiate various kinds of footnotes, is available regardless of whether list-defined or in-line footnotes are used. For example, in both cases one can designate notes as a group called "Note", and separate them from simple citations by using the in-line label <ref group="Note" name="name" /> (The complete explanation of the use of group names is illustrated in the second example in the section immediately above.)
  2. Another misconception is that there is an "either-or" choice between use of list-defined footnotes and in-line footnotes, and that all citations in an article must follow only one of the styles. In fact, {{reflist|refs= }} is entirely compatible with the use of in-line footnotes in the form <ref>content</ref> or <ref name="name">content</ref>. Although use of both systems in the same article might appear confusing or undesirable, it is a fact that the two systems can be mixed indiscriminately with the template {{reflist|refs= }}.

Errors[edit]

Sometimes referencing can produce errors that show up in red text. Please refer to Help:Cite errors to help diagnose and solve these errors. Alternatively, check your code against the example above or the reflist documentation at Template:Reflist § List-defined references. Notably, errors at either the named ref tag or the reflist code can cause issues, as an entries must be defined and used in both for a LDR to work.

Converting[edit]

Reference styles may be converted from or to list-defined references, following the same rules for other major changes to citation style, at WP:CITEVAR. User:PleaseStand/segregate-refs.js has an option to assist conversion.

VisualEditor[edit]

You can edit existing list-defined references in VisualEditor. You cannot add or remove list-defined references. It also does not support modifying list-defined references inside {{reflist}}, only <references/>.

See also[edit]

  • Template:R – this template reduces the text needed to define and invoke named refs, <ref name="foo"/> becomes {{r|foo}}
  • Template:Use list-defined references – this optional template can be used to indicate to editors and tools that an article uses LDRs
  • Reference Organizer[1] (source) – is a tool that presents all references in graphical user interface, where you can choose whether the references should be defined in the body of article or in the reference list template(s) (list-defined format). The choice can be applied to all references, to all references with a certain number of uses (citations), or by ticking references individually. You can also sort references in various ways (and keep the sort order in reference list template) and rename them. Use only if there is consensus.

References[edit]

  1. ^ Copy the following code, edit your user JavaScript, then paste:
    {{subst:lusc|1=User:Cumbril/RefConsolidate_start.js}}