Wikipedia talk:Manual of Style/Mathematics
Manual of Style | ||||||||||
|
Historical note: The page Wikipedia:Manual of Style/Mathematics was originally obtained by moving content from Wikipedia:WikiProject Mathematics here, see the diff. As such, this page was not created from scratch on 18:39, 19 January 2005 as the page history may suggest, but is rather the product of collaborative discussion of Wikipedians since 2001 or 2002. |
|
|||||
This page has archives. Sections older than 120 days may be automatically archived by Lowercase sigmabot III. |
Inequality signs
editDo you have to put spaces on both sides of an inequality? Also, if there is only one value, should a space be added there as well? Purplemountainmantalk contribs 20:10, 3 September 2022 (UTC)
- Yes, write "1 < 2" not "1<2" (just as "x = 1" not "x=1"); LaTeX does it correctly automatically, of course. I don't understand the second question. --JBL (talk) 20:15, 3 September 2022 (UTC)
- @JayBeeEll: If I'm understanding correctly, the second question is whether e.g. ">2" or "> 2" is preferred, for example in an infobox. -- Beland (talk) 18:00, 17 October 2022 (UTC)
- I see. My instinct is that such constructions should almost always be avoided, but maybe I could be convinced otherwise in a discussion of particular examples. JBL (talk) 18:50, 17 October 2022 (UTC)
- @JayBeeEll: You can see examples of one-parameter greater-than or less-than in Unmanned aerial vehicle#Classification types (table), North West England#Cities and towns (section headings), Nine men's morris (infobox), and Anthrax (infobox). -- Beland (talk) 02:51, 18 April 2024 (UTC)
- I see. My instinct is that such constructions should almost always be avoided, but maybe I could be convinced otherwise in a discussion of particular examples. JBL (talk) 18:50, 17 October 2022 (UTC)
- @JayBeeEll: If I'm understanding correctly, the second question is whether e.g. ">2" or "> 2" is preferred, for example in an infobox. -- Beland (talk) 18:00, 17 October 2022 (UTC)
Should we more strongly recommend the use of mvar/math templates in preference to italic sans serif?
editFor any article where LaTeX is also used, it is typically clearer to read variables that are in an serif font like x instead of sans-serif x, even if the particular italic font used in one skin or another is different than the LaTeX font (computer modern)
Now that LaTeX in <math>
tags is displayed as SVG instead of PNG images, just using TeX everywhere is often even better looking. But there are some contexts where it can’t be used (e.g. in image captions), and many technical articles are written to not use LaTeX in at least some of their formulas, and I wouldn’t recommend trying to forcibly switch them them all to LaTeX.
But I routinely switch mathematical symbols in wiki articles sans serif -> serif italics, and this seems uncontroversially better in nearly every case.
(To be even more ambitious, we might encourage whoever is in charge of editing Wikipedia skins to specify a closer font in the CSS they apply to mvar/math templates, even perhaps some OpenType version of Computer Modern.)
–jacobolus (t) 19:50, 19 March 2023 (UTC)
- I would strongly DIScourage the use of anything but LaTeX in an article where LaTeX is also used. The math/mvar templates try to achieve a similar appearance but they don't really succeed. Mathematics commonly uses the same letter in different fonts to mean different things, which can be confusing to newcomers; we shouldn't add to the confusion by using different fonts of the same letter to mean the same thing. In articles where the formatting is simple enough to be all-templates (e.g. no square roots or displayed equations) and in some special contexts where LaTeX-math can be problematic (e.g. formulas in titles of references with linked titles) I think template-math can be ok. —David Eppstein (talk) 20:37, 19 March 2023 (UTC)
- That's also fine with me, and switching other variables -> LaTeX seems fine to do case by case while also making other substantial changes, but we have many articles that currently mix LaTeX with plain text, and it would probably be disruptive to try to forcibly update them all.
- But this page currently recommends plain sans-serif italics as one way of denoting variables, etc. I wonder if we should at least start by encouraging those to use math/mvar templates instead.
- Personally I use LaTeX when writing new substantive parts of articles, except for things like writing "nth" in the prose, putting symbols into headings, or writing simple formulas in image captions (where some technical bug causes LaTeX to disappear from the caption when the reader clicks to view the image at full-window size). –jacobolus (t) 22:50, 19 March 2023 (UTC)
- Sure, I think we should avoid plain html/wikimarkup formatted mathematics for anything that involves variables and goes beyond just having numerical values and basic arithmetic on them. —David Eppstein (talk) 23:19, 19 March 2023 (UTC)
- Just saw an edit based on this discussion. In my opinion, mixing serif and sans, inline, looks atrocious. The right answer is to go back to a global default preference for serif (that is, for text as well as for math), but I doubt we can sell that. For inline non-LaTeX, I think we should not insist on serif. --Trovatore (talk) 03:37, 17 April 2024 (UTC)
- @Trovatore I don't think we should insist, but we might nudge: using serif fonts is generally more consistent if there is also LaTeX on the same page, which uses serif fonts. (Aside: Let me recommend changing your personal Wikipedia stylesheet to use whatever font you prefer – I have Wikipedia text all render in Charter, which I think is significantly better looking than any of the fonts used in common skins, and not too stylistically far from Computer Modern while being quite a lot nicer in my opinion. YMMV.) –jacobolus (t) 04:02, 17 April 2024 (UTC)
- I do in fact set my preferences to use serif. I think serif is just all-around better. In sans, it's hard to tell "Iago" from "lago" (see talk:Iago#Shouldn't the name be Jago rather than lago).
- However, I have a strong negative reaction to using serif math inline in sans prose. I think e (mathematical constant) looks hideous for this precise reason (for those who don't set their preferences to use serif), and I think it reflects negatively on Wikipedia when people see it. --Trovatore (talk) 05:12, 17 April 2024 (UTC)
- I would add that displayed serif formulas look fine, even when the prose is in sans. It's the mixture of typefaces within a line that makes it look like a ransom note. I think it's fine to have the inline math in a different typeface from the displayed math; it's more important to keep the inline typeface the same than it is to keep the math typeface the same. --Trovatore (talk) 05:13, 17 April 2024 (UTC)
- The mixing of typefaces is ubiquitous, and it is quite common to mix serif math symbols with sans-serif prose. To me this mainly seems like your own hangup based on niche personal preferences (and "hideous" etc. is incredible hyperbole).
- Using a serif symbol in block math formulas and a sans-serif symbol (which often looks dramatically different) for the same thing in the immediately adjacent prose is distracting, confusing, and ugly. –jacobolus (t) 05:17, 17 April 2024 (UTC)
- I don't think it's incredible hyperbole. I really do think it looks hideous. --Trovatore (talk) 05:24, 17 April 2024 (UTC)
- In any event, you should take this up at the Village Pump or similar. You can try to petition for whatever comes after Wikipedia:V22RFC to use a serif font by default. Maybe they can fix the variety of other more obviously typographically terrible choices/compromises while they're at it. –jacobolus (t) 05:38, 17 April 2024 (UTC)
- I don't think it's incredible hyperbole. I really do think it looks hideous. --Trovatore (talk) 05:24, 17 April 2024 (UTC)
- Having the same symbols appear in both serif and sans serif versions on the same web site — or worse, in the same article — is quite confusing to people who are trying to learn the math in question for the first time. Font effects, like bold, blackletter, and italics, are used to differentiate completely different mathematical entities; novice readers have every reason to expect that an intentional serif vs. sans serif difference conveys an important distinction. That includes everyone from high school students learning vector math to PhDs learning quantum mechanics or advanced set theory for the first time. Conveying information easily and accurately seems a lot more important to the core mission of an encyclopedia than cosmetics, if it's a binary choice.
- If someday we start rendering LaTeX in sans serif, or for some reason decide to render inline math as sans serif, I think it still makes sense to advise editors to use {{mvar}} and {{math}}, before and after such a change. The fonts used for those templates can be switched in one place if consensus changes. Using those templates also means that spell checkers and screen readers can process math expressions correctly, which is often done differently than for English prose. In the event of a font change, we could simply delete the "because it makes a sans serif font" rationale from this guideline, but not have to make changes to massive numbers of articles. -- Beland (talk) 16:42, 17 April 2024 (UTC)
- Oh, and {{math}} prevents line breaking without using interstitial nbsp's, which maximizes clarity for both readers and editors. -- Beland (talk) 16:51, 17 April 2024 (UTC)
- This "if someday" hypothetical seems unlikely and not worth putting much weight behind. I agree with you that the template is a bit more explicit about author intention, and has some other benefits like suppressing line breaks. Can you explain concretely what the benefit is for screen readers and spell checkers? Have you explicitly tried running screen readers on the two variants? –jacobolus (t) 17:17, 17 April 2024 (UTC)
- Yes, I agree the "someday" scenario is not at all likely, but my point was that wanting that to happen is not a good reason not to use {{math}} etc.
- The benefit for spell checkers should be obvious. In something like "The area of a disc can be found with A = πr2.", "πr" is not a valid word in any language, so that would get flagged as a possible misspelling. Equal signs and superscripts should not appear in prose, so those would generate complaints from my style checker. A grammar checker would need to know to treat this string as a mathematical expression in order to parse it properly into the surrounding sentence like a quotation or a noun. My grammar checker does dictionary lookups to determine part of speech, and it would be a bad idea to try to put every single possible mathematical expression into a dictionary or database.
- The screen reader I use currently misreads both
<math>...</math>
and {{math}} expressions. I think it's getting images for LaTeX, which it completely ignores even if there is alt text. For math expressions displayed as text, it treats them as English prose. So "A = {x : x > 0}" is read as "ay equals ex ex greater than zero" rather than something like "The set ay equals the set of ex where ex is greater than zero". However, I could reconfigure my screenreader to look for the CSS added by the {{math}} tag and change how the contents are handled. It would be pretty feasible to have it produce something rudimentary like "ay equals open curly brace ex colon ex greater than zero close curly brace" that at least prevents important punctuation from being silently omitted. For untagged mathematical expressions, there wouldn't really be a solution other than building some AI that knows math when it sees it (which would not be cheap or easy). -- Beland (talk) 21:53, 17 April 2024 (UTC)- Do you have a spell checker which understands {{math}} templates? Seems entirely hypothetical. –jacobolus (t) 01:38, 18 April 2024 (UTC)
- Yes, volunteers working on Wikipedia:Typo Team/moss have changed hundreds if not thousands of mathematical expressions to use {{math}} so they don't show up in the potential typo reports there. -- Beland (talk) 02:42, 18 April 2024 (UTC)
- Do you have a spell checker which understands {{math}} templates? Seems entirely hypothetical. –jacobolus (t) 01:38, 18 April 2024 (UTC)
- @Trovatore I don't think we should insist, but we might nudge: using serif fonts is generally more consistent if there is also LaTeX on the same page, which uses serif fonts. (Aside: Let me recommend changing your personal Wikipedia stylesheet to use whatever font you prefer – I have Wikipedia text all render in Charter, which I think is significantly better looking than any of the fonts used in common skins, and not too stylistically far from Computer Modern while being quite a lot nicer in my opinion. YMMV.) –jacobolus (t) 04:02, 17 April 2024 (UTC)
Not-greater-than rendering problems
editOn Talk:Inequality (mathematics)/Archive 1#Renderization of "not greater than" symbol, Fgnievinski reports problems rendering U+226F ≯ NOT GREATER-THAN, with Chrome version 123.0.6312.106 on Windows 10 version 22H2:
(The first three are all just the Unicode character not displaying properly.)
I assume this be added to the list of characters that should only be expressed with <math>...</math>
? Are there any related characters for which anyone is also experiencing rendering problems? -- Beland (talk) 02:37, 18 April 2024 (UTC)
- Imo, the most problematic issue is with the symbol for function composition (∘ or ○). On some devices such as Safari on my laptop, the first one is so small that it is easily confused with an interpunct, and the second one has the same size as \circ ( ). On other devices, such as Safari on my iPhone, the first has the same size as \circ, and the second one is much larger. I am thus in favor of using only latex for function composition, but this implies to edit a lot of articles. D.Lazard (talk) 16:36, 18 April 2024 (UTC)
- The nice thing about a latex is that it can stretch to fit whatever size you need. EEng 16:44, 18 April 2024 (UTC)
- @D.Lazard: I only see 231 articles with "∘". There are 597 articles with "○". It would be very easy for me to change all the instances of "∘" to "○". Would that solve the problem of visual confusion? -- Beland (talk) 21:41, 18 April 2024 (UTC)
- This would deserve more discussion, since, on my smartphone, "○" is much too large. My opinion is that only latex should be used when the symbol for function composition is used. D.Lazard (talk) 09:16, 19 April 2024 (UTC)
- @D.Lazard: OK, I've added all three characters to the list, recommending LaTeX markup instead. -- Beland (talk) 23:18, 19 April 2024 (UTC)
- No, the big circle is inappropriately large. –jacobolus (t) 14:40, 19 April 2024 (UTC)
- This would deserve more discussion, since, on my smartphone, "○" is much too large. My opinion is that only latex should be used when the symbol for function composition is used. D.Lazard (talk) 09:16, 19 April 2024 (UTC)
One thing that would help a lot in my opinion is (English) Wikipedia directly hosting a "math" font indicated first in the font stack in the CSS for {{math}} templates which explicitly included a wide range of supported glyphs. This could be e.g. something constructed from Computer Modern glyphs, or STIX 2.0 (or something else?). The appearance of STIX 2 is not an exact stylistic match for Computer Modern, but it's also not inordinately far away. I don't really know what would be technically required for MediaWiki/Wikipedia to host something like that though. –jacobolus (t) 14:54, 19 April 2024 (UTC)
- @Jacobolus: If you'd like to discuss that with the responsible parties, see [1] (where one developer said the server side generally doesn't host fonts) or [2] (where one person recommending asking Microsoft to fix their fonts). Beland (talk) 23:22, 19 April 2024 (UTC)
- Yes, please voice your concerns at the bug tracker, because the report was dismissed as not a technical issue. fgnievinski (talk) 18:19, 20 April 2024 (UTC)
Fractional exponents and subscripts
editI have just discovered using {{sfrac}} for fractional exponents and subscripts (which is what MOS:FRAC and Wikipedia:Manual of Style/Mathematics#Fractions require for science and math articles) doesn't really work visually, at least on my computer - the surrounding text is easily confused as part of the numerator or denominator and sometimes it's just unclear that the fraction is supposed to be a superscript or subscript at all. I'm wondering what other people see and what the preferred solution for this would be, if it is indeed really a problem? Here are some examples with {{math}} style applied:
- {{sfrac}} for subscript: x1/2
- {{sfrac}} for superscript: x1/2
- {{frac}} for subscript: x1⁄2
- {{frac}} for superscript: x1⁄2
- Unicode character for subscript: x½
- Unicode character for superscript: x½
<math>...</math>
with subscript:<math>...</math>
with superscript:
Perhaps the MOS should be changed to use one of these in this sort of situation? Only a few fractions are available in precomposed Unicode characters, so that's probably not a complete solution, especially if we want visual consistency. That leaves the option of partially lifting the science-and-math ban on {{frac}} which would be slightly visually inconsistent (and TBH not all that well-rendered, either), and the option of switching any problematic expressions to LaTeX-style markup. Or perhaps someone has another clever solution or more illuminating examples or other considerations? -- Beland (talk) 08:56, 28 May 2024 (UTC)
- In sub- or superscripts, it's usually best to use a horizontal fraction, as in x1/2 or x1/2, but LaTeX works better still: , . –jacobolus (t) 10:15, 28 May 2024 (UTC)
- Oh, nice, that looks way better and is already contemplated by the MOS. I've added a note about that situation, since it seems to occur a lot. (I'm systematically getting rid of the precomposed characters where they are not allowed). Many thanks! -- Beland (talk) 16:15, 28 May 2024 (UTC)
Markup for Common sets of numbers?
editThe guidelines for § Common sets of numbers mention using \textbfin LaTeX. What about the LaTeX) commands
- \C ( )
- \H ( )
- \N ( )
- \Q ( )
- \R ( )
- \Z ( )
all of which render in blackboard? -- Shmuel (Seymour J.) Metz Username:Chatul (talk) 14:02, 25 July 2024 (UTC)
Hoping someone with template editor rights and more knowledge of Lua can fix {{Percent}}
, which is outputting hyphen-minus (---) and not minus-minus (−), e.g.: {{percent|-1}}
→ -1%
That should be producing: −1% —Joeyconnick (talk) 23:28, 29 July 2024 (UTC)
Integral not bracketing the integrand
editDoes:
warrant reformatting on the grounds of being confusing to those unfamiliar with the practice, or does MOS:STYLERET apply?
Thanks, catslash (talk) 23:51, 7 August 2024 (UTC)