Archive 1Archive 3Archive 4Archive 5

New {{resfn}} template

I have just created the {{resfn}} template for invoking again a reference already defined via {{sfn}}. Any comments/ideas? --Grufo (talk) 09:25, 20 September 2020 (UTC)

Isn't that the same as using {{sfn}} again? Kanguole 09:32, 20 September 2020 (UTC)
Great, you are right. I don't know why I kept getting errors when using {{sfn}} again on the same page, and I always ended up typing the very annoying <ref name="FOOTNOTESmith200626">...</ref>. I apologize for the waste of template then. --Grufo (talk) 09:40, 20 September 2020 (UTC)
(edit conflict)I've been trying to work out what {{resfn}} does, I noticed it and it was new to me. As Kanguole says, it appears to just duplicate using {{sfn}} a second time. Wherein is the purpose? Martin of Sheffield (talk) 09:42, 20 September 2020 (UTC)
The purpose is that of avoiding the error "The named reference blabla was defined multiple times with different content" (or something similar), which at the moment I am not able to reproduce anymore :/ Any tips from other editors' personal experience? --Grufo (talk) 09:46, 20 September 2020 (UTC)

Found it!

Go to the page Marriage in ancient Rome, start editing it, and search for the text <ref name="FOOTNOTEStocquart1907305" />. Replace it with {{sfn|Stocquart|1907|p=305}}. You will notice that the following text will appear among the references:

Cite error: The named reference "FOOTNOTEStocquart1907305" was defined multiple times with different content (see the help page).

Now replace instead <ref name="FOOTNOTEStocquart1907305" /> with {{resfn|Stocquart|1907|p=305}}, and see what happens.

--Grufo (talk) 10:24, 20 September 2020 (UTC)

See also Old revision of Wikipedia:Sandbox for a more concise example --Grufo (talk) 10:55, 20 September 2020 (UTC)
OK, now I see what the problem is. When you use the |ps= parameter {{sfn}} spots the additional text. It is not used in the CITEREF string, and so will combine the two references, and then complain. Generally try to remeber that "sfn" stands for "shortened foot note" and avoid verbose inflations. I would suggest using {{sfn}} in its simple form and adding an extended footnote ({{efn}})if appropriate.[1][a] The {{sfn}} mechanism will then work as expected.[1]

Notes

  1. ^ "From matrimonium, we should distinguish; First, concubinatus, a union authorized under Augustus from the leges Julia et Papia, between persons of unequal condition, provided the man had no uxor. The concubina was neither uxor nor pellex, but uxoris loco. The children, issue of such a union, are neither legitimi nor spurii, but naturales. (Cod. 5, 27.) Second, contubernium is the perfectly regular and valid relation between a free man and a slave, or between two slaves. Through the civil law, it produced all the effects arising from the natural law.

References

  • Stocquart, Emile (March 1907). Sherman, Charles Phineas (ed.). "Marriage in Roman law". Yale Law Journal. 16 (5). Translated by Bierkan, Andrew T.: 303–327. doi:10.2307/785389. Retrieved 2020-09-15.
@Martin of Sheffield: But this is exactly why I created this template. The ps= case is one example, but there might be other cases where {{sfn}} defines a named reference multiple times. The {{resfn}} template grants instead that a reference is never redefined. --Grufo (talk) 11:29, 20 September 2020 (UTC)
(edit conflict)
No templates in section headers. I removed the section headers from your above posts.
Including extraneous text in a short form reference template ({{sfn}}, {{harv}}, and the like) is clearly contrary to the purpose of the templates: to be short. If the text that is included in the |ps= parameter is important to the article, use it in the article and then cite it. Don't clutter references with non-reference text. Yeah, I know, other editors disagree with this position.
If this {{resfn}} template is to be retained, it should probably be implemented by Module:Footnotes.
Trappist the monk (talk) 11:33, 20 September 2020 (UTC)
The "short" in "shortened footnote template" refers to the short way of citing a source (only surname and year), given afterwards in full details in the Bibliography. But it does not refer to how long what a source states must be. It is a normal usage in literature to have long quotations in footnotes followed by "Smith 2002" (for example). --Grufo (talk) 11:41, 20 September 2020 (UTC)
You see, other editors disagree with this position.
Trappist the monk (talk) 14:58, 20 September 2020 (UTC)
Whatever our disagreement about a quoted text might be, this template is not about the |ps= parameter, this template is about all the possible cases in which {{sfn}} might redefine a named reference, and it will always work simply because {{resfn}} refuses to create new named references, no matter how you invoke it. --Grufo (talk) 15:04, 20 September 2020 (UTC)
Why so defensive? Where have I said anything about how {{resfn}} works or what it does?
Trappist the monk (talk) 15:13, 20 September 2020 (UTC)
You are right, Trappist. I have been involved in quite many wiki disputes lately and I might have just got used to it. --Grufo (talk) 15:17, 20 September 2020 (UTC)

@Trappist the monk: I don't even know what programming language Module:Footnotes is (is that php? perl?), so I really would not be able to contribute. And even just the current {{resfn}} template is more like a beta version of a proposal than anything more. But if the idea is good I hope other editors more experts than me in dealing with Wikimedia templates can improve it. --Grufo (talk) 12:15, 20 September 2020 (UTC)

Lua.
Trappist the monk (talk) 14:58, 20 September 2020 (UTC)
@Trappist the monk: Ok, so, Module:Footnotes has a function, named strip_url(), to which {{sfn}}'s parameters |p=, |pp=, |page=, |pages= and |loc= are passed for sanitization. Unfortunately strip_url() is not a public function, so my template cannot access it. This means that none of the above parameters is sanitized in my template. This should not be a problem with every-day usage of |p=, |pp=, |page=, |pages=, but it definitely constitutes a problem with |loc=, whose support cannot be implemented without accessing the same Lua function (strip_url()).
I have seen just now that you are the author of Module:Footnotes. What would you think about exporting strip_url() as a public function? As until few hours ago I did not even know what Lua looked like, I will just stop here.
--Grufo (talk) 16:21, 20 September 2020 (UTC)
I was thinking that with a tweak, sfn() could render {{resfn}} by skipping the call to core() and setting result to an empty string.
Trappist the monk (talk) 00:24, 21 September 2020 (UTC)
Yes, from within Module:Footnotes it would be really simple to implement {{resfn}}, since it literally consists in producing a void content. --Grufo (talk) 14:02, 21 September 2020 (UTC)

Recently reverted mentions of the new resfn template in other template documentation

I noticed in my watchlist that Redrose64 reverted Grufo's edits mentioning the new {{resfn}} template in other template documentation (see 1, 2, 3). Since this page appears to be where most of the discussion of Grufo's new {{resfn}} template is happening, I thought I would mention the reverts here since the reverts suggest some conflict about the rationale for the new template.

Like Redrose64 (apparently), I am skeptical about the need for the new {{resfn}} template. Why create a new template—why not just document this particular limitation of {{sfn}} in its documentation and explain how to work around it using a named <ref /> tag? It may be too rare of a limitation to justify a new template: Grufo even had trouble reproducing the limitation, as seen above! Biogeographist (talk) 02:27, 21 September 2020 (UTC)

