Template talk:Sfn
This page has archives. Sections older than 555 days may be automatically archived by Lowercase sigmabot III when more than 3 sections are present.
Names for the references?
Is it possible to add a name for ease of repeating? I just tried out the same template twice in a row and it did properly duplicate the reference number and have a single entry in the reflist, with two backlinks. But would it be possible to name them? Being able to cite multiple times, say, {sfn|foo|2023|p=50|refname=foo-50} and then subsequent calls would just go to {sfn|refname=foo-50} would be easier to work with than having to run {sfn|foo|2023|p=50} five times. --Golbez (talk) 17:33, 13 February 2023 (UTC)
- Take a look at {{harvnb}} (documentation and examples here). If you put it inside a ref tag, you can then repeat the named ref instead of repeating all of the harvnb details. – Jonesey95 (talk) 20:02, 13 February 2023 (UTC)
- @Golbez: One of the principal design features of
{{sfn}}
is that it does not need ref names. Another is that it's self-adjusting if one use is amended, you don't need to worry if the others are all still appropriate. Imagine that{{sfn|foo|2023|p=50}}
is used five times, because five different pieces of content are all verified by the same page. If you remove the first of these five, the ref detail does not need to be moved to one of the others, because it's already there. Now consider the situation that the first of the five pieces is expanded, perhaps by using material from page 51, you alter that one ref to{{sfn|foo|2023|pp=50–51}}
but leave the others alone because they don't use anything from page 51. --Redrose64 🌹 (talk) 11:51, 14 February 2023 (UTC)
Does WP:CITEVAR bar use of sfn in articles without pre arranged consensus?
Hi, I used sfn for some new citations in the Emotion article and my edit had the sfns removed in this edit for the reason that, referencing WP:CITEVAR, that I cannot introduce a new "citation style" without first gaining consensus.
I can see the POV of the editor, which by extension also means that editors cannot even employ cite templates for articles that do not yet employ them. I am a long time wikipedian but am seeking advice on how to avoid the time sink of fielding these sorts of objections in the future. I needed a place in the article to put the refbegin stuff and so I placed it in a separate subsection. I suppose I could have omitted the subsection and simply put the refbegin immediately following reflist in order to be a less visually obvious and thereby avoid this sort of objection. But it is not very tidy.
On the other hand, is the editor correct and sfn should not be introduced to an article without first gaining consensus on its use?
Any thoughts? J JMesserly (talk) 01:03, 6 March 2023 (UTC)
- I haven't looked at Emotion so I don't know what's appropriate for that article. It seems to me that if an article has citations that are well-done and, at some point, were consistent, then the existing style should be maintained. If the article has become much longer and contains many more citations that it used to, it might be time to discuss on the talk page whether it is time to introduce {{sfn}} to better organize the citations. There are other methods, such as {{Rp}}, that compete with sfn. I think it would be particularly inappropriate to introduce sfn in an article that already uses a competing method.
- Finally, if consensus is gained to introduce sfn, the one making the change should commit to reorganizing all the citations, not just introduce it for new citations. Jc3s5h (talk) 01:32, 6 March 2023 (UTC)
- (edit conflict)
- It is interesting to note that Emotion has two instances of
{{sfn}}
templates. The first one was added 20 September 2012 at this edit; its still there:{{sfn|Fox|2008|pp=16–17}}
. That{{sfn}}
was added when there was a mix of templated and non-templated citations. In the interim, the article has become more templated but still contains a fair number of non-templated citations. Consistent in style, it is not. - Right, this is the last that I have to say about this topic. Take the question to WT:CITEVAR.
- —Trappist the monk (talk) 01:53, 6 March 2023 (UTC)
- (edit conflict)
- I think that this is not a proper question for this template talk page. Questions about how WP:CITEVAR applies should be asked at WT:CITEVAR.
- —Trappist the monk (talk) 01:34, 6 March 2023 (UTC)
- Jc3s5h, so to understand you, your view is that for an established article such as this one with voluminous citations (the typical mixture of plain text, hard linked and cite templates within refs, that a discussion is necessary before sfn is first used for a new citation. If that is the prevailing view, I would prefer not to use the template at all. I would rather improve WP articles. J JMesserly (talk) 01:43, 6 March 2023 (UTC)
- @Trappist, thanks for the suggestion to also post there, but this inquiry is proper because I was also soliciting potential technical use assistance as a possible response to the difficulty. I am aware of the sfnref companion template, but potentially I anticipated there might be some other usage or companion template I am not aware of that can be used with sfn which will make it more acceptable to folks with the objection I ran into. J JMesserly (talk) 02:25, 6 March 2023 (UTC)
- There is nothing magic about sfn here. At any article with a well-established consistent style, new citations should be formatted in that style, and changes to that style should be discussed first. If an article's style is inconsistent and no consistent style can be found in its history, making its style consistent is less problematic. —David Eppstein (talk) 02:49, 6 March 2023 (UTC)
- Right David. I guess my comment should be made on WP:CITEVAR talk, but I agree that is the clear intent of the citation guideline. As Trappist pointed out, there was no consistent style, so why should an editor have to justify use of sfn if it has been used in the article for 11 years? As is unfortunately typical in wikipedia, for this article there was the usual opaque mess of plain text and idiosyncratic/ colourful uses of citation templates added in an ad hoc manner. J JMesserly (talk) 03:44, 6 March 2023 (UTC)
- There is nothing magic about sfn here. At any article with a well-established consistent style, new citations should be formatted in that style, and changes to that style should be discussed first. If an article's style is inconsistent and no consistent style can be found in its history, making its style consistent is less problematic. —David Eppstein (talk) 02:49, 6 March 2023 (UTC)
- Apparently there is no use of sfn or auxiliary templates which would avoid such objections. If there are ideas on the technical side, please post. Otherwise I agree with Trappist that observations on what the guidance should be for usage of sfn be made on the Citing sources talk discussion on this topic. If you have thoughts on the difficulty of introducing sfn and other useful templates to articles where they are rarely if ever used, please contribute your thoughts. J JMesserly (talk) 05:07, 6 March 2023 (UTC)
Missing title error using sfn for {{cite encyclopedia}}
Sfn does not appear to work with {{cite encyclopedia}}; a Missing or empty title
is shown. In the example below, the title
/entry
value is "Suffragist Movement", and I cannot specify a title
value in {{cite encyclopedia}} since I also need to cite other titles/entries of that encyclopedia using sfn (probably via loc
parameter). I tried doing the following:
{{sfn|Guillermo|2012|page=[https://books.google.com/books?id=wmgX9M_yETIC&pg=PA416 416]|loc="Suffragist Movement"}}
{{Cite encyclopedia |last=Guillermo |first=Artemio R. |url=https://books.google.com/books?id=wmgX9M_yETIC |encyclopedia=Historical Dictionary of the Philippines |date=2012 |publisher=[[The Scarecrow Press]] |isbn=9780810872462}}
- Guillermo, Artemio R. (2012). Historical Dictionary of the Philippines. The Scarecrow Press. ISBN 9780810872462 https://books.google.com/books?id=wmgX9M_yETIC.
{{cite encyclopedia}}
: Missing or empty|title=
(help)
Is there a solution/workaround to suppress that Missing title
error? Sanglahi86 (talk) 20:00, 20 April 2023 (UTC)
- The Missing or empty |title= error is not an
{{sfn}}
error. It is a cs1|2 error indicating that the{{cite encyclopedia}}
template is missing the entry title. If you rewrite{{cite encyclopedia}}
to include the entry:{{Cite encyclopedia |last=Guillermo |first=Artemio R. |entry=Suffragist Movement |url=https://books.google.com/books?id=wmgX9M_yETIC |encyclopedia=Historical Dictionary of the Philippines |date=2012 |publisher=[[The Scarecrow Press]] |isbn=9780810872462}}
- Guillermo, Artemio R. (2012). "Suffragist Movement". Historical Dictionary of the Philippines. The Scarecrow Press. ISBN 9780810872462.
- No Missing or empty |title= error.
- —Trappist the monk (talk) 20:45, 20 April 2023 (UTC)
- Unfortunately, I cannot specifically specify a fixed
entry
/title
value because I was trying to reuse the encyclopedia source by citing other entries of the encyclopedia (which is why I opted to use sfn). If I leave anentry
empty, that error occurs; I was hoping for a workaround, somehow. Sanglahi86 (talk) 20:59, 20 April 2023 (UTC)- Then treat the encyclopedia as a book without specifying the entry:
{{Cite encyclopedia |last=Guillermo |first=Artemio R. |url=https://books.google.com/books?id=wmgX9M_yETIC |title=Historical Dictionary of the Philippines |date=2012 |publisher=[[The Scarecrow Press]] |isbn=9780810872462}}
- Guillermo, Artemio R. (2012). Historical Dictionary of the Philippines. The Scarecrow Press. ISBN 9780810872462.
- —Trappist the monk (talk) 21:39, 20 April 2023 (UTC)
- If you link to the page where you are trying to make this happen, we may be able to help. There are a few workarounds. For example, you can use custom wikitext below the template example shown by Trappist the monk, along with anchors for the sfn template. – Jonesey95 (talk) 21:41, 20 April 2023 (UTC)
- Thanks, that definitely works. I avoided trying that very basic code since I thought entry parameter was an alias of title in cite encyclopedia. Regards. Sanglahi86 (talk) 22:37, 20 April 2023 (UTC)
- Then treat the encyclopedia as a book without specifying the entry:
- Unfortunately, I cannot specifically specify a fixed
Automatically support month and year in SFN links
It is often the case that I quote a series of articles that appear in different months of a magazine or journal. So you might have Smith May 1995 and Smith August 1995. The suggested solution is to "mangle" the date by adding a letter to the end. I would be fine with this if the letter was separate from the date, but changing something like date=May 1995 to date=1995a really makes my skin crawl.
Yes, I know I can override it with a |ref...
... but, is there any reason the template can't do this itself? That is, if the sfn has "more stuff" in the date part than just the year, it picks a more specific cite? For instance, sfn|Smith|May1995|p=6 would attempt to match on links for last=Smith date=May 1995, and if that fails, tries last=Smith date=1995.
Maury Markowitz (talk) 17:13, 2 May 2023 (UTC)
- Sources
- Smith (May 2020). Title A.
- Smith (August 2020). Title B.
- That doesn't look like anything "mangled" to me, and the visual impact and typing impact is minimal. View the wikitext to see how I made this happen. There may be another template, like {{Wikicite}}, that works better for your aesthetic needs. – Jonesey95 (talk) 00:58, 3 May 2023 (UTC)
- @Jonesey95, Redrose64, and Maury Markowitz: I just opened up the same discussion, not being aware of this one. I completely agree that the template should support a month or season, not just a year, for precisely the scenario Maury Markowitz described. It seems to go against the background WP principle to introduce as little original research (maybe not exactly applicable here, but the spirit seems to apply) as possible, and to let the reliable sources do the talking. Plus, I agree that it just doesn't look right. Scholarly bibliographies outside of WP never this, to my knowledge. I say, if there is a natural disambiguator already built into the reference, why not use it instead of a contrived one? Ergo Sum 00:38, 27 May 2023 (UTC)
Scholarly bibliographies outside of WP never this, to my knowledge.
Oh ... never say that somethingnever
happens. See Parenthetical referencing § Author-date 8th bullet point. And just to show that it isn't only en.wiki, this google search.{{sfn}}
is a variant of the{{Harvard citation}}
series of templates so it adheres to the generally accepted multiple-sources-with-the-same-author-and-date scheme.- —Trappist the monk (talk) 01:09, 27 May 2023 (UTC)
- @Ergo Sum: I took a look at John Bapst. I see that you are already using ref= in your citation templates. This creates the CITEREFlastYYYY anchor and it appears to be working. The Module:Footnotes used by {{sfn}}, {{harv}}, and {{harvnb}} has a section of code that checks parameters to see if they are a year
with or without lowercase letter
disambiguation, and it appears that it's written to interpret any unusual date/year names as author names. (Template editors and admins correct me if I'm wrong here.) - For sourcing edge cases you can always make the shortened footnote by hand. For example, the first citation: "
{{Harvnb|''Woodstock Letters''|July 1888|p=218}}
" renders the incorrect visual text: "Woodstock Letters & July 1888, p. 218" You could:- Hand write this with a wikilink, "
[[#CITEREFWoodstock_LettersJuly_1888|''Woodstock Letters'', July 1888]], p. 218
" which renders as, "Woodstock Letters, July 1888, p. 218" - Hand write this without a link: Woodstock Letters, July 1888, p. 218
- Use {{citeref}} where the final parameter is displayed text, "
{{Citeref|style=plain|''Woodstock Letters''|July 1888|''Woodstock Letters'', July 1888}}, p. 218
" which renders as, "Woodstock Letters, July 1888, p. 218" - And finally I experimented with a rigid harv template just meant to be used with {{sfnref}} and {{harvid}} for these kinds of edge cases, but I am hesitant to introduce another shortened footnote template if this is an uncommon issue. If there is a need for it something like, "
{{harvcat|''Woodstock Letters''|July 1888|p=218}}
" could render the same as the above examples.[1]
- Hand write this with a wikilink, "
- @Jonesey95, Redrose64, and Maury Markowitz: I just opened up the same discussion, not being aware of this one. I completely agree that the template should support a month or season, not just a year, for precisely the scenario Maury Markowitz described. It seems to go against the background WP principle to introduce as little original research (maybe not exactly applicable here, but the spirit seems to apply) as possible, and to let the reliable sources do the talking. Plus, I agree that it just doesn't look right. Scholarly bibliographies outside of WP never this, to my knowledge. I say, if there is a natural disambiguator already built into the reference, why not use it instead of a contrived one? Ergo Sum 00:38, 27 May 2023 (UTC)
- Sources
- And the source from the article:
- "Fr. John Bapst: A Sketch". Woodstock Letters. 17 (2): 218–229. July 1888. Archived from the original on May 26, 2023. Retrieved May 26, 2023 – via Jesuit Online Library.
- I hope something in this is helpful. I think the documentation could really benefit from an overview of all the conflicting ways to cite multiple pages. Feel free to ask more questions, Rjjiii (talk) 00:20, 4 June 2023 (UTC)
- And the source from the article:
- While the only place you need to display the a, b is in the short cite, the editor still has to code it in the full cites eg ref={{sfnref|Smith|2020a}} or 'mangle' the date within the full cite template, and the question remains - why not do the formatting automatically, and why not use the specific date if it naturally disambiguates the references? GraemeLeggett (talk) 07:08, 27 May 2023 (UTC)
- Sources
- Again, not mangled. --Redrose64 🌹 (talk) 13:33, 27 May 2023 (UTC)
- True, but that method adds the article to Category:CS1 maint: date and year and emits the corresponding maintenance message.
- —Trappist the monk (talk) 13:46, 27 May 2023 (UTC)
- I think that we tend to forget that some people print our articles. Hiding the year disambiguator in the long-form reference can make it difficult for a paper-copy-reader to determine which of the several long-form references is the one specified by a particular short-form reference. Also remember that these short-form templates are used for more than just periodicals. Don't make life harder for those readers solely for the sake of your aesthetic preferences.
- —Trappist the monk (talk) 13:46, 27 May 2023 (UTC)
I still haven't seen an answer to the actual question. Why can't it "just work"? Maury Markowitz (talk) 14:07, 27 May 2023 (UTC)
- Because no one has written the code to make
it "just work"
? This template is used on 140+ wikis so internationalization and date validation become issues.{{sfn}}
is a short-form Harvard style citation template. The de facto standard for disambiguating Harvard references is to add a lowercase alpha suffix to the publication year (the last positional parameter in a{{sfn}}
template).{{sfn}}
complies with that de facto standard. - —Trappist the monk (talk) 15:07, 27 May 2023 (UTC)
Numbers of authors
If more than four authors are given then the template still works, but a hidden error is flagged up. See for example the old version where {{sfn|Ingrey|Duffy|Bates|Shaw|Pope|2023}} generates a reference to "Ingrey et al. 2023." which links to the citation (Ingrey, L; Duffy, S; Bates, M; Shaw, A; Pope, M (2023), "On the Discovery of a Late Acheulean 'Giant' Handaxe from the Maritime Academy, Frindsbury, Kent", Internet Archaeology (61), doi:10.11141/ia.61.6). Not a major problem, and one that is easily fixed (see the edit by wham2001 (this diff), but odd that it should work when the documentation says otherwise. Martin of Sheffield (talk) 09:14, 10 July 2023 (UTC)
- Thanks for the ping Martin. I do wonder whether the current handling of citations with large numbers of authors could be improved. My understanding (albeit some of which is guesswork) of the rationale behind the current setup is:
- Having very long lists of authors in (rendered) shortened footnotes is cumbersome, unnecessary, and inconsistent with most style guides, so the template renders at most three authors and then reverts to "X et al."
- As a result, having more than four authors in the harv/sfn templates' parameters is unnecessary, and so is discouraged because it makes the wikitext cumbersome.
- Since the template has all the necessary information to produce a correctly formatted shortened footnote it has been made to work when there are more than four authors, because not doing so would be a disservice to our readers.
- The module only generates a warning in preview mode because listing more than four authors does not affect the rendering of the page (owing to point 3).
- The result is that, if an editor has not previewed their edit and carefully checked the preview, there is nothing in the saved page to indicate that anything is wrong (other than a hidden category, and who carefully checks the hidden categories after saving each edit? Nobody does.) Then they have to put up with their articles being gnomed to fix "errors" that they didn't know they'd made and which don't affect the article as displayed to the reader in any way. That doesn't seem optimal to me.
- Assuming point #1 in the list above we could fix this problem by changing the behavior in any of points 2 to 4. My view would be:
- #2 should not be changed, since there are many articles with very long author lists, which will lead to ghastly multi-line {{sfn}}s. Moving the number of authors at which the template generates a warning to, say, six will just add confusion.
- #3 should not be changed since replacing a working footnote with an error message would be a disservice to the reader.
- That leaves #4.
- Would it be an improvement to add, say, a warning / error in the rendered reference list for logged-in editors (similar to the "multiple-target error" warning) for shortened footnotes that contain an error which places the article in Category:Pages using sfn with unknown parameters? Such a change would affect very few articles, because that category is usually empty or almost empty, but it might help alleviate the problem that Martin raises.
- Best wishes, Wham2001 (talk) 10:48, 10 July 2023 (UTC)
- I'd strongly concur with that reasoning. IIRC I'd gone to the inline citation, generated the SFN and cut the inline, gone to the Bibliography, added the full citation, previewed, but only looked at the generated reference (annoyingly titled "Citations") and checked that it linked to the actual citation. I probably never scrolled right up to the top (since it was working) and then after publishing it didn't see a problem (since it's hidden). Possibly a bit sloppy, but who doesn't take short-cuts when everything seems to be working! I do stress though, whilst this may annoy gnomes, it doesn't affect the readers and therefore is a very minor issue, not even really a problem. Martin of Sheffield (talk) 11:16, 10 July 2023 (UTC)
- This template invokes two modules: Module:Footnotes which renders the actual short-form reference, and Module:Check for unknown parameters which renders the preview warning (and adds articles to Category:Pages using sfn with unknown parameters). Module:Footnotes
has been made to work when there are more than four authors
. In the normal way of things, when there are five positional parameters in{{sfn}}
, the fifth is expected to be a year. In OP's example, the fifth positional parameter (Pope) is not a year so the module examines the sixth and subsequent positional parameters for an assigned value that looks like a year. If a year is found, the module replaces the fifth positional parameter's value (Pope in the example) with the year (2023 from the sixth positional parameter in the example). - The multiple-target error message is visible to all readers. To see the no-target error message requires logged in users to add a line of text to their personal css. These messages may someday become visible to all readers.
- I see no real benefit from a modification to Module:Footnotes that would duplicate the categorization/error messaging accomplished by Module:Check for unknown parameters.
- —Trappist the monk (talk) 13:34, 10 July 2023 (UTC)
Baffling sfn error
While gnoming for articles in Category:Harv and Sfn no-target errors and Classical music, I came across the article Piano and String Quartet (Feldman) which had an error message "sfn error: no target CITEREFHamilton1993–1994" for citation #30. I was baffled because clicking on that link took me to that source and highlighted it, as expected. So why the message? Below is a simplified version of that citation; it shows that error message but clicking on the reference will highlight the source.
text.[1]
- Hamilton, Andy (December 1993 – January 1994). "Kronos Quartet". The Wire.
Why? How can it be fixed? -- Michael Bednarek (talk) 23:04, 7 August 2023 (UTC)
- That is a limitation in Module:Footnotes/anchor id list. Because it was easiest and because it is sufficient for most uses, that module understands only year–year ranges, circa years, years, and the no-date keywords. Those are sufficient for the module to extract the year portion from a lot of dates but, alas, not from month YYYY – month YYYY dates. I'll think about how to implement year extraction for this type of date.
- You can suppress the error message by adding
|ignore-err=yes
to the{{sfn}}
template. - —Trappist the monk (talk) 23:45, 7 August 2023 (UTC)
- I have applied a fix and so removed the
|ignore-err=yes
. - —Trappist the monk (talk) 18:28, 8 August 2023 (UTC)
Remove trailing '.' ?
{{sfn|...}}
adds a trailing period (example[1]), which is out of place, since the short footnote format does not produce a sentence, nor does the period serve any other apparent purpose. In contrast, {{refn|{{harvnb|...}}}}
does not (example[2]). There are also instances where one does not want a trailing period, depending on a loc=
parameter. Could we remove the trailing period from the {{sfn|...}}
output? Although there will be many affected articles, this change should not have a significant impact.