Unwanted plus sign[edit]

Comment: I was unaware of the fore mentioned move until I noticed The Naked Gun film series article had fraction display issues (see its talk page discussion). Template ((Frac)) does not function the same since I last used it. Previously, I could display 3313 by putting the whole number inside ((Frac|33|1|3)), or outside 33((Frac|1|3)) the template. Apparently, this has changed, and whole numbers must go outside the template, otherwise a plus sign + appears in the middle of the fraction. I have adjusted the documentation to reflect this change. — CJDOS, Sheridan, OR (talk) 07:26, 9 August 2021 (UTC)[reply]

There are some problems because the template now uses template styles. For example, see #Sfrac conflict with wikilinks above. That is not related to the move from "Frac" to "Fraction". I looked at The Naked Gun but I can't see a version in history which shows a problem. Please describe the problem and give a permalink or time/date so it can be found. Johnuniq (talk) 11:30, 9 August 2021 (UTC)[reply]
@Johnuniq: The Talk page link is already shown. Article talk page describes the problem, and includes a link to when I began correcting the article. — CJDOS, Sheridan, OR (talk) 19:14, 9 August 2021 (UTC)[reply]
As mentioned, it is known that using template styles will cause issues in some strange places. However, obviously I looked at the link you gave but after a couple of minutes of mucking around I cannot see a problem. Can you see one now (in history)? It is also known that using a template in a heading will have some bad effects and I don't think it should be done. Perhaps a sandbox demonstration of the problem would need to be created. If there was a precise example, it might be worth asking for opinions at the talk page of MOS:FRAC which does not seem to say anything about fractions in article titles or headings. By the way, that ping did not work, see Help:Notifications. Johnuniq (talk) 23:59, 9 August 2021 (UTC)[reply]
Ping did not work? Strange, ((Reply to|Johnuniq)) should work. In any case, in the talk page for The Naked Gun, I said "in this edit" with a link to the edit history. That precise link is the first edit I performed after noticing a problem. As mentioned, ((Frac|33|1|3)) should produce the expected output, but it's been quite a while since I last used it (no idea how long ago, but probably sometime this year). Instead, it sticks a plus sign + in the middle of the fraction. This is demonstrated in my edit link, because ((Main)) under each of the § Films subheadings adds a plus sign (maybe this should be expected when the templates are nested; another editor had done this before I spotted it), but further down in § Main characters, it does it to one of bullet points (O. J. Simpson), and further down still, it does it in the § Reception tables (note, the preceding § links will open the specified page history, not the article as it is now).
That was the first edit I performed, in which Template:Frac was in the label of a link. In many of those edits, the link target used a backslash fraction (e.g. ''[[Naked Gun 33 1/3: The Final Insult|Naked Gun ((frac|33|1|3)): The Final Insult]]'') which causes a redirect to ''[[Naked Gun 33⅓: The Final Insult]]'', the ASCII fraction. So, I had replaced several instances of the backslash fraction with ASCII. I have in the past included the Integer within ((Frac)) without issue (as per the template's doc). As the plus sign + did not initially appear, I did not expect it to appear when replacing a forward slash fraction with an ASCII fraction... but as you can see from the page history, it showed up.
I soon discovered the new errors, and performed a further edit to the article, moving the Integer outside of ((Frac)), which removed all the unwanted plus signs + in the fractions. It still wasn't 100% right, as ((Frac)) nested within ((Main)) was displaying a forward slash fraction, rather than the expected output; an IP editor corrected this after me by replacing ((Frac)) within ((Main)) with ASCII.
The point I'm trying to make is that, Template:Frac is supposed to be able to accommodate the Integer within the template, and I previously haven't had any issues doing so (excluding hatnote nesting of ((Frac)), which I had not seen done before). When I raised the concern, putting the Integer outside ((Frac)) removed the unwanted plus sign +. That's all I'm trying to say—I only meant to report the issue. Does the documentation require clarification about where Template:Frac should not be implemented? — CJDOS, Sheridan, OR (talk) 06:28, 10 August 2021 (UTC)[reply]
OK, now I see some examples. 14:41, 25 July 2021 shows "The Naked Gun 2+1⁄2: The Smell of Fear (1991)" as item 1.2 in the table of contents. That was caused by a section heading using ((frac|2|1|2)) that produced 2+12 rather than using Unicode characters. I see that the articles are titled with Unicode: The Naked Gun 2½: The Smell of Fear and Naked Gun 33⅓: The Final Insult. It might be best to put up with the fact that the typography is not brilliantly clear because it's the best that can be achieved in wikitext. Being consistent with the article titles seems desirable. I was confused by the link you gave earlier because it has examples of ((frac)) being removed near the start. Thanks for the report but I don't think anything is going to change in the template because those problems are a side-effect of using WP:TemplateStyles and probably should be worked around. Regarding whether the documentation should be updated to say when not to use the template, that would be desirable. See other reports on this page. The template shows 33+1/3 (using a vinculum instead of a slash) when the template knows the 33 is the integer portion of the number—the + suggests the value is the sum of 33 and one third. Copying the displayed fraction in your browser copies the +. A successful ping requires a new message and a new signature. Editing an existing message does not generate a notification. Johnuniq (talk) 07:46, 10 August 2021 (UTC)[reply]

@Johnuniq: This has become a problem again because per Talk:Naked_Gun 33 1/3: The Final Insult#Requested move 12 July 2022, it was established that the Unicode character ⅓ is not safe for screen readers. The article was moved to Naked Gun 33 1/3: The Final Insult with a DISPLAYTITLE to make it use superscripts and subscripts. I have been using ((frac)) to make the display text for links to this article, resulting in the unwanted "+". Sudiani reverted one of these, complaining about the "+" (see diff). I was hoping the template could be fixed to eliminate the "+" or otherwise handle links better. Is that possible? If not, should I just redo all those links to use the actual title with "33 1/3"? -- Beland (talk) 18:29, 22 July 2022 (UTC)[reply]

@Beland:It seems to work ok on the film's page but not sure why on the one that you changed (List of 1994 box office number ones in Italy) that it does not, hence why I reverted it for now Sudiani (talk) 18:40, 22 July 2022 (UTC)[reply]
@Sudiani: That's because the "+" only appears when the ((frac)) is used in a link. -- Beland (talk) 18:47, 22 July 2022 (UTC)[reply]
As a reminder to myself and anyone investigating in the future, ((fraction)) now uses WP:TemplateStyles and that does not work if the first use of ((fraction)) is in a piped link. For example, if a page contains the following (and no earlier usages of the template), the template styles will not work and the display will be corrupted (each will display as "33+1/3" with a fraction slash instead of the plain slash I have used for clarity here).
[[Example|((frac|33|1|3))]]
((frac|33|1|3))
The template works if the order is reversed. That is, the following would be fine:
((frac|33|1|3))
[[Example|((frac|33|1|3))]]
If there is no earlier usage of the template, a crude workaround is to place the required templatestyles wikitext before the link. This works:
<templatestyles src="Fraction/styles.css"/>[[Example|((frac|33|1|3))]]
Since the Naked Gun people are having fun with fractions, another solution would be to work out what wikitext is needed to display the required fraction without using template styles. Then that wikitext can either be copy/pasted or put in a dedicated template. I don't know what would be best. Johnuniq (talk) 23:55, 22 July 2022 (UTC)[reply]

Thank you, Johnuniq. As a followup, I recently performed a test regarding fractions in section headings, due issues with the Floppy disk article. I will recreate the test as subsections below, to demonstrate three two methods of displaying fractions in section headings, and how the links appear in an address bar...

Fraction heading test 1¼

=== Fraction heading test 1¼ ===
Address bar: https://en.wikipedia.org/wiki/Template_talk:Fraction#Fraction_heading_test_1%C2%BC

Fraction heading test 21/2

=== Fraction heading test 2<sup>1</sup>/<sub>2</sub> ===
Address bar: https://en.wikipedia.org/wiki/Template_talk:Fraction#Fraction_heading_test_21/2

— CJDOS, Sheridan, OR (talk) 02:13, 12 November 2022 (UTC)[reply]

Per MOS:NOSECTIONLINKS, the example heading ((Frac|3|3|4)) isn't permitted (template transclusion). I have commented out said section here. — CJDOS, Sheridan, OR (talk) 05:54, 13 November 2022 (UTC)[reply]

I have noted the workaround "33 ((frac|1|3))". -- Beland (talk) 02:24, 15 August 2023 (UTC)[reply]

Broken formatting with Template:Sfrac[edit]

Line wrapping can occur immediately before and after the rendered output of ((sfrac|b|c)), which is problematic and evidently unintended (((frac|b|c)) and ((sfrac|a|b|c)) are fine). Here are examples. You will need to change the browser window width to see the effect:

sfrac2xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(bbbbbbbbbbbbbbbbbbbbb/ccccccccccccccccccccccc).................................................
sfrac3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(a+bbbbbbbbbbbbbbbbbbbb/cccccccccccccccccccccc).................................................
frac2xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(bbbbbbbbbbbbcccccccccccc).................................................

Somehow the nowrap property in the style sheet appears to be getting lost. —Quondum 00:38, 10 January 2024 (UTC)[reply]

The issue is that when narrowing the browser window, as soon as the right margin hits the trailing dots, the first row (((sfrac|b|c))) inserts a line break before the right paren. The other lines do not wrap. I don't know why the examples behave differently but the wrap seems to make sense because how could the template affect the rest of the line? At any rate, if someone wants to investigate, using Special:ExpandTemplates shows the following for the output of simplified versions of the first and second examples.
((sfrac|b|c))
<templatestyles src="Sfrac/styles.css" /><span role="math" class="sfrac tion"><span class="num">b</span><span class="sr-only">/</span><span class="den">c</span></span>

((sfrac|a|b|c))
<templatestyles src="Sfrac/styles.css" /><span role="math" class="sfrac ">a<span class="sr-only">+</span><span class="tion"><span class="num">b</span><span class="sr-only">/</span><span class="den">c</span></span></span>
Johnuniq (talk) 01:30, 10 January 2024 (UTC)[reply]
Line breaks are not permitted other than at defined points. Look at the following examples, in which only one wraps punctuation inappropriately (you can't think that it makes sense for a comma or period to wrap). Notice how the bad wrapping behaviour in the last case below has been remediated by wrapping the template output in ((nowrap)), something that the template could (and already tries to) do.
12345/6789, (12345/6789), 12345/6789.
01234567689/01234567689, (01234567689/01234567689), 01234567689/01234567689.
01234567689/01234567689, (01234567689/01234567689), 01234567689/01234567689.
Though I am not familiar with style sheets, I think I can see the problem. I may get to using the sandbox to experiment with cleaning up the problem, but it will take time with no assurance of success. —Quondum 21:30, 10 January 2024 (UTC)[reply]
The person to ask is taking a short wikibreak at the moment so I won't hassle them. Johnuniq (talk) 22:22, 10 January 2024 (UTC)[reply]
Thanks – obviously there is no urgency; it is unusual to notice this effect in an article. Hopefully the problem is reasonably clearly characterized in the above, though. —Quondum 00:34, 11 January 2024 (UTC)[reply]
Actually, I have just sandboxed a version that seems to work just fine at ((sfrac/sandbox)). —Quondum 01:33, 11 January 2024 (UTC)[reply]
 DoneQuondum 19:19, 15 January 2024 (UTC)[reply]

My recent edit[edit]

Please see my forthcoming message at Wikipedia talk:Manual of Style/Accessibility#Role=math. I said in this edt that I was going to write a message on this talk page, but it turns out to be a more general issue, so this can serve as a notification for now. Graham87 (talk) 08:00, 14 January 2024 (UTC)[reply]

Template-protected edit request on 14 January 2024[edit]

Could the first line be split for readability of the template structure? That is, please replace the first line

<templatestyles src="Fraction/styles.css" /><span class="frac">((#if:(({3|))}<!-- if 3

with

<templatestyles src="Fraction/styles.css" /><span class="frac"><!--
-->((#if:(({3|))}<!-- if 3

Quondum 20:28, 14 January 2024 (UTC)[reply]

 DoneJonesey95 (talk) 00:53, 16 January 2024 (UTC)[reply]