The text that was reverted did not adequately explain why someone would use {{resfn}}, so it was not helpful. There is more at Template talk:Resfn. As far as I can tell, {{resfn}}'s functionality is supposed to be "act like sfn but use the |ps= value from the originally defined sfn template with the same author/year/page combination". But I am a poor mind-reader. The template's author claims, but has not yet demonstrated, that there may be other uses. I created a testcases page to try to help the template's author show how the template might be useful. – Jonesey95 (talk) 04:15, 21 September 2020 (UTC)
The edits that I reverted showed no situation that {{sfn}} could not have been used for, no suggestion that any advantage was being provided by using {{resfn}} instead. What I saw was a misunderstanding of the purpose of {{sfn}}, it is designed for multiple use, and may be seen used in that way at several recent TfAs, such as Ismail I of Granada, Battle of the Bagradas River (255 BC) or Qibla. --Redrose64 🌹 (talk) 10:24, 21 September 2020 (UTC)
Thank you for your intervention, Biogeographist. I think first we need to make clear what we are talking about. If we look at a footnote, we can schematize it as follow: <ref name=REF_NAME>REF_CONTENT</ref>. When an editor invokes {{sfn}}, the latter always produces an output for REF_NAME, but it might produce an output for REF_CONTENT or not, depending on several considerations. Currently, in the cases where {{sfn}} would emit a REF_CONTENT despite an editor does not want it, the only solution is to write by hand <ref name=REF_NAME /> (using a very complicate REF_NAME) – which is a bit bizarre, since there is currently an effort from Wikipedia against having to write by hand the <ref> tag.
Take the example I gave above from Marriage in ancient Rome. Imagine someone erases from the page {{sfn|Stocquart|1907|p=305}} and consequently <ref name="FOOTNOTEStocquart1907305" /> returns an error. For someone not skilled enough in HTML, finding what FOOTNOTEStocquart1907305 referred to will be a nightmare. While if the {{resfn}} was used instead of <ref name="FOOTNOTEStocquart1907305" />, it would be as simple as switching back from {{resfn}} to {{sfn}}.
In summary, {{resfn}} is nothing else than a variant of {{sfn}} where REF_CONTENT is always void, no matter how {{resfn}} is invoked.
--Grufo (talk) 14:00, 21 September 2020 (UTC)
Thanks for the explanation—that makes it much clearer for me. If the template is kept, I agree with others that the documentation should be much clearer. What you just wrote above is a good first step. I wasn't aware that there is currently an effort from Wikipedia against having to write by hand the <ref> tag. Biogeographist (talk) 14:42, 21 September 2020 (UTC)
The <ref> tag is not deprecated, the effort is just visible from the number of templates produced (and actively used) for footnotes. The relationship between {{resfn}} and {{sfn}} would bit more or less like the one between {{r}} and a generic named note not defined via {{sfn}}. --Grufo (talk) 15:32, 21 September 2020 (UTC)
I'm glad to hear that the humble <ref> tag is not passé, since I am more inclined to write <ref name=Smithsays>{{harvtxt|Smith|2020|p=1}} says blah blah blah...</ref> and <ref name=Smithsays/> than to try to stuff it all into a {{sfn}} template, though I will happily use {{sfn}} for short citations without the "blah blah blah..." Biogeographist (talk) 17:24, 21 September 2020 (UTC)
The construction in Marriage in ancient Rome is strange, and one that I have never seen in my editing of thousands of articles using {{sfn}}. I'm not sure why someone wouldn't just follow the guidance in this template's documentation and use {{harvnb|Stocquart|1907|p=305}} inside ref tags, which is much easier to parse and will not break if the original sfn template is removed. If resfn is a shortcut to that syntax, its documentation should explain that usage. – Jonesey95 (talk) 15:43, 21 September 2020 (UTC)
The {{harvnb}} template is not specific for creating a void REF_CONTENT, but its purpose is that of not enclosing a reference within the <ref>...</ref> tags (so, nearly the opposite). As such, if used for our scenario, it would have the inconvenience of duplicating identical footnotes. It seems to me that using {{harvnb}} for our case is more like an ugly workaround for something that {{resfn}} would do with a better result. --Grufo (talk) 16:01, 21 September 2020 (UTC)
{{sfn}} works fine for identical footnotes. The problem arise when you want to make them different, using |ps=. There's no sensible way to merge them in that case. Kanguole 16:11, 21 September 2020 (UTC)
That of a different |ps= is a different case. As the two footnotes would effectively be two different footnotes, if a differentiation is to be implemented this must be done within the {{sfn}} template. This could be done by introducing a |marker= parameter for example, or by hashing the |ps= parameter via Lua – but these are just ideas for another discussion with {{sfn}}'s author. But it would not concern {{resfn}}, as the latter deals only with producing a shortened footnote with an empty REF_CONTENT.
Kanguole: If two sfn footnotes have different |ps= values but the same author/year/page values, they are different footnotes, and they currently generate an error message. The documented {{harvnb|Stocquart|1907|p=305}} inside ref tags method is the only way to work around the problem today, AFAIK. The new {{resfn}} template reuses the |ps= value from the first {{sfn}} template (as shown in this test case), so it does not meet the need (yet?) of people who want to use two sfn footnotes with different |ps= values but that otherwise match. – Jonesey95 (talk) 20:10, 21 September 2020 (UTC)
I'm still not convinced of the need. Here's the relevant portion of Marriage in ancient Rome#Concubinage:
A ''[[concubinatus]]'' (Latin for "concubinage" – see also ''[[wikt:concubina|concubina]]'', "concubine", considered milder than ''[[wikt:paelex|paelex]]'', and ''[[wikt:concubinus|concubinus]]'', "bridegroom") was an institution of quasi-marriage between Roman citizens who for various reasons did not want to enter into a full marriage.{{sfn|Stocquart|1907|p=304}}{{sfn|Treggiari|1981|p=58|ps=, note #42: "Marriage existed if there was ''affectio maritalis'' on the part of both parties. For the difficulty of determining whether a relationship was marriage, see for example [[Cicero|Cic.]] ''[[De Oratore|de Or.]]'' 1.183, [[Quintilian|Quint.]] ''Decl.'' 247 (Ritter 11.15), ''Dig.'' 23.2.24, Mod. 24.1.32.13, [[Ulpian|Ulp.]]; 39.5.31 pr., Pap."}} The institution was often found in unbalanced couples, where one of the members belonged to a higher social class or where one of the two was [[libertus|freed]] and the other one was [[Ingenui|freeborn]].{{sfn|Rawson|1974|p=288|ps=: "Concubinage seems to have been most frequent amongst freed persons."}} However it differed from a ''[[contubernium]]'', where at least one of the partners was a slave (see below).{{sfn|Stocquart|1907|p=305|ps=: "From ''matrimonium'', we should distinguish; First, ''concubinatus'', a union authorized under Augustus from the ''leges [[Lex Julia|Julia]] et [[Lex Papia Poppaea|Papia]]'', between persons of unequal condition, provided the man had no ''uxor''. The ''concubina'' was neither ''uxor'' nor ''pellex'', but ''uxoris loco''. The children, issue of such a union, are neither ''legitimi'' nor ''spurii'', but ''naturales''. (Cod. 5, 27.) Second, ''contubernium'' is the perfectly regular and valid relation between a free man and a slave, or between two slaves. Through the civil law, it produced all the effects arising from the natural law.}}{{sfn|Treggiari|1981|p=53}}
There are five instances of {{sfn}} here, three of which use |ps= and they're all rather lengthy. The point about {{sfn}} is that it produces shortened footnotes, that's why it has the name. If you feel that you need to give such a huge amount of supporting information for a reference, that tells me that one of these things is occurring:
  1. it's not a reliable source so you're attempting to boost its credibility
  2. you're synthesising your own interpretation of the source text by "showing your working" to show how one leads to the other
  3. you feel that the source uses some obscure terms which could benefit from explanation
  4. you need to clarify which portion of the source supports the referenced sentence, but a page number is insufficiently precise, so use a direct quotation
I really hope it's 3 or 4; for no. 3, have you considered using {{efn}}/{{notelist}} for those explns, or even making them part of the main text? For no. 4, it would be better to use e.g. {{sfn|Smith|2020|loc=p. 123, para. 4}} which is distinct from {{sfn|Smith|2020|p=123}} and no error will be thrown if both are used.
I have been back through the archives of this page, and the following are relevant: Template talk:Sfn/Archive 1#Allowing quotes as an attribute; Template talk:Sfn/Archive 1#Option to remove terminal full stop in short form; Template talk:Sfn/Archive 2#Postscript; Wikipedia:Village pump (technical)/Archive 141#Citation error; Template talk:Sfn/Archive 2#Interaction with new cite error detection; this edit; Template talk:Sfn/Archive 2#Muiltiple sfns with a single "ps:" field; and Template talk:Sfn/Archive 3#Problem with "ps". --Redrose64 🌹 (talk) 20:49, 21 September 2020 (UTC)
@Redrose64: Despite in the case of a long |ps= I would definitely opt for {{resfn}}, the template itself is not directly related to the length of a quotation. I have created a comparison of the same short quotation referenced many times, in one case using only {{sfn}} and in the other case using {{sfn}} + {{resfn}}. You can find my comparison here. As you can see, using only {{sfn}} you have to repeat the same quotation many times – and I have chosen a very short sentence for this example. --Grufo (talk) 21:41, 21 September 2020 (UTC)
I've just tried to add an alternative to show that your example is incomplete. However the sandbox is never still and your example has been overwritten many times now. It would be better in future to use your personal sandbox to avoid this issue. I've copied your original to one of my sandboxes here (genuine contributors to this discussion are invited to add to it). I've added another stanza showing how to do it in two different ways using the existing templates. Martin of Sheffield (talk) 08:03, 22 September 2020 (UTC)

That is what I meant with my answer to Jonesey95. Your example (at User:Martin of Sheffield/sandbox3 § Using standard templates) produces a result that is not desirable in my opinion: two different footnotes and the disappearance of the quotation in one. Of course this could be solved by using <ref name="SOMENAME">{{harvnb|...}}</ref> the first time, and <ref name="SOMENAME" /> all the other times… But then we would just be using our old affectionate <ref> tag for all our notes. P.S. Thank you for giving us a sandbox under your username. Whether we use that or we use the public Wikipedia:Sandbox for our examples, we should always reference our edits as {{oldid}} or {{oldid2}} as I did before, so that our links are truly permanent. --Grufo (talk) 09:56, 22 September 2020 (UTC)

(edit conflict) There are only two different references because I forced "eiusmod" to be different to show the alternative. I could have more easily just used the {{sfn}} and then reference [3] would not exist. I don't follow "the disappearance of the quotation in one". It is clearly there under footnote [a]. Martin of Sheffield (talk) 10:19, 22 September 2020 (UTC)
The note after “ullamco” does not have a quotation. And if you do insert it in the same way you did for the first line (the note after “sed do”) it will be a very confusing quoting… Imagine you had many sources in the same point… We would see something like [1][a][2][3][b][5] – a nightmare. --Grufo (talk) 10:48, 22 September 2020 (UTC)

FWIW I like this new template. It seems like a much better way of resolving the cite error than what Help:Cite errors/Cite error references duplicate key#Sfn recommends at present. – SD0001 (talk) 07:21, 21 September 2020 (UTC)

FWIW I agree. --Grufo (talk) 14:21, 21 September 2020 (UTC)
I am late to this discussion, but to avoid this issue, I would use |loc= as the in-source location when the author-year-page are identical. Btw the error used to be generated with various iterations of {{sfn}}, including {{sfnm}} in the same page. So this: {{sfn|Author|2020|p=1}} in the same page as this: {{sfnm|1a=Author|1y=2020|1p=1|2a=Author2|2y=2019|2p=2}} would also generate an error. At least until a few years back, it is not the case now. My solution was {{sfn|Author|2020|p=1}} and in subsequent usage, {{sfn|Author|2020|loc={{p.|1}}}}. The |loc= label also works in the rarer case where you have more than two such instances, as long as you format the location differently e.g. {{sfn|Author|2020|loc=p. 1}}. All these are still hacks of course. 98.0.246.242 (talk) 02:13, 30 December 2020 (UTC)

Web citations

I am trying to fix sfn errors in Christopher Codrington. References 9 and 10 are to undated websites so the sfns don't link to the sources. Should they be changed from sfn to cite web style, or is there a better way to resolve this? TSventon (talk) 20:29, 21 January 2021 (UTC)

You might rewrite them as:
{{sfn|Codrington College|ref=Codrington College}}
{{sfn|The Codrington School|ref=The Codrington School}}
Trappist the monk (talk) 20:43, 21 January 2021 (UTC)
Or use {{sfnref}} inside the |ref= parameter of {{cite web}}, like this. I think that is more common. – Jonesey95 (talk) 20:46, 21 January 2021 (UTC)
Thank you Trappist the monk and Jonesey95 I fixed my own sfn error at Association for the Education of Women but Codrington was a bit more complex. TSventon (talk) 22:08, 21 January 2021 (UTC)

Problem with ps=

See X[1] Y[2]

vs X[3] Y[3]

  • smith (2021), an article by smith
The location within the text belongs in |loc= rather than |ps=, e.g. X[4], Y[5], Z[4] Kanguole 13:06, 30 January 2021 (UTC)
Thanks. Wtmitchell (talk) (earlier Boracay Bill) 15:36, 30 January 2021 (UTC)

References

  1. ^ smith 2021, article 123.
  2. ^ smith 2021, article 456.
  3. ^ a b smith 2021, article 123. Cite error: The named reference "FOOTNOTEsmith2021" was defined multiple times with different content (see the help page).
  4. ^ a b smith 2021, article 123.
  5. ^ smith 2021, article 456.

Translator without author

The sfn template doesn't seem to work if the ref has a translator without an author, which is the case with most of the ancient Hindu texts. What is broken is the clicking of the "Last 2000" link as well as the modal window that appears when you hover your mouse over the link.

<ref>{{cite book |title=Title |translator-last=Last |translator-first=First |year=2000}}</ref>
{{sfn|Last|2000|p=2}}

Jroberson108 (talk) 04:15, 7 March 2021 (UTC)

Use |ref={{sfnref|Last|2000}} in the {{cite book}} template to create a match for the {{sfn}} template. See Template:SfnRef#Examples. – Jonesey95 (talk) 05:56, 7 March 2021 (UTC)

Does ref= do anything?

I am finding examples of people setting it to harv. AManWithNoPlan (talk) 15:59, 18 April 2021 (UTC)

In the citation templates, |ref=harv used to set the name of the reference using author surnames and year, but that behaviour is now the default, so |ref=harv is redundant. I don't think it ever did anything useful in {{sfn}}. Kanguole 16:44, 18 April 2021 (UTC)
It is possible to set |ref=harv in an {{sfn}} template:
{{sfn|Blue|Black|2021|ref=harv}}
That creates a link to an anchor #harv so one could do this (using the above {{sfn}}[1]:
{{anchor|harv}}Some text linked from the {{tld|sfn}}Some text linked from the {{sfn}}

References

The target 'Some text ...' doesn't highlight blue because it isn't wrapped in a <span id="CITEREF...">...</span> tag.
|ref= in {{sfn}} allows editors to override or customize the target link; useful I suppose when linking to non-cs1|2 targets.
Trappist the monk (talk) 16:57, 18 April 2021 (UTC)
There were 568 articles using |ref= as of the most recent monthly Template Data report. If |ref= is set to "harv", it is probably an error. – Jonesey95 (talk) 21:49, 18 April 2021 (UTC)
@AManWithNoPlan:, You asked if |ref= does anything? Besides the |ref=harv example you asked about and which has already been answered, it can be used to set the value to be used with {{sfn}} when no authors (or no year) are available in a citation, or where there are a lot of authors, and you want a shorter sfn. Typically, this is done with the aid of template {{harvid}} because it's much easier that way. See several examples of this at Liberation of France#Works cited, including {{sfn|JOFF}} for linking to a reference coded as {{cite book ... |ref={{harvid|JOFF}} }} for the official journal of Free France, which is a governmental bulletin something like the Congressional Record. Mathglot (talk) 18:38, 18 May 2021 (UTC)

Problems dereferencing sfns embedded in remote NoteTagged passages

Hi, in articles with large numbers of citations, I use sfn's and template notetag to remove the inline <ref> clutter in the interests of making it less confusing for new contributors to make additions. However in the case of notetagged material, if it has an sfn within it, I cannot place the note at the end of the article and refer to it by name, or I will get redtext warnings that the sfn referents were not resolved. An example may make this more clear. For example, in the Trumpism article, notetag Jones2012 works just fine because it has no sfns. But notetag|name=Goldberg1 text does not if it is moved to the notes section as with the Jones note. If you try this and preview the result, you will see the error red text I am talking about. I have tried Ref=sfnref to address what I anticipate is a template processing order of dereferencing issue, but to no avail. Putting <ref>'s in the notetag works, but this solution junks up the footnote section with voluminous material that belongs in the bibliography section. Any suggestions? I can live with the inline notetag clutter as you see in the example article but I suspect others may have found a solution to this annoying situation. If there is no immediate answer, please ping me even if your suggested solution occurs to you years from now. Thanks in advance for any suggestions on workarounds which will be reasonably copyable by wiki editors. Even random ideas on what I could experiment with. J JMesserly (talk) 02:33, 18 May 2021 (UTC)

You might be looking for Wikipedia:Nesting footnotes. – Jonesey95 (talk) 13:57, 18 May 2021 (UTC)
Thanks for the pointer, but the example I gave with <ref>s inside a notetag is effectively what the Nesting footnotes page describes with refs within a refn. That does work, but is unacceptable for the stated formatting reasons. It does give me an idea on something else this page does not describe but the wikimedia engine might support. Thanks. J JMesserly (talk) 20:44, 18 May 2021 (UTC)
@J JMesserly: When I ran into something similar to what you are describing, someone helped me tie what I was seeing into a known bug being tracked on Phabricator. I can't remember who it was; maybe Izno or WhatamIdoing? Mathglot (talk) 18:00, 18 May 2021 (UTC)
@J JMesserly, if you don't want to look at wikitext markup code any more than necessary, then have you considered using the visual editor instead? It works like a word processor. Click on https://en.wikipedia.org/w/index.php?title=Trumpism&veaction=edit to see it in action. It's awesome for tables (insert, delete, and rearrange columns at the click of a button...) and really helpful for copyediting. There's no real need for anyone to be dealing with clutter in the interface. WhatamIdoing (talk) 00:59, 19 May 2021 (UTC)
I have gotten quite comfortable with wikitext over the past 18 years and was quite annoyed with the visual editor when it came out and haven't taken a more recent look. I guess I assumed wrongly that novice editors would be intimidated by the heavy citation markup of complicated articles like Trumpism. (300+ cites). It's good to know that this is less of a problem than I thought. Do most people use this now? If so, then my motivation for finding a solution to this would be much reduced. 01:46, 19 May 2021 (UTC)

Sfn with author and abbreviation but no year

I'm not 100pc sure whether this is the best place to look. Regardless, I'm working a lot with Sfn for modern works and I'd also like to use them for ancient ones. While the citation of Plutarch, Life of Brutus (for example) can be worked around page numbers using the loc parameter, the date isn't important at all.

While I can get Sfn to produce serviceable author-year pairs for modern works and also for the translation editions of ancient ones, when you have "Plutarch 1917" and "Plutarch 1918" referring to "Life of Pompey" and "Life of Brutus" respectively, this becomes less useful.

Instead, is it possible to get Sfn to produce footnotes like "Plut. Brut. 3.2" or "Plutarch, Life of Brutus 3.2" where the title of the work (Brut, Life of Brutus) is given a wiki-link? I've already tried something like creating a harvid Plutarch|''Life of Brutus'' but this is interpreted as a separate author (ie "Plutarch & Life of Brutus") rather than something like a title, so I'm stumped. Ifly6 (talk) 04:07, 21 May 2021 (UTC)

(edit conflict) You could do something with {{sfnref}} like |ref={{sfnref|Plutarch, ''Life of Brutus''}} and then call it with {{harv|Plutarch, ''Life of Brutus''|loc=3.2}} So that'd look like:
Plutarch, Life of Brutus, 3.2 — short citation linked to....
Plutarch. Life of Brutus. Translated by Translator. Publisher. {{cite book}}: |translator= has generic name (help) — full citation, with {{sfnref}} in |ref=
Umimmak (talk) 04:14, 21 May 2021 (UTC)
@Ifly6:, Yes, you can, use the |ref= parameter, and the {{harvid}} template.[1] Mathglot (talk) 08:44, 21 May 2021 (UTC)

Works cited

Refs and notes

My thanks both to Umimmak and Mathglot for showing me this alternative formulation. Ifly6 (talk) 16:13, 21 May 2021 (UTC)

Sfn usage with multiple sources with no years

Hello, looking at the template page, I don't see an example usage with more than one source from the same author but with no year for both sources, so I'm not sure how I can repeat 2007a and 2007b type usage when doing something like source1: {{sfn|Author|n.d.e}} and source2: {{sfn|Author|n.d.e}}. My specific example is here on this edit - I use n.d.e. and n.d., which feels improper. Does anyone have a suggestion on this? --Engineerchange (talk) 02:03, 29 May 2021 (UTC)

@Engineerchange: you can use {{harvid}} similar to the example above. Ping me if you need a fuller explanation. Mathglot (talk) 02:24, 29 May 2021 (UTC)
In this particular case, you are using a distinct "Author" too (ACS1 and ACS2), so there would be no need to distinguish the date parameters. Why "ACS", did you intend "ACM" (Anacostia Community Museum)? Some editors use work titles (or parts of them) in italics when necessary, which is where you would need {{harvid}} in the citation : in this case you could use During Slavery and in Maryland as short distinctive names. The date parameter can be omitted with a single "Author" – "n.d.e." is just cluttering up the table here. --Mirokado (talk) 02:34, 29 May 2021 (UTC)
@Mirokado: excellent! worked like a gem, thank you! --Engineerchange (talk) 02:50, 29 May 2021 (UTC)

Throwing an error when a reference is absent?

What needs to happen to change the code for "{{sfn}}" to check to see if the reference cited is actually available and to provide a user friendly error message when it's not?

User:Tamerlanahayav added {{sfn|Geiger|2012|p=86}} to World War II without adding the reference. When I clicked on "Geiger", it did nothing, because it did not know where to go. That's a deficiency in the article on "World War II", but I would think there should be a way to inform a user when they've added a reference to something that's not there. In this case, {{sfn|Geiger|2012|p=86}} displays with "Geiger 2012" blue and underlined, which suggests that I should be able to click on it and get more information about it. However, in this case, when I click on it, nothing happens.

At minimum, I think it should display as red to make it easier for the user who inserted {{sfn|Geiger|2012|p=86}} to see that something is missing. I think it would be better if it displayed a more informative error message when a user presses "Show preview".

Thanks, DavidMCEddy (talk) 14:42, 19 June 2021 (UTC)

See Category:Harv and Sfn template errors to learn how to show various errors.
Trappist the monk (talk) 14:46, 19 June 2021 (UTC)
Thanks, but shouldn't the software be REQUIRED to notify a user when they insert a reference like {{sfn|Geiger|2012|p=86}} without a complete citation to "Geiger 2012" someplace else in that Wikipedia article?
Currently, users get no notice of a need to add a reference to which something like {{sfn|Geiger|2012|p=86}} refers. In other contexts, when someone inserts a broken link, it appears as red. That alerts the user that there's something wrong. This doesn't do that.
User:Tamerlanahayav may eventually see my complaint above and fix the error introduced by inserting {{sfn|Geiger|2012|p=86}} without the complete citation. I think a user who commits an error like this should be notified immediately , like they are when they introduce other broken links. It shouldn't require someone like me to pester them ;-) DavidMCEddy (talk)
Were it up to me, I would have Module:Footnotes emit visible error messages. Alas, it is not up to me. The community have decided that because of the issue of false positives, the error messages emitted by Module:Footnotes must be hidden from editors who have not elected to enable error message display.
Trappist the monk (talk) 16:37, 19 June 2021 (UTC)
@DavidMCEddy: Re when someone inserts a broken link, it appears as red and I think a user who commits an error like this should be notified immediately , like they are when they introduce other broken links. - red links are not "broken links", they are also not necessarily errors. See WP:REDDEAL. --Redrose64 🌹 (talk) 08:21, 20 June 2021 (UTC)
@Redrose64: Thanks for the reference to WP:REDDEAL.
What do you think should happen when a user inserts something like {{sfn|Geiger|2012|p=86}} into an article for which no reference mating "Geiger|2012" can be found in that article?
In this case, User:Tamerlanahayav received no notice of a problem at the time. I posted a question here just over two hours later that included {{re|Tamerlanahayav}}, and another user reverted the addition entirely roughly 14 hours later, noting, "unverifiable without full citation, presumably copied from another article without attribution. This is a GA."
However, if User:Tamerlanahayav does not have a working email properly associated with their account (and they are "Watching" that article), they may never find out there's a problem with what they did unless they manually happen to check that article again. DavidMCEddy (talk) 13:48, 20 June 2021 (UTC)
While I came down on the side of hiding the warnings by default (and let's remember that the on-switch, and Category:Harv and Sfn no-target errors at 25K+ entries, are there for gnomes' pleasure), I interpreted DavidMCEddy's request to ask for a warning message on preview only. No doubt that's an over-interpretation, and I seriously doubt it's possible for the preview to suppress warning on pre-existing sfn/harv errors, but I can dream. David Brooks (talk) 14:22, 20 June 2021 (UTC)
There are some cases of spurious errors which only appear in preview mode, so that would be a hindrance for editors who have not chosen to see them. --Mirokado (talk) 14:53, 20 June 2021 (UTC)
@Editor Mirokado: There are some cases of spurious errors which only appear in preview mode Are you talking about {{sfn}} errors? If you are, can you provide evidence to support that claim? Can you provide examples of where these errors occur?
Trappist the monk (talk) 15:42, 20 June 2021 (UTC)
Thanks for encouraging me to investigate further. While doing so I noticed Category:Harv and Sfn template errors#Displaying error messages and updated to your current script User:Trappist the monk/HarvErrors.js. With that new script the problems I was seeing seem to have gone away. Well done. --Mirokado (talk) 22:26, 20 June 2021 (UTC)

Problems with Sfn

@Tamerlanahayav: {{sfn|Geiger|2012|p=86}} was just added to World War II without adding anything like Geiger (2012) to the World War II#References. As a result, when I clicked on Geiger, I got nothing. I don't have any idea about how to find that reference.

Beyond that, I'm negatively impressed with the use of "{{sfn}}" because it's very hard for someone not familiar with Wikipedia to understand.

I vastly prefer to enter a reference into Wikidata and then reference it using template:Cite Q. This has the same problem of being hard for someone not familiar with Wikipedia to understand, except that you can click on the QID and it will take you to the Wikidata entry. In this case, clicking on "Geiger 2012" did NOTHING for me except generate mild frustration at not being able to find the said reference.

To illustrate the use of "Cite Q", suppose I want to cite Kahneman's Thinking, Fast and Slow: I start by entering that name into https://www.wikidata.org/. This tells me it's already there with a QID = Q983718. I take that QID to wherever I want to use it and write, {{cite Q|Q983718}}<!-- Kahneman, Thinking, Fast and Slow-->. This displays as Daniel Kahneman (25 October 2011), Thinking, Fast and Slow, New York: Farrar, Straus and Giroux, OCLC 706020998, OL 15992072W, Wikidata Q983718.

I add ...<!-- ... -->, which is a comment, so an editor can see what's actually being cited.

If I don't find the item I want in Wikidata, I can create a Wikidata entry for it. It takes me more time to create a Wikidata entry than to complete a citation template in an article, but that's only true if the item is not already in Wikidata.

AND using WikiCite / Wikidata like this has other advantages:

  • If the item is already in Wikidata, it's much quicker to cite it than to complete a standard citation template.
  • A Wikidata entry is more robust to link rot, because if the same resource is cited in multiple places, fixing it once fixes it for all uses. That's not true if the template is completed separately for each use.
  • Similarly, Wikidata entries that are used multiple places are more likely to be more accurate and more complete and therefore more valuable than individual citation templates, because when I look at a Wikidata entry that's already there, I often find a way to improve it.
  • Also, in entering "Author" in Wikidata, I nearly always use a Wikidata entry for that author. Again for an author who is not already in Wikidata, this is more work. However, when there is more than one person with the same name like James Brown (disambiguation), Wikidata makes it relatively easy to be clear about which "James Brown" is being cited in a particular context. By contrast, I don't know how to make such distinctions using the more traditional citation templates.

By the way, Mike Peel and Andy Mabbett have offered to make a presentation at Wikimania 2021, August 13-17, on "Automatically maintained citations with Wikidata and Cite Q". This year's Wikimania will be virtual, which means that anyone interested should be able to attend without travel. I've attended Wikimania three times before and WikiConference North America twice, including the virtual conference late last year. I've found them to be quite valuable. For example, I learned what I know about WikiCite mostly from asking questions at Hackathons at previous Wikimanias. DavidMCEddy (talk) 03:55, 19 June 2021 (UTC)

This is not really the place to express your opinion of {{sfn}} or to discuss perceived benefits or drawbacks of cs1|2 / {{cite q}} / Wikidata. This is the correct venue if you have an issue with {{sfn}} that needs to be addressed.
Trappist the monk (talk) 10:46, 19 June 2021 (UTC)
An off-topic ramble, indeed. I love the assertion that sfn is confusing but Cite Q is somehow easier and better. I especially enjoy that the above example of Cite Q has an author name that would not comply with CITEVAR in most articles, along with an ISBN used as an ASIN, which displays a red error message. The former issue has been discussed at length at the Cite Q talk page. The latter, thank goodness, is subject to DavidMCEddy's assertion that Wikidata entries are easy to improve. (BTW, the answer to the implied question in the last bullet is |author-link=, which is documented at e.g. Template:Cite_book#Authors). – Jonesey95 (talk) 13:46, 19 June 2021 (UTC)
Yep. A complete waste of byteage. Cite Q indeed, for a litany of errors. ——Serial 13:56, 19 June 2021 (UTC)


I just want to address the first thing you brought up at the top. I am strongly opposed to the idea of "automatically" fixing a reference like the one above. The citation is bad, and it should remain bad until an editor is able to check the source (by reading the actual source) and make sure that it actually verifies the text. This citation is missing -- it's a {{citation needed}}. Automatic fixes should not be applied. ---- CharlesGillingham (talk) 22:24, 27 June 2021 (UTC)

Prefatory signals

Is there a way (or would it be possible to add one) to add prefatory signals to this template? For instance, could a parameter be added that would turn a "Smith 1998, p. 1" citation into "see Smith 1998, p. 1" or "but see Smith 1998, p. 1" citations, to signal citations that add general support, or that, while relevant, go against the trend? --Usernameunique (talk) 04:32, 12 August 2021 (UTC)

Usernameunique, the straightforward way to do this at present is with {{harvnb}}; i.e. <ref>''however, see'' {{harvnb|Smith|1998|p=1}}</ref>. Wham2001 (talk) 06:48, 12 August 2021 (UTC)

Request for help from Teahouse

Teahouse volunteer here. Anyone know how to help this person? Wikipedia:Teahouse#Hu Nhu: Formatting Assistance TimTempleton (talk) (cont) 22:15, 11 August 2021 (UTC)

Hello all, I inquired of the Teahouse about this help. I have just discovered the problem and will address it. Kind regards,Hu Nhu (talk) 23:31, 11 August 2021 (UTC)
Solved - it was a piping issue. Not a template problem. TimTempleton (talk) (cont) 20:53, 12 August 2021 (UTC)

Adding a URL for the page or location with linked text

I'm looking for an equivalent to |section-url= in the {{cite}} templates. Using the technique described in Template:Sfn#Adding a URL for the page or location, e.g., {{sfn|loc=[url foo]|p=[url bar]}}, the citation displays with external link icons linked to the appropriate location. Is there a way to suppress those icons and instead link directly from the location and page number text? Shmuel (Seymour J.) Metz Username:Chatul (talk) 16:48, 9 December 2020 (UTC)

External links, including those linked by |chapter-url=, are shown with an external link icon to indicate to the reader that they are leaving Wikipedia. It's a feature. Do you have an example of a place where that should be suppressed, and an explanation of why that should happen? – Jonesey95 (talk) 17:24, 9 December 2020 (UTC)
Probably not desirable for a consistent appearance, but to answer the question, there is a way to suppress the external link icon using {{plain link}}:
{{sfn|Smith|2020|loc={{plain link|url foo}}|p={{plain link|url bar}}}}[1]

References

  1. ^ Smith 2020, p. foo.
--Matthiaspaul (talk) 16:44, 14 September 2021 (UTC)

I worry that Wikipedia's various "link rot" tools don't consider the links in {{sfn}}, and that many links from {{sfn}} point nowhere. (We currently add links to {{sfn}} by using the workaround of placing a hand-written direct link in the |loc= or |p= parameter.)

So my question is: do the current "link rot" bots consider these kind of handwritten links? If not, then could we:

  1. Add |url=, |access-date=, |archive-date= and other relevant parameters to {{sfn}} (preferably using the same code that is used by {{citation}} and other "CS1" templates).
  2. Notify the editors who maintain the various "link rot" bots to implement support for {{sfn}} as well.

Anyone up for this work? I'm afraid it's beyond my technical expertise. ---- CharlesGillingham (talk) 23:04, 7 September 2021 (UTC)

Non-working links from sfn and similar templates to full references are tracked via Category:Harv and Sfn no-target errors and an error message that is currently hidden by default due to some false positives. There is more information about the tracking at the category page. The proposed parameters do not belong in sfn templates; they belong in the full references to which these templates link. – Jonesey95 (talk) 00:53, 8 September 2021 (UTC)
I'm not talking about the internal links, I'm talking about a reference to external URL, such as: {{harv|Smith|2011|p=[http://en.wikipedia.org 3]}} which renders as (Smith 2011, p. 3). There may be several links to different pages of the same book; thus the full citation is not an option for these links. ---- CharlesGillingham (talk) 01:36, 8 September 2021 (UTC)
Oh, I see what you mean. I don't know why link rot scripts and bots would be unable to tag dead links within the |p= parameter, like this: (Smith 2011, p. 3[dead link]) – Jonesey95 (talk) 02:15, 8 September 2021 (UTC)
The answer is not to link to specfic pages in eg Google books or archive.org items but trust that if the item as a whole is listed in the general references that a reader can go to the url and locate the specified page from there.GraemeLeggett (talk) 17:16, 14 September 2021 (UTC)

References

  • Smith (2011). Title.

Add automatic endash for page number range?

Hi there! In Talk:Antoine Ephrem Cartier/GA1, the reviewer asked for an endash in the |pages= parameter for the {{sfn}} templates. The CS1 templates automatically display an endash when a hyphen is used. Could that same functionality be added to {{sfn}}?

Examples:

  1. {{cite news|title=Cite news example 1|pages=79{{en dash}}99}}[1]
  2. {{cite news|title=Cite news example 2|pages=79-99}}[2]
  3. {{sfn|Sfn example 3|pages=79{{en dash}}99}}[3]
  4. {{sfn|Sfn example 4|pages=79-99}}[4]

References

  1. ^ "Cite news example 1". pp. 79–99.
  2. ^ "Cite news example 2". pp. 79–99.
  3. ^ Sfn example 3, pp. 79–99.
  4. ^ Sfn example 4, pp. 79–99.

Thanks! GoingBatty (talk) 22:10, 8 September 2021 (UTC)

Would that all pagination had the same format. Alas, it doesn't. Were we to do as you suggest there would likely be smiles all around until someone complained about Module:Footnotes improperly converting the hyphen in a hyphenated page number to an endash. So then we have to implement the accept-this-as-written markup. Do we really need this? Do we really need this?
Trappist the monk (talk) 23:37, 8 September 2021 (UTC)
@Trappist the monk: Sure - just as much as we need it in the CS1 templates. To avoid the issue you mentioned, I suggest implementing it in the |pages= parameter, not the |page= parameter. Thanks! GoingBatty (talk) 01:40, 9 September 2021 (UTC)
That does not avoid the issue: |pp=2-1-2-3, |pp=2-31 ''ff.''.
Trappist the monk (talk) 11:26, 9 September 2021 (UTC)
@Trappist the monk: You are correct! In those edge cases, editors can use the same workaround that's being discussed at Help_talk:Citation_Style_1#{{hyphen}}_converted_to_dash. GoingBatty (talk) 12:44, 9 September 2021 (UTC)
It might be worth noting that this has been added recently to the {{r}}, {{rp}} and {{ran}} citation templates as well, including support for the accept-this-as-written syntax (only for the plural page parameters |pages=/|pp= and |quote-pages=/|qpp= (and aliases). See Template_talk:R#Hyphens_to_dashes. --Matthiaspaul (talk) 13:08, 13 September 2021 (UTC)
I can see that I've lost this round. It would probably be best to move hyphen_to_dash() from Module:Citation/CS1 to Module:Citation/CS1/Utilities where it can be exported (along with is_set() and has_accept_as_written()). Modules wanting to endashify hyphens then simply require ('Module:Citation/CS1/Utilities'). That way there is only one copy of hyphen_to_dash() to maintain; now there are at least three...
Trappist the monk (talk) 15:07, 13 September 2021 (UTC)
Does this add much runtime? Some articles have hundreds of uses of this template. Kanguole 10:03, 14 September 2021 (UTC)
Adds some, certainly. Enough to worry about? Don't know. The additional code is only executed when |pp= or |pages= is present and has a value.
Trappist the monk (talk) 12:04, 14 September 2021 (UTC)
{{sfn}} is most useful with either |p= or |pp=, so that would be a very common case. Kanguole 12:23, 14 September 2021 (UTC)
Of course, but as I said the additional code is only executed when |pp= or |pages= is present and has a value but is not executed when |p= or |page= is the insource-location parameter. I blanked my sandbox and wrote a simple {{cite book}} template to act as a target and then created 1000 {{harvnb}} templates:
{{cite book |title=Title |last=Name |date=2021}}
*{{harvnb|Name|2021|pp=2-5}}
... + 998 more
*{{harvnb|Name|2021|pp=2-5}}
Previewing that and looking at the Parser profiling data I got:
Lua time usage 1.462/10.000 seconds
Lua memory usage 5,277,646/52,428,800 bytes
then I changed |pp= to |p=, previewed and got:
Lua time usage 1.044/10.000 seconds
Lua memory usage 5,285,110/52,428,800 bytes
then I changed back to |pp=, previewed and got:
Lua time usage 1.004/10.000 seconds
Lua memory usage 5,277,646/52,428,800 bytes
Then I changed {{harvnb}} to {{sfn}}, previewed and got:
Lua time usage 2.351/10.000 seconds
Lua memory usage 5,463,754/52,428,800 bytes
Switched to |p=, previewed and got
Lua time usage 2.122/10.000 seconds
Lua memory usage 5,428,951/52,428,800 bytes
Worst-case in my simple experiment appears to be 400ms so a 400us-per-template penalty.
Trappist the monk (talk) 13:07, 14 September 2021 (UTC)
Which, I think, is neglectible for the achieved improvement of usability, appearance, and consistency across citation templates. Thanks for adding it.
--Matthiaspaul (talk) 16:20, 14 September 2021 (UTC)
:clover: No competition, we're all just striving for the best-possible solution, so we are all winning.
Yeah, merging the variants makes a lot of sense to keep things in sync (but the String2 variant already has some minor but important functional changes and an additional parameter for use in the family of r-templates, still, it would be possible to recombine adding a boolean to switch the behaviour).
--Matthiaspaul (talk) 16:20, 14 September 2021 (UTC)
Are you taking care of your proposed change in CS1 to move its hyphen2dash() into Module:Citation/CS1/Utilities so that the freshly forked hyphen2dash() function in Module:Footnotes can move back into CS1 after the next round of CS1 updates? Or should I?
The modified hyphen2dash() function from Module:String2 is so far only used by {{r/ref}} and {{rp}}. I could take care of making the necessary adjustments for a separate entry point (with the necessary extra parameter) for this into Module:Citation/CS1/Utilities once the CS1 function has moved there.
--Matthiaspaul (talk) 12:23, 16 September 2021 (UTC)
Moved to Module:Citation/CS1/Utilities/sandbox; removed from Module:Footnotes/sandbox.
{{Harvard citation no brackets/sandbox|Name|2021|pp=2-5}}
Name 2021, pp. 2–5
{{Harvard citation no brackets/sandbox|Name|2021|pp=((2-5))}}
Name 2021, pp. 2-5
{{Harvard citation no brackets/sandbox|Name|2021|pp=((2-5)), 2-9}}
Name 2021, pp. 2-5, 2–9
{{Sfnm/sandbox|Smith|2005|1pp=1-5|Jones|2004|2pp=((2-5))|Name|2021|3pp=((2-5)), 2-9}}
[1]

References

  1. ^ Smith 2005, pp. 1–5; Jones 2004, pp. 2-5; Name 2021, pp. 2-5, 2–9.
Trappist the monk (talk) 20:06, 16 September 2021 (UTC)
See also:: Help_talk:Citation_Style_1#hyphen_to_dash()_moved
--Matthiaspaul (talk) 20:19, 25 September 2021 (UTC)

Support for "quote" parameter

As we move from the era of print to web-based everything, page numbers are disappearing, and even "loc" becomes somewhat less useful. "quote" is becoming common for other citation systems, and I would argue it is time that sfn supported it as well. Maury Markowitz (talk) 14:16, 24 November 2021 (UTC)

See the archives of this talk page, where advice is repeatedly given on how to house a quotation or other comment within a reference. I have updated the guidance at Template:Sfn#Adding additional comments or quotes to match that repeated advice. – Jonesey95 (talk) 15:54, 24 November 2021 (UTC)
The rationale is that the point of {{sfn}} is to produce short citations that are merged when they refer to the same location. Including quotes would make a mess of that. Kanguole 16:36, 24 November 2021 (UTC)
Ok, but...
In the first reply, using loc instead of quote does nothing. It's literally the same result, yet less obvious to the editor. Semantic content is valuable. Am I missing something?
I get the basis for the second point, but that seems like tilting at windmills. Making people use some other tag instead of sfn isn't going to make the refs section any shorter, but it will, generally, make the source text harder to read. Yes, sfn can definitely improve the results in the display version, but it also has value in the source as well.
Maury Markowitz (talk) 18:25, 29 November 2021 (UTC)

p vs. pp detection

It's really easily to mistakenly do something like {{sfn|Sdkb|2021|p=147,148}}, using |p= instead of |pp=. Could we make this template so that it's smarter and automatically detects and corrects or warns about instances like this? {{u|Sdkb}}talk 07:03, 7 December 2021 (UTC)

The documentation does not spell out exactly how to write the page numbers. It does say that the value for pp should be a comma-separated list. So another correct way to write Sdkb's example would be {{sfn|Sdkb|2021|p=147, 148}}.
In the case of the p parameter and a book of over 1000 pages, an editor might write p=1,280 and that would work. Nothing in the documentation forbids it. So distinguishing between two pages in a short work and one page in a long work would be tricky. Tricky behind-the-scenes corrections tend to confuse editors. Jc3s5h (talk) 23:27, 7 December 2021 (UTC)
Oh, ack, that's a good point about the page numbers (perhaps my example above is referring to page 147,148 in a really long book lol). I guess that makes this infeasible. {{u|Sdkb}}talk 00:18, 8 December 2021 (UTC)

At loc mode

Proposal: sync short refs (including Harvard) with CS1/2 by:

  • Renaming |locn= to |atn=. First by aliasing them
  • Add |mode= per CS1 to provide field separator choice

I don't know how many RfCs this may need, but it is an idea. 68.173.76.118 (talk) 15:50, 13 February 2022 (UTC)

Automatically linking page numbers: my sfn dream

I had a dream about sfn. I was hoping someone could tell me how feasible it would be. First, thanks to those who maintain this template—I use it all the time with books, often with many sfn citations to any given volume. This, of course, means that verifying any citation is a multi-click process, first the footnote number to the short footnote to the full citation to the source URL then back to the short footnote (to recall the page number) then back to the source URL to lookup the specific page reference. This could be made a lot shorter by linking the page number in the footnote, which some do, but it is often cumbersome both within the wikitext and to do consistently. The Internet Archive (IA) hosts just about every book I reference (available for checkout in one-hour increments) and is often the best place to link. What if sfn linked to the IA book page number automatically?

Is sfn able to detect the full citation? If so, and it could either see the IA book URL and/or a dedicated IA parameter, then it would be reasonable to automate the linking of any sfn that has a linked IA book id. Eh? czar 06:08, 2 January 2022 (UTC)

I do not think that IA covers all the material, although it may include all cited material for individual Wiki articles. A more subtle problem maybe related to scanning. I have encountered errors, mis-scans and missing items several times. I don't know what scan-proofing regime the IA employs. It seems they relegate the proofing to the scan sources (often, scan "farms") themselves. This is not be entirely reassuring, as scan proofig becomes an opaque practice, that one basically has to take on faith, unless one has access to the source in alternate media. Personally I would use IA only when I am certain that the scan is a faithful repro. 68.173.76.118 (talk) 15:43, 13 February 2022 (UTC)
I am referring specifically to IA's library uploads, which with rare exception have been fully accurate in my experience. (What matters is the image of the page, not the quality of the OCR automated transliteration, if that's what you mean.) IA lets users link to a specific page (for example), which is perfect for sfn's purposes. This would only cover books that are in IA's (large) repository, so of course it would not cover all cited material in all articles, just the ones that have already linked to the IA upload in its citation. czar 15:54, 13 February 2022 (UTC)
I see. I guess the proposal is actionable for such IA sources then. It seems this will require tighter integration (read: added logic) to both CS1 modules and Sfn modules. As for an id, I don't think Wikipedia should be making or synthesizing ad hoc identifiers for other entities' assets. But there is {{Internet Archive}} that could be used in CS1 parameter |id=, to begin with. 68.173.76.118 (talk) 16:12, 13 February 2022 (UTC)

Where to put relative to reflist?

Hi, I'm cleaning up references at oil refinery, and I was just wondering, where do I put the template relative to the {{reflist}} template? Under it? Above it? A new section wholly? My temporary solution (i.e. before I publish it) is to put the book links in a new section titled "Bibliography". Cheers X-750 List of articles that I have screwed over 13:15, 20 August 2022 (UTC)

Just like any other reference, {{sfn}} goes right at the place in the article text that the source supports.
Trappist the monk (talk) 14:22, 20 August 2022 (UTC)
Trappist the monk I think it's my fault for not clarifying, but I meant the actual citation itself, i.e. the {{cite book}} thingy. I know where the sfn tag itself goes, just wondering where the citation it links to should be. Apologies for not being clear on that. X-750 List of articles that I have screwed over 22:25, 20 August 2022 (UTC)
There is a script: User:Trappist the monk/HarvErrors.js. The script has a doc page (such as it is...). The script has a testcases page that illustrates how I think short-form and long-form citations should be placed.
You might find the script handy if you are doing much with {{sfn}} / {{harv}} et al.
Trappist the monk (talk) 22:43, 20 August 2022 (UTC)
See MOS:REFERENCES and WP:CITESHORT. If you are using short footnotes and separate full citations, they usually go either in two separate sections (e.g. "Notes" and "References") or in two subsections of the "References" section (which could be named e.g. "Notes" and "Works cited"). The section with the full citations should go after the section with the footnotes. —David Eppstein (talk) 23:44, 20 August 2022 (UTC)

Square brackets around year?

A request that I suspect is somewhat complicated, but nevertheless, I ask: with {{sfnp}} would it be possible to have a version where the parentheses are rendered as square brackets? ie [2022] instead of (2022). The reason being that the High Court of Australia uses square brackets in citations to indicate the year of a decision: eg Dietrich v The Queen [1992] HCA 57. Regards, Goldsztajn (talk) 10:41, 18 October 2022 (UTC)

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)
Fair. I get it. This is a useful tool, but not for that purpose, and there are others for it. Thanks you two for explaining! :) --Golbez (talk) 15:06, 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)
2 citations out of ~150 is an indication of an error to be corrected, not an inconsistent style. MrOllie (talk) 04:03, 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}}

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 an entry 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)