Langbahn Team – Weltmeisterschaft

User:SMcCandlish/How to use the sfnp family of templates

The {{sfnp}} (for "shortened footnotes, with parenthetical dates") template is a means of concisely citing the same source at different pages many times throughout the same article. In short, something like {{sfnp|Miller|2017|p=37}} is used to replace something like <ref name="Miller 2017 p37">Miller (2017), p. 37.</ref>, and will not only link automatically to the full citation (the detailed {{cite book|last=Miller|first=Dawn|date=2017|title= ...}} cite), but will also automatically merge duplicate citations to the same source and page! It's great, but not everyone is fully up-to-speed on how to use it, so below is a crash course in getting it to work and avoiding problems. There are a number variations on this template, distinguished below. The full-length citation is usually put at the bottom of the page; there are several ways of doing this, also covered below.

Variants

  • {{sfnp}} – Replaces a <ref>...</ref> with a shortened footnote in it which links to the full-length citation. Designed to be in a consistent citation style with the full citations generated by the CS1 ({{Cite book}}, {{Cite journal}}, etc.) and CS2 ({{Citation}}) templates. Example: {{sfnp|Miller|2017|p=37}}.
  • {{harvp}} – Same as {{sfnp}} except used inside a <ref> to provide a link to the full cite, plus additional annotations which can include more such templates, as in: <ref>{{harvp|Miller|2017|p=37}}. The classification system decribed there is a simplification of that first published in {{harvp|Chen|Gonzales|1999|pp=127–128}}.</ref>
  • {{sfn}} or {{sfnnb}} – No brackets/parentheses version of {{sfnp}}. This is appropriate for use with citation styles that do not put parentheses/round-brackets around dates, such as the Vancouver system (which is very disused in Wikipedia). Unfortunately, because {{sfn}} was developed first and has a shorter name and is mentioned in more of our documentation, it is often mistaken to be the "default" or the "normal" option, but should actually be replaced with {{sfnp}} in any article using CS1/CS2 citations.
  • {{harvnb}} – No brackets/parentheses variant of {{harvp}} to go along with {{sfn}}, for use with citation styles like Vancouver that require no parentheses/round-brackets around dates. In most articles, should be replaced with {{harvp}}.
Several templates in this family are deprecated and should be replaced with other citation methods when encountered in articles:

All of the following were used for inline parenthetical referencing, which puts citation information directly into the main article text. This practice (done with or without any template) was deprecated by the Wikipedia community in 2022, as creating too much reader-distracting clutter.

  • {{harv}} – Formerly used to generate inline parenthetical references in the form "(Miller 2017, p. 37)".
  • {{harvtxt}} – A slight variant on {{harv}} for the same purpose: "Miller (2017, p. 37)".
  • {{harvcol}} – Ditto, but in the even more obtuse format: "(Miller 2017:37)"
  • {{harvcoltxt}} – Slight variant: "Miller (2017:37)"
  • {{harvcolnb}} – Worst of the lot: "Miller 2017:37"
  • {{harvs}} – No, actually this one is worse by inline-citing multiple works by same author in a confusing manner: "Miller (2017, 2023)"

There are also multi-citation versions of these, for bundling multiple reference citations for the same claim into a single [1]-style footnote. These are complicated and beyond the scope of this primer, but they are listed here for future reference:

  • {{sfnmp}} – Multi-citation version of {{sfnp}}; does not require a <ref>...</ref>.
  • {{sfnm}} or {{sfnmnb}} – Multi-citation version of {{sfn}}; i.e., it is {{sfnmp}} without the parentheses, for Vancouver-style citations.
  • {{multiref}} – A simple multi-citation list wrapper that can be used with several {{harvp}} (or {{harvnb}}) instances.
  • {{harvc}} – Specialized multi-citation template, used inside <ref>...</ref>, for citing multiple authors' different contributions to the same edited volume; defaults to CS1/CS2-style dates by default (for Vancouver-style, add |nb=yes).

Basic use of sfnp and harvp

  • A typical example looks something like {{sfnp|Miller|2017|p=37}} or for multiple pages: {{sfnp|Miller|2017|pp=37, 39–40}}. Output: Miller (2017), pp. 37, 39–40.
    • The format is: an author surname (there can be up to four of these parameters – each name must be preceded by its own |), a date, and a |p= or |pp= parameter for the page number(s).
  • Use of {{harvp}} is the same, but inside <ref>...</ref>: <ref>{{harvp|Miller|2018|p=37}}. Additional notes here.</ref> This is often used for providing a quotation from the page cited.
    • Note: {{harvp}} (or Vancouver variant {{harvnb}}) will not add a . at the end, so one has to be added manually where appropriate. {{sfnp}} (and Vancouver variant {{sfn}}) will automatically add a .
    • {{sfnp}} supported a |ps= that can theoretically be used for adding quotations or other annotations; however, it is broken and has been deprecated and should not be used. (If two citations to the same page have |ps= (as in {{sfnp|Miller|2017|p=37|ps="Quote 1."}} then {{sfnp|Miller|2017|p=37|ps="Quote 2."}}) then a big red error message will result. Thus, it is recommended to use the {{harvp}} method for such things.
  • A filled-out "maximal" example would be something like: {{sfnp|Chen|Jones|López-Garcia|Le Fevre|2021|p=99|loc=footnote 7}}. Output: Chen et al. (2021), p. 99, footnote 7.
    • The |loc= parameter is optional and can also be used in place of, instead of along with, |p= or its plural form |pp=: {{sfnp|Chen|Jones|López-Garcia|Le Fevre|2021|loc=errata sheet}}

Getting the names and dates to work

  • The date always comes after the name(s), and only surnames are used. Doing something like {{sfn|2017|Eshkol|Levitov}} will fail. Doing something like {{sfn|Eshkol, David|Levitov, Irina M.|2017}} or {{sfn|Eshkol D|Levitov IM|2017}} will fail.
    • If there is a desire to distinguish two authors with the same surname, see the section below on using |ref={{sfnref|...}} to create a custom anchor name.
  • For multiple authors, the maximum in the sfnp/harvp is 4, no matter how many authors the work has specified in the full-length citation. If you put in 5 or more, the template will throw a red error message. (This applies to {{sfnp}}, {{harvp}}, and all their variants.)
    • If there are four authors, all but the first will be replaced with "et al." in what is shown to the reader: "Chen et al. (2021), p. 23." For a work with three for fewer authors, all are displayed: "Xiang & Hawass (1998), pp. xi–xii.", or "Smith, O'Brien & Yamamoto (2017), pp. 121–123."
  • All the authors up to 4 must be included if specified in the full citation. For the above example, doing {{sfnp|Chen|Jones|López-Garcia|2021|p=32}} will not work because |Le Fevre is missing.
    • If there is a desire to shorten this to something like {{sfnp|Chen et al.|2021|p=32}}, see the section below on using |ref={{sfnref|...}} to create a custom anchor name.
  • The author surnames must match those (in numeric order) given in the full citation, e.g.: {{Cite journal |last1=Chen |first1=Amy B. |last2=Jones |first2=C. D. |last3=López-Garcia |first3=Carlos |last4=Le Fevre |first4=Jean-Paul |last5= ... |date=2021 ...}}, matches with a specific-page citation like {{sfnp|Chen|Jones|López-Garcia|Le Fevre|2021|p=23}}
    • Spelling must be the same as in the full citation ("Le Fevre" and "LeFevre" and "le Fevre" are not equivalent).
    • The surname matching also works with the generic CS2 equivalent template {{Citation |last1=Chen |first1=Amy B. |last2=Jones |first2=C. D. |last3=López-Garcia |first3=Carlos |last4=Le Fevre |first4=Jean-Paul |last5= ... |date=2021 ...}}
      If this is encountered in any article dominated by the more specific CS1 templates, it should be replaced with the appropriate one of those, per WP:CITESTYLE (and at this point, the vast majority of uses of CS2 {{Citation}} are inconsistent injections of this sort into CS1 articles; the proportion (and probably also the raw number) of articles consistently templated in CS2 is decreasing all the time).
    • Surprisingly, it also works by extracting individual surnames out of the lossy, harder-to-understand, and inconsistent |vauthors= approach to specifying the authors, as long as it's actually coded in the proper format: {{Cite journal |vauthors=Chen AB, Jones CD, López-Garcia C, Le Fevre J-P, ... |date=2021 ...}}
      This format, too, should be replaced on-sight with CS1's standard |last1=|first1=, etc. (preferably with full author names instead of initials if known), when |vauthors= is encountered in a article that is not consistetly using Vancouver-style citations, which is almost all of the cases at this point. (Few articles remain using Vancouver consistently, but editors who are fans of that style commonly go around wrongly injecting it into articles that do not use it, which is against WP:CITESTYLE).
    • If there are no authors, editors will be used. This system is smart enough to treat |editor1-last=, etc. as author names for this purpose if there are no |last1=, etc. If there are one or more specified authors, then any editor names are ignored (they do not concatenate onto the author(s) list).
    • Equivalent paramenters in the full citation: |last=, |author=, and |author1= (and the rare |author-last=, |author1-last=, and |author-last1=) are all aliases of |last1=, and so forth. |editor-last=, |editor=, |editor-last1=, |editor1= are all aliases of |editor1-last=, and so on.
    • For mononymic persons (like Madonna) or an organizational author, |author= is typically used (or |editor=, or numbered version of either of these); this works the same as a surname with these short-citation templates.
    • If there are neither authors nor editors, see the section below about using |ref={{sfnref|...}} to build a custom name for {{sfnp}}/{{harvp}} to use (typically based on name of publication or publisher).
  • The CS1/CS2 special parameter |display-authors=etal, to output "et al." after the last specified author name, is not detected or supported. If the citation is {{cite book |last=Adebayo |first=Mohamed |display-authors=etal |date=1997 ...}}, this must be short-cited like {{sfnp|Adebayo|1991|p=23}}.
  • Author names used by {{sfnp}} and related templates have nothing to do with what is in <ref name="...">, only the surnames specified inside the full-length citation template. If you have <ref name="DeBroglieMacDuff2019">{{cite web |last1=De Broglie |first1=Matt |last2=MacDuff Samuelson |first2=Jennifer B. |date=2019 ...}}, this would be short-cited like {{sfnp|De Broglie|MacDuff Samuelson|2019}}.
    • It's helpful for all editors to make ref names consistent and clear, e.g. use <ref name="DeBroglie & MacDuff Samuelson 2019">. Note that the quotation marks are mandatory because of spaces and non-alphanumeric ASCII characters. The lazy practice of doing <ref name=DeBMacDS2019> with very simple ref names that do not contain spaces, punctuation, or other special characters is a terrible idea because someone else is reasonably likely to clean up such messy refs later and may forget the quotation marks and break the citation. Even doing <ref name=DeB-MacDS-2019> is technically invalid markup, though few editors realize it (MW seems to generally handle it okay, but this cannot be guaranteed in future versions because it's against the documented requirements of <ref>). Every time it is encountered, <ref name=foo> should be converted to <ref name="foo"> (though as part of a more substantive edit per WP:COSMETICBOT).

