Wikipedia talk:Manual of Style/Mathematics

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Manual of Style    (Inactive)
WikiProject icon This page was within the scope of WikiProject Manual of Style, a project which is currently considered to be inactive.


Hi, all. I'm finding issue with this MoS' recommendation that "when displaying formulae on their own line, one should indent the line with one or more colons (:)". While this is visually correct and sets the formula inside the body, semantically it is incorrect. In wikitext, the colon is supposed to be used as part of definition lists, like so:

:An online encyclopedia
:A print encyclopedia

which forms the HTML:

  <dd>An online encyclopedia</dd>
  <dd>A print encyclopedia</dd>

and the final result:

An online encyclopedia
A print encyclopedia

A problem arises when only the colon by itself is used for indentation:

Pi is the constant

which form the html:

<p>Pi is the constant</p>

and results in:

Pi is the constant


It's still forming a definition list when in reality we were merely trying to use the colon to indent formulae. This is a violation of semantics and creates incorrect HTML, since it creates a definition list without terms.

What we are actually attempting to do with using the colon is to inset the formulae. So instead, I propose that we use <blockquote> instead:

Pi is the constant

which form the html:

<p>Pi is the constant</p>

and results in:

Pi is the constant


While this results in a lot of whitespace, it is actually semantically correct. Thoughts? Opencooper (talk) 04:18, 17 August 2016 (UTC)

Changing the appearance now, in such a major way, is a bad idea. However, fortunately for you, the Wikimedia developers have the same preference for purity of semantics over actually, you know, looking to readers the way we want things to look — that's why we have math formulas rendered as images rather than the better-looking MathJax everyone else has. So, they have also noticed that the way we do it with a colon has problematic semantics. Rather than fixing the rendering engine to make : have a more useful semantics, they have given you an option for rendering math as an indented block. It is: the |display=block option for the math tag. So, e.g., the markup <math display=block>(L^-\oplus R^-)\Cup(L^+\oplus R^+)</math> shows up looking like this:

I don't think there's any semantically clean way of making it indent more than one level, for situations such as this one where the surrounding text is already indented, but fortunately the need for that's rare in articles. —David Eppstein (talk) 04:25, 17 August 2016 (UTC)
Thanks for the response and agreed about the need for better semantics considering we're also indenting this conversation with colons, but sadly I don't think that will ever be addressed since previous talk page alternatives have failed. (LiquidThreads and Flow) Regarding the |display=block option, I just tested it and indeed it works. I'm glad to see there is a solution built in. So how about we change the wording of the MoS to recommend using that parameter instead of the colon? It won't fix past uses, but at least it could prevent the problem in the future. Opencooper (talk) 06:27, 17 August 2016 (UTC)
Like it or not, years of usage have made the colon the standard way of indenting on Wikipedia. I would accept making both the colon and |display=block valid ways of indenting equations, but only under the condition that both are seen as valid and that mass conversions from one to the other are not permitted. If necessary, we could reassess this decision later. Ozob (talk) 12:46, 20 August 2016 (UTC)

The correct way to indent in wikitext is with a colon. The fact that this colon may be rendered as a definition list is an implementation issue in the Mediawiki software. Tomorrow, or any time in the future, the developers could change the way that the colons are rendered. So the fact that colons are currently rendered as definition lists is not incompatible with the fact that colons are the correct way to do simple indentation in wikitext. The issue of indentation goes far wider than just mathematical formulas, and I think that it is better for us to continue to follow the general practice of wikitext (i.e. use colons) than to try some other system which will be different than other article or other types of indentation within the same article. — Carl (CBM · talk) 12:53, 20 August 2016 (UTC)

The problem is that it can't and won't be fixed. Alternatives to talk pages (which use indentation the most) have already been tried and failed. You could change the implementation, but you would either break definition lists, or you would break where indentation is actually needed. There's already a working alternative available for our use case (display=block), so we should start using that rather than continuing to misuse syntax which was never meant to be used like that. Lastly, it is not the correct way to indent. The proper way to indent text is to use CSS or to use other block-level elements like blockquotes (or display=block). The only reason the colon in wikitext indents is as a byproduct of being part of a definition list. This is harmful for both semantic and accessibility reasons. Note that I'm not saying we go back to every article and force the new way, but going forward we actually do things right. I know it can be hard to do things different than accustomed to, but continuing the old way will not fix the problem.
Just a note, that they look exactly the same (the first one is colon-indented and the second using display=block):



Opencooper (talk) 13:33, 20 August 2016 (UTC)
Curiously, on my system (Chrome, MathJax enabled) the second version is rendered without any indentation! As to the question, this semantic argument is way down the list of what is important to me as an editor. Indentation is important to me since I use it so frequently in math articles and I want to be able to accomplish it with the minimum amount of typing.--Bill Cherowitzo (talk) 16:44, 20 August 2016 (UTC)
I presume that's because MathJax directly parses the TeX source and isn't coded to read any attributes. It looks the same to me on OSX Chrome. Opencooper (talk) 21:11, 21 August 2016 (UTC)
A long time ago, someone on Wikipedia decided that the semantics of how the developers coded up the indentation produced by : are irrelevant. Since then, the Manual of Style recommendation has been to use colons for indentation. This is not something that will change short of an RfC with massive support, whatever the merits. Sławomir Biały (talk) 13:40, 20 August 2016 (UTC)
Manuals of Style aren't set in stone and this discussion is only within the scope of Math articles. If we as a WikiProject decide that semantic matter to us, it doesn't do any harm for us to use proper semantics while still allowing others to indent with colons. (Also, if you can find it, It'd be great to be able to read that discussion) Opencooper (talk) 13:46, 20 August 2016 (UTC)
We've been doing it this way since forever. Changing long-established conventions requires an RfC. Wikipedia has millions of articles, and probably several hundred thousand using : for indentation of equations. Having articles that have suitable visual appearance, and a single simple syntactic element for editors to indent equations, has a much higher priority than some trivial considerations about how the back-end software renders : semantically. I would suggest talking to developers about fixing their semantics, rather than proposing major changes to already thoroughly-established Wikipedia conventions. Sławomir Biały (talk) 15:11, 20 August 2016 (UTC)
As I said before, this Manual of Style is for mathematics articles, and for the very specific case of mathematical formula, nowhere else. And you're talking as if adding "display=block" to a tag is any more work than the way we use templates. I already explained why the semantics will be never fixed, instead the developers gave us the block display option. If one more editor insists on starting a RFC, I will, but I don't think it's necessary for a minor change in the math MoS which doesn't even affect the rendered output and is merely trying to correct things.
I really don't get this resistance to change here; I've clearly explained why the old way is wrong, offered a completely compatible and visually indiscernible alternative, and explained why the old way can't/won't change. Is it really such a huge loss if you have to learn something different for formulas? You already use specific syntax for quotes, for images, and for templates. It's funny how this is coming from a crowd that is willing to learn LaTeX which has its own crazy syntax too. Please don't let tradition and habit get in the way of correctness. Opencooper (talk) 15:22, 20 August 2016 (UTC)
Typing ":" is at least 7 times easier than typing "display=block", and any change affecting existing standards of possibly hundreds of thousands of articles definitely needs strong consensus before implementing. I notice that you have basically no meaningful edits to mathematics articles, yet you want to dictate that mathematics editors need to adjust because of some trivial consideration about html syntactic elements? This is meant to be an encyclopedia: above all, readers and editors come first. If you've never edited a mathematics article, I don't see how you can be in any position to say what makes editing easier, and it is already demonstrated that colons are at least indistinguishable from the reader's perspective, if not slightly more robust in terms of what is possible without delving into the intricacies of CSS syntax. Trivial issues like this are way down the list, and need strong consensus before implementing.
Finally, I do not see a problem with identifying an equation semantically with a definition list. Even in LaTeX, equations often carry labels or captions. In electronic theses, captions are often required for inline equation. This is a feature, not a bug, albeit one that has not been exploited in Mediawiki software. Sławomir Biały (talk) 16:10, 20 August 2016 (UTC)
What do my contributions to mathematics articles have to do with this discussion? I clearly have technical knowledge about the subject and you should look past the first few pages of my contribs before making accusations like that: I've edited math articles in the past that include formulas, as well as computer science articles, and have done work with formulas on Commons. The fact that you prefer to separate users into an "old guard" category to even consider their opinion only confirms the elitist and resistant-to-change stereotypes about Wikipedia. I'll think twice in the future about dictating a proposal on a talk page without having written ten math FAs first. And its not trivial because Wikipedia also aims to be accessible for everyone, and semantics are a necessary requirement for screen readers. Lastly, a definition list is not the same thing at all as a caption, refer to the w3c spec on the various tags to see how they are meant to be used. Opencooper (talk) 21:11, 21 August 2016 (UTC)
I'm astonished that you would think that editing mathematics articles is irrelevant to a discussion about best practices for editing mathematics articles. "Captioning" is the wrong word here (in the sense of a caption to a figure). "Labeling" is perhaps a better word, like equation numbers or names that can be cross-referenced. It seems like ":" has the proper semantics for a construction like this, no? And you have now asserted without a shred of evidence that readers are disenfranchised by what you allege are "improper semantics". Please find actual examples of screen readers that do not work with ":" but that do work with your proposed change. In any case, this is clearly a problem that is best addressed by contact the appropriate developer forum rather than try to change long established Wikipedia conventions. Sławomir Biały (talk) 00:25, 22 August 2016 (UTC)

What is the (intended, official) semantics of : in wikitext? Please notice that I am not asking about the semantics of definition lists in HTML. Mgnbar (talk) 16:15, 20 August 2016 (UTC)

The intended semantics is one half of an associative list of (key,value) pairs. (The keys are specified by the semicolon.) The closest I was able to find to "official" policy is MOS:INDENTGAP, but that was written as late as 2014, and earlier guidance in other parts of the WP and Help namespaces are not easy for me to find. The argument here seems to be that it is nonsensical to have (key,value) pairs with empty keys. Firstly, I'm not sure that's true. Secondly, I'm not convinced that it matters in any way that has practical significance, except to cause a pain for mathematics editors to have to perform additional CSS incantations just to get equations to indent properly. Sławomir
17:14, 20 August 2016 (UTC)
Thanks. Mgnbar (talk) 18:53, 20 August 2016 (UTC)

The original post in this talk page section claims that : is intended for definition lists, but I'm wondering whether this is an official policy, what the rationale is, etc. Because the general use, at least for my 11 years here, has been indentation, which is formatting not semantics. Mgnbar (talk) 16:24, 20 August 2016 (UTC)

I think the point is not so much what : is actually intended as, but rather that the Wikimedia software transforms it into html whose semantics (association lists) does not match that intention. Rather than changing the html markup in a way that would match actual usage (without changing its appearance) the developers seem to prefer that we go through cumbersome workarounds. —David Eppstein (talk) 17:20, 20 August 2016 (UTC)
The original poster seems more concerned about the semantics of the generated HTML than the semantics of the wiki markup. That's why I asked about the latter. The problem seems to be that a single wiki markup (:) must map to multiple HTML markups (dd, blockquote). But I'm not even sure that blockquote is semantically correct. Maybe what we need is a wiki tag for making displayed equations, like \[\] in LaTeX. Mgnbar (talk) 18:53, 20 August 2016 (UTC)
I would really like this, but I find it hard to imagine that the developers would agree to new wikitext markup, let alone markup which is intended for such a small audience of editors and readers.
I don't understand the resistance to display="block". I agree that typing ":" is a lot easier and I think that's a strong argument for continuing to permit it. And I know that mass style changes are usually a bad idea, so I think it's a fine compromise to permit both. But as far as my own contributions go, I don't really care if someone else changes them to display="block". It should be easy enough for someone to use AWB to change anything matching the regular expression ^: *<math> to <math display="block">, and I'd be happy so long as they don't presume to yell at me.
Also, I wouldn't object to an RFC. I think all the math editors involved in this discussion have been on Wikipedia for a decade or more; we might be too set in our ways. Ozob (talk) 19:43, 20 August 2016 (UTC)
I also have no strong objection to display=block, although I'm likely to continue using : myself due to ease of typing. —David Eppstein (talk) 20:10, 20 August 2016 (UTC)
Whatever you do, please don't go through with AWB trying to change numerous articles. I don't think this is a math-specific issue, so I don't see why we should worry about it here rather than on some more generally-focused page. Moreover, there are many kinds of indented material in math articles, only some of which are pure math. The math block indentation will not help with an indentation such as this:
is a letter
Instead we get this:

is a letter

which has an undesired new line after the formula. We should stick with the established convention and let the developers fix the semantics of the underlying HTML. — Carl (CBM · talk) 20:26, 20 August 2016 (UTC)
If want you text to stay on the same line as the block formula, you have to keep it in the math tags, just like you would for a blockquote:

If you don't want the text to be formatted as well, you should just be using the formula inline. You'd have to do the same thing for LaTeX's "display" math mode.Opencooper (talk) 21:11, 21 August 2016 (UTC)
That has the same kind of semantic error you are worried about! Only math should be in math tags; other material, such as commentary, should not be. Replacing a well-established usage of colons for indentation with a non-established (actually, discouraged) practice of putting non-math into math tags is not an improvement. Moreover, if we did use inline math in that formula, instead of "block", we would need to use a colon to achieve the indentation! — Carl (CBM · talk) 21:19, 21 August 2016 (UTC)
I agree. While it's not common to want text next to a displayed formula, it does happen. As long as display="block" doesn't support this, it can't replace colons. Ozob (talk) 03:08, 22 August 2016 (UTC)

Regardless of the objections to Opencooper's specific proposals, his/her desire to make Wikipedia accessible (through proper use of web semantics) is admirable. I've inspected the HTML generated from display=block a bit, but I'm not familiar enough to tell whether it captures the semantics correctly. Does it? If not, then does anyone have a solution to the semantics problem? Mgnbar (talk) 21:31, 21 August 2016 (UTC)

A proper solution to semantics designed for math-only articles is to use a WP template for indented equations that would translate simple markup into display="block" or whatever HTML we might find more suitable in the future; we'd be able to fix any formatting bugs quickly. Template:Equation is a good candidate for adapting to this, or copy it to Template:Eq. Template:Math is already encouraged for inline formulae over both plaintext and <math/> anyway.
Regarding the argument that ":" has been standard for years, remember that while the best time to plant a tree was 20 years ago, the second-best time is now (particularly when we have the sapling, shovel, and soil already here next to us). SamuelRiv (talk) 16:13, 25 August 2016 (UTC)
This seems like the most reasonable suggestion thus far. However, there currently are (at least) three ways to typeset mathematics in Wikipedia, that were at one time recommended or supported by the Manual of Style, including {{math}}, <math> and html. Adding a fourth ("we mean it this time!") I think requires some further discussion. Although certainly an implementation as proof-of-concept might go a long way to convince the old guard. Still, I'd be most comfortable with a wider RfC on this. But I don't think we're quite to the point where an RfC can be stated clearly enough to get meaningful community input. Sławomir Biały (talk) 18:41, 25 August 2016 (UTC)
I'd be willing to consider a WP template. I think the first step towards that would be to make a template that imitated existing practice, namely the colon, and to see how we liked it: Is it easy to use, easy to type, etc.? I'm worried in particular about = and | since those have a special meaning inside templates; it's quite easy to get tripped up on those, and I wouldn't want to commit to a new template like this unless I believed that it was easy to use. Ozob (talk) 01:10, 26 August 2016 (UTC)
Good point. The golden rule is "Do no harm." So a fundamental question is, "What does it break?" Sławomir Biały (talk) 13:00, 26 August 2016 (UTC)
Template:math is not "encouraged" over anything; in fact it should not be used in existing articles without consensus, because it has unusual formatting such as using a serif font instead of the usual article font for inline math. The two methods that are encouraged are HTML/wikicode for simple inline math and the math tag for more complicated or displayed formulas. I still don't see how this is a math issue rather than a general Wikipedia issue. — Carl (CBM · talk) 02:19, 26 August 2016 (UTC)
Well indentation isn't used often on Wikipedia, and usually quotation templates are used there. (or specific templates like hatnotes) It's a math-specific problem because it's codified explicitly in the math manual of style to indent using colons. I think in the past I've seen it in another WikiProject too, but I decided to bring it up here now, and it's much easier to try to gain consensus on a single WikiProject rather than more instruction creep elsewhere. Though if we were to compromise and also include instructions for the dispay=block parameter here, I don't think it would be too many instructions since it's specifically for the single section "Using LaTeX markup". Opencooper (talk) 11:47, 26 August 2016 (UTC)

Here's another idea. Perhaps the developers can be persuaded to introduce a <dmath> tag that is simply a synonym for <math display="block">. This is as easy to type as :<math> but doesn't have problems with special characters the way a template would. And the string of characters <dmath> is so unlikely to appear anywhere that there shouldn't be compatibility problems. Ozob (talk) 15:09, 27 August 2016 (UTC)

Explanation of symbols in formulae[edit]

A {{why}} tag has been in Explanation of symbols in formulae since 2014. My impression is that the question was answered in this discussion, so I propose removing the tag and modifying the statement to read:

In Wikipedia, prose is preferred to lists. Therefore, a list such as ... should be written as prose:

RockMagnetist(talk) 17:07, 8 November 2016 (UTC)

Wikilinks inside formulas[edit]

I have occasionally seen articles in which some of the notation within a formula is wikinked, e.g. O(n) or log2 n. This only works in html or {{math}}-formatted formulas, not in <math>. Should the MOS include guidance on such links?

My own preference would be to say not to do this. The color changes distract from reading the formula. If a piece of notation needs explanation for its expected audience to be able to understand it, then a link hidden inside a formula won't be visible enough to be adequate as an explanation; instead, the notation should be explained in the actual article text. And if a piece of notation doesn't need such explanations, what is the wikilink for?

I am not talking about wikilinks on an entire formula, to an article that is about the object described by that formula like SL2(R). Nor am I talking about wikilinks or external links in references whose title contains a formula. Those are separate issues and I think they are non-problematic. This is only about links on proper subunits of a formula.

But this seems like the sort of thing that might be controversial, so maybe we can have a discussion to see whether the MOS should be changed in this way. —David Eppstein (talk) 22:30, 13 December 2016 (UTC)

Yes, wikilinks inside formulas should be discouraged. Perhaps not banned altogether, because there are exceptions (like SL2(R)), that seem like they could be reasonable, but definitely actively discouraged. Sławomir Biały (talk) 23:41, 13 December 2016 (UTC)
I agree. Articles should set up notation and conventions beforehand. I agree that SL2(R) is an exception; I would say that the underlying principle of this exception is that SL2(R), with the subscript and bold, is the correct name of this object, and that the name should be linked only when the object is being used in a sentence, not when it is being used in a formula. I mean to include inline formulas, even simple ones. For example, I would support, "SL2(R) is the group of Möbius transformations," while I would object to linking SL2(R) in, "A fundamental domain for SL2(R) / SL2(Z) is given by {|z| > 1, -1/2 ≤ Re(z) < 1/2} ∪ {|z| = 1, -1/2 ≤ Re(z) ≤ 0}." Ozob (talk) 02:11, 14 December 2016 (UTC)
I agree with everything that has been said about linking formulas. However, contrarily to what has been said at the beginning, it is possible to wikilink a whole <math> formula. For example, , which is entered as [[SL2(R)|<math>\color{blue}{\operatorname{SL}_2(\Bbb{R})}</math>]]. It is even possible to color in blue only a part of the formula, but, in any case, the whole formula is linked. D.Lazard (talk) 10:16, 14 December 2016 (UTC)
I think this trick should not be used either, but also should not be discouraged per WP:BEANS. Sławomir Biały (talk) 11:12, 14 December 2016 (UTC)

Parentheses with Functions[edit]

I strongly prefer using parentheses with standard functions: etc. It makes it absolutely clear what the argument to the function is. I have been burned by this before, when a writer was sloppy and didn't include them with a complicated argument. At the same time, I realize that and have a long tradition, and with just an in there for the argument, it's no big deal. Therefore, I propose adding the following text to the Functions section:

"If you are typing an argument more than one character long for a function, consider adding parentheses around the argument to make it clear what is inside the argument, and what is not."

Ackbeet (talk) 16:20, 30 January 2017 (UTC)

I have to say that I feel like this depends so much on the context that I'm not convinced there's anything useful for the Manual of Style to say. For instance, I would prefer to or . But I would also prefer to (the latter looks like a different function to me). Maybe my preferences are unusual; opinions? Ozob (talk) 02:58, 2 February 2017 (UTC)
When there is an explicit operator such as "+" or "–" in the argument, the parentheses are absolutely required, otherwise the meaning won't be what the author intended. When the only operations with in the argument are implicit, such as multiplication indicated by adjacent variables, or exponentiation indicated by superscript, the parentheses are optional. I don't think the MOS needs to state this, since it's a standard part of math notation, and I don't the MOS needs to state whether optional parentheses are preferred or discouraged. Personally I like to see them omitted when possible. Indefatigable (talk) 01:56, 3 February 2017 (UTC)

Missing amsmath support[edit]

I'm reposting the following comment here to hopefully get some feedback. I'm not sure where I should bring this up, so I'm trying here now:

I just "fixed" a formula that was using \operatorname* -- WP seems not to support the starred version, so the only thing I could really do was to remove the star. This improved the appearance, but it still falls short of the intended typesetting. Is there any way to add support for this feature? Where does one bring up this sort of request anyway? One other missing bit of support that seems crucial is for \genfrac. This is needed a lot, and the workaround(s) are usually less-than-desirable LaTeX. Deacon Vorbis (talk) 19:36, 12 February 2017 (UTC)

Just to show what happens: and
Deacon Vorbis (talk) 14:32, 13 February 2017 (UTC)