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

The (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 is used to replace something like , and will not only link automatically to the full citation (the detailed  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

 * – Replaces a p 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 (,, etc.) and CS2 templates. Example:.
 * – Same as except used  a ref to provide a link to the full cite, plus additional annotations which can include more such templates, as in:
 * or – No brackets/parentheses version of . 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  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  in any article using CS1/CS2 citations.
 * – No brackets/parentheses variant of to go along with, for use with citation styles like Vancouver that require no parentheses/round-brackets around dates. In most articles, should be replaced with.

All of the following were used for, which puts citation information directly into the main article text. This practice (done with or without any template) was by the Wikipedia community in 2022, as creating too much reader-distracting clutter.
 * – Formerly used to generate inline parenthetical references in the form "(Miller 2017, p. 37)".
 * – A slight variant on for the same purpose: "Miller (2017, p. 37)".
 * – Ditto, but in the even more obtuse format: "(Miller 2017:37)"
 * – Slight variant: "Miller (2017:37)"
 * – Worst of the lot: "Miller 2017:37"
 * – 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:
 * – Multi-citation version of ; does not require a .
 * or – Multi-citation version of ; i.e., it is  without the parentheses, for Vancouver-style citations.
 * – A simple multi-citation list wrapper that can be used with several (or ) instances.
 * – Specialized multi-citation template, used inside , for citing multiple authors' different contributions to the same edited volume; defaults to CS1/CS2-style dates by default (for Vancouver-style, add yes).

Basic use of sfnp and harvp

 * A typical example looks something like or for multiple pages: . 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 is the same, but inside :   This is often used for providing a quotation from the page cited.
 * Note: (or Vancouver variant ) will not add a   at the end, so one has to be added manually where appropriate.  (and Vancouver variant ) will automatically add a
 * 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 then ) then a big red error message will result. Thus, it is recommended to use the  method for such things.
 * A filled-out "maximal" example would be something like: . 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:

Getting the names and dates to work
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 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). This format, too, should be replaced on-sight with CS1's standard last1first1, 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).
 * Doing something like will fail. Doing something like  or   will fail.
 * If there is a desire to distinguish two authors with the same surname, see the section below on using ref to create a custom anchor name.
 * , 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, , 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."
 * if specified in the full citation. For the above example, doing will not work because Le Fevre is missing.
 * If there is a desire to shorten this to something like, see the section below on using ref to create a custom anchor name.
 * , e.g.:, matches with a specific-page citation like
 * ("Le Fevre" and "LeFevre" and "le Fevre" are not equivalent).
 * The surname matching also works with the generic CS2 equivalent template
 * 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:
 * This system is smart enough to treat editor1-last, etc. as author names for this purpose if there are no last1, etc. If there 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.
 * , see the section below about using ref to build a custom name for / to use (typically based on name of publication or publisher).
 * The CS1/CS2 special parameter etal, to output "et al." after the last specified author name, is detected or supported. If the citation is , this must be short-cited like.
 * Author names used by and related templates have  to do with what is in ref, only the surnames specified inside the full-length citation template. If you have , this would be short-cited like.
 * It's helpful for all editors to make ref names consistent and clear, e.g. use . Note that  because of spaces and non-alphanumeric ASCII characters. The lazy practice of doing   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   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,   should be converted to   (though as part of a more substantive edit per WP:COSMETICBOT).

Complications and customization

 * [or, technically, authors with the name surname]: This is where ref comes in. If you have  and , the solution is this:   and  , each short-cited as  and , respectively.
 * An alternative when there are two authors with the same surname is to :  and , each short-cited as  and , 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 recommended practice was to "operator overload" the long-form citation's year parameter as a form of disambiguation: , which would work with , 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:  . 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 2023a2023 is an error and "fix" it to just 2023, thereby breaking short cites to that source. The ref parameter was introduced to make such easily broken hoop-jumping unnecessary. Instances of 2023a, with or without the compensating 2023 should be replaced with 2023 and an  (also often called by the alias ) inside a . NB: Using date instead of year is universally better, because date also handles bare years along with fuller dates, and editors who encounter a 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.
 * : Another job for &#8202;. If you have, you can add ref, and cite it as, e.g.,.
 * 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, e.g.:  (or perhaps ref), then use  (or, as the case may be).
 * A 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 Help:CS1 errors.) If you encounter anything like this, please fix it by removing the pseudo-author and using ref.
 * (,, , etc.), which are rare but still occasionally found, cannot be used at all with , etc., without adding ref to them. Yet another reason to not use that citation style. Here's another: A citation like   produces almost impenetrable gibberish output: "" – 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.
 * 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, , 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 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:


 * Below  and its  or references (which generate the short footnotes along with full citations cited only once), add a subheading such as ,  , or   (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 (, , etc.) that are being used more than once, one per list line, and without a p around it. Putting  above and  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  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". ; they just makes our articles less consistent and more confusing to readers.
 * Instead of using such a subsection, just immediately below or references, put, your list of multi-cited sources, formatted as above, and then.
 * Use the more complicated "list-defined references" (LDR) style, in which each of these sources put inside a p, and these are in turn placed, not below, an extended  or p. 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.:. 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, in this case.