Complications and customization

  • Dealing with two publications the same year by the same author(s) [or, technically, authors with the name surname]: This is where |ref={{sfnref|...}} comes in. If you have {{cite book |last=Tāwhiri |first=Koa |date=2023 ...}} and {{cite journal |last=Tāwhiri |first=Moana |date=2023 ...}}, the solution is this: {{cite book |last=Tāwhiri |first=Koa |date=2023 ... |ref={{sfnref|Tāwhiri|2023a}} }} and {{cite journal |last=Tāwhiri |first=Moana |date=2023 ... |ref={{sfnref|Tāwhiri|2023b}} }}, each short-cited as {{sfnp|Tāwhiri|2023a|pp=vi–ix}} and {{sfnp|Tāwhiri|2023b|p=42}}, respectively.
    • An alternative when there are two authors with the same surname is to be more specific about the author names: {{cite book |last=Tāwhiri |first=Koa |date=2023 ... |ref={{sfnref|Tāwhiri, K.|2023}} }} and {{cite journal |last=Tāwhiri |first=Moana |date=2023 ... |ref={{sfnref|Tāwhiri, M.|2023}} }}, each short-cited as {{sfnp|Tāwhiri, K.|2023|pp=vi–ix}} and {{sfnp|Tāwhiri, M.|2023|p=42}}, respectively. Doing both forms of disambiguation at once is not helpful. The name disambiguation is often helpful any time there are two authors by the same surname in the same article, even if the publication years do not collide.
    • The formerly recommended practice was to "operator overload" the long-form citation's |year= parameter as a form of disambiguation: {{cite book |last=Tāwhiri |first=Koa |year=2023a ...}}, which would work with {{sfnref|Tāwhiri|2023a|p=vi–ix}}, but it pollutes the long-form citation's date output with an invalid year string: Tāwhiri, Koa (2022a) The kluge to repair that was to do: {{cite book |last=Tāwhiri |first=Koa |year=2023a |date=2023 ...}}. But this was all a case of the tail wagging the dog, the code forcing human editors to do confusing things that abuse template parameters for side purposes that don't match their citation-information intent. Worse, non-expert editors are apt to think that |year=2023a|date=2023 is an error and "fix" it to just |date=2023, thereby breaking short cites to that source. The |ref= parameter was introduced to make such easily broken hoop-jumping unnecessary. Instances of |year=2023a, with or without the compensating |date=2023 should be replaced with |date=2023 and an {{sfnref}} (also often called by the alias {{harvid}}) inside a {{ref}}. NB: Using |date= instead of |year= is universally better, because |date= also handles bare years along with fuller dates, and editors who encounter a |year=2023 but see a full date in the cited work when verifying it are apt to improve the citation by giving the full date; |year= is simply obsolete.
  • Dealing with excessively long author names (usually organizational ones): Another job for |ref={{sfnref|...}}. If you have {{cite report |editor1-last=Yi |editor1-first=Xiu-Yīng |editor2=Committee on Reptile and Amphbian Nomenclature |date=2023 |publisher=World Herpetological Society ...}}, you can add |ref={{sfnref|Yi|CRAN|2015}}, and cite it as, e.g., {{sfnp|Yi|CRAN|2015|loc=§ Subspecies}}.
  • Custom names: If the citation has no named authors or editors, the proper way to handle this situation is to use the publication or publisher name (or an abbreviation thereof) with |ref={{sfnref|...}}, e.g.: <ref>{{cite web |title=The snapd roadmap |date=2024 |url= https://snapcraft.io/docs/snapd-roadmap |website=SnapCraft.io |publisher=[[Canonical (company)|Canonical]] |access-date=13 January 2024 |ref={{sfnref|Canonical|2024}} }} (or perhaps |ref={{sfnref|SnapCraft|2024}}), then use {{sfnp|Canonical|2024|loc="snapd 2.58"}} (or {{sfnp|SnapCraft|2024|loc="snapd 2.58"}}, as the case may be).
    • A former practice was to blatantly fake an author by repeating the publisher (or worse yet putting something pointless like "Staff") in |author= (a.k.a. |last=), just to force the templates to work. This pollutes both the visual and metadata output of the citation with a false author claim. (Trying the "Staff" trick will now throw a maintenance warning message, though it is hidden from readers; editors have to use user CSS to turn on visibility of most CS1/CS2 cleanup warnings other than severe errors, and this is highly recommendable for all editors.) If you encounter anything like this, please fix it by removing the pseudo-author and using |ref={{sfnref|...}}.
  • Vancouver-style citation templates ({{Vcite journal}}, {{Vcite journal}}, {{Vcite book}}, etc.), which are rare but still occasionally found, cannot be used at all with {{sfnp}}, etc., without adding |ref={{sfnref|...}} to them. Yet another reason to not use that citation style. Here's another: A citation like {{Vcite journal |author=Peh WC, Ng KH |title=Preparing the references |journal=Singapore Medical Journal |volume=50 |issue=7 |pages=659–661 |date=2009 |pmid=19644619}} produces almost impenetrable gibberish output: "Peh WC, Ng KH. Preparing the references. Singapore Medical Journal. 2009;50(7):659–661. PMID 19644619." – take note of that "2009;50(7):659–661" mess, which is only parseable by experts in Vancouver citation style, which is not more than probably 0.000001% of our readership. If you encounter an article using this citation style, consider proposing changing it to CS1 on the article's talk page, or just doing it boldly if the citation style is not used consistently in the article.
  • Hiding HarvErrors messages on "general references" and "further reading": At User:Ucucha/HarvErrors are instructions (which many editors follow) for turning on visibility of error messages relating to all of these short-citation templates (generally referred to on Wikipedia by the misnomer "Harvard" templates, because the original one was an attempt to implement Harvard referencing citation style). One of these messages appears (and is rather annoying) any time a CS1/CS2 citation appears in a page but is neither inside a <ref> nor cited by anything like {{sfnp}}, {{harvp}}, etc. This is useful for identifying sources that have become "orphaned", e.g. because material that included short citations to them was deleted. But sometimes articles have some "general references" that have been used to source part of the article content without an inline cite yet, and the article may also have a "Further reading" section, in either/both cases with entries formatted using CS1/CS2 templates. Display of the recurrent big red error message on such citations ("Harv error: link from CITEREFMcDougall2011 doesn't point to any citation.", etc.) can be suppressed by adding |ref=none to the citation. This should not be done on citations that are actually used inline in the article, directly or by way of short citations, since it will make them not addressable by any short citations. Since this error-hiding is cosmetic (not a reader-facing change and not required maintenance), it should be done as part of a more substantive edit, per WP:COSMETICBOT. PS: There are other versions of the HarvErrors script, such as the one by Trappist the Monk (listed in the nutshell at the top of User:Ucucha/HarvErrors), which hide these messages in "External links" and "Further reading" if you want to neither see them nor do anything about them.

The long-format full citations

Sources reused with multiple citations on different pages are usually placed at the bottom of the article instead of kept inline. There are several ways of doing this that vary on an article-by-article basis:

  • Subsection: Below ==References== and its {{reflist}} or <references> (which generate the short footnotes along with full citations cited only once), add a subheading such as ===Citations===, ===Works cited===, or ===Bibliography=== (the last is not recommendable for author bios, since it will seem to be about their own works, and there likely will already be a section by that name). Under this new subheading, use a bullet list with * to add each of the full citations ({{cite journal}}, {{cite book}}, etc.) that are being used more than once, one per list line, and without a <ref>...</ref> around it. Putting {{refbegin}} above and {{refend}} below this list is optional; it makes this citation text more consistent with the auto-generated citations.
    • Variations on this that can be found "in the wild" include using another ==Level-2 section== for this instead of a level-3 subsection, and sometimes when this is done changing the standard "References" (which is used in over 95% of our articles) to something else like "Citations". Neither of these practices are helpful; they just makes our articles less consistent and more confusing to readers.
  • No subsection: Instead of using such a subsection, just immediately below {{reflist}} or <references>, put {{refbegin}}, your list of multi-cited sources, formatted as above, and then {{refend}}.
  • LDR: Use the more complicated "list-defined references" (LDR) style, in which each of these sources is put inside a <ref>...</ref>, and these are in turn placed inside, not below, an extended {{reflist|1=...}} or <references>...</references>. Each is just put on its own line (or sometimes formatting in the vertical multi-line style), with no * markup. This is the most complicated option and not very popular.

Technically speaking, you can do it all inline without anything actually breaking. E.g.: Article text here.<ref>{{cite book |last=Hughes |first=J. B. |date=2013 ... |page=117}}</ref> More article text here.{{sfnp|Hughes|2013|p=122}}</ref>. However, many editors will consider this sloppy and may move the long cite (sans the page number) to the bottom of the article and replace its original instance with another page-specific short cite, {{sfnp|Hughes|2013|p=117}} in this case.