21
\$\begingroup\$

MathJax Support has been enabled for RPG.se

MathJax support has been added to RPG.se. We should probably write up a guide on Meta for using it, but in the short version is that you can use \$\$ to format the part using LaTeX's mathematics markup. In the meantime there is this MathJax Guide as a reference.

Original post:


The nature of tabletops overlaps a lot with statistics to the point where being able to simply write minor mathematical expressions would be beneficial to conveying simple mathematical explanations. For example, Math.SE has a plugin that allows for the direct in-line use of LaTeX math formatting within answer and comment texts, which they use to much success.

Example Answer that could have benefited from LaTeX markup

Here we see a very beefy post about determining if a die is fair. This kind of post, though mathematically heavy, could be of importance to a vast portion of the RPG.SE audience. The construction of simple superscript and subscripts in LaTeX require only ^ and _. Where in RPG.SE currently, there is a need to apply html tags and italic markup to make expressions appear in math format proper, and even then it's difficult to get right.

Now, those are the merits. Demerits would include the potential for the posts which contain the LaTeX equation bounding symbols (which are $ and $$) may end up wonkily applying math format to posts that did not intend it.

I want to know how much a [item] costs in [system].

Oh, it costs $100, but you can buy one during recessions for $50.

In the above response, the LaTeX plugin will turn the section "100, but you can buy one during recessions for" into math format and treat anything within it as LaTeX markup.

I believe that such occurrences are rare, but I don't have a real basis for how often two dollar signs appear on the same line in answers or comments. Someone please feel free to prove me wrong.

In the comments, a solution has been found.

One can use other delimiters for in-line math mode, and SE already supports that. One site (economics?) already uses \$...\$ instead of $...$ for that reason. – Davide Cervone 2 hours ago

Another demerit is that not many users of RPG.SE may be familiar with LaTeX already and will need to learn it to use it. This demerit is less of an issue as LaTeX is a very common markup with numerous resources available throughout the net. Not only that, but the mathematically-inclined users who want to use it, will most likely know LaTeX from their background.

Still, the introduction of LaTeX to the community where it would be used but currently isn't can't be expected to be enforced. If unknowledgeable users continue to mark-up math as 1 / (6^4) for the probability of getting four sixes on 4d6, would users be expected to edit the posts to wrap the math expressions in LaTeX?

I believe that it would be a nice plugin to add to the community for when it's needed, and can't argue for the lack of it being a pervasive problem. Nevertheless, I'd like to open up the discussion about whether or not the community wants the plugin and how it should be handled if added.

This is my first time writing a serious meta post, if I'm remembering correctly, so bear with me.

\$\endgroup\$
  • 3
    \$\begingroup\$ Re third-last paragraph: knowledgeable editors already edit for formatting as a matter of course, so no worries there. Users would not be expected to use LaTeX, but where easily added, others could do simple conversions to LaTeX for clarity and ease of reading after the fact. \$\endgroup\$ – SevenSidedDie Nov 10 '15 at 19:09
  • \$\begingroup\$ Perhaps a Greasemonkey script that helps with the existing html approach during editing would be a less invasive solution. I might play around with it over the weekend. \$\endgroup\$ – DaFluid Nov 12 '15 at 8:04
  • 1
    \$\begingroup\$ @DaFluid Greasemonkey is a more invasive solution. Users will be expected to download and use Firefox with the Greasemonkey extension. Not only that, but users who do not have that browser environment will be presented with raw markup, which is very much unacceptable. \$\endgroup\$ – Axoren Nov 12 '15 at 8:08
  • \$\begingroup\$ @Axoren I meant it as tools and shortcuts to help with writing the html markup required to make the text look math-like in a way that's already used (like in the answer you linked as an example). Viewing the answer would require no scripts at all, and one could still achieve the same look writing manually, as they did so far. But having a quick shortcut for "insert tab" or "superscript" would be convenient for those that take the effort to install the script, and also those who are not familiar with html but would like to achieve the same look. \$\endgroup\$ – DaFluid Nov 12 '15 at 8:20
  • \$\begingroup\$ @Axoren something similar to this, but which would use the italics and html sub and sup tags and the & escaped special characters (all of which are already supported and in use), instead of MathJax. \$\endgroup\$ – DaFluid Nov 12 '15 at 8:37
  • \$\begingroup\$ @DaFluid another issue with that is the lack of proper formatting parallels. While superscript and subscript exist, there's no overline, overtext, or undertext (as there would need to be for summations and complements). Though, that would potentially reduce the burden of meeting smaller formatting goals. \$\endgroup\$ – Axoren Nov 12 '15 at 17:41
  • \$\begingroup\$ Even Worldbuilding has MathJax! *moue* \$\endgroup\$ – SevenSidedDie May 8 '16 at 17:40
  • \$\begingroup\$ @SevenSidedDie I can't imagine what they use it for. Are there statistics on the performance hit they're taking by having the plugin loaded? Current stats of WorldBuilding.SE (questions 5.9k, answers 27k, answered 100%, users 16k). Current stats of RPG.SE (questions 16k, answers 42k, answered 100%, users 18k). We have nearly thrice the questions, roughly the same user population (a difference of 2,000 more in RPG.SE). It could be worth considering them a case study since RPG.SE has as many users, but more questions. Any performance hit we take, they're taking just as much as we speak. \$\endgroup\$ – Axoren May 8 '16 at 22:51
  • \$\begingroup\$ @Axoren Their [status-completed] meta post asking for it is here: LaTeX notation for Math. I haven't found any performance stats mentioned in their meta; I suspect that our concerns below are way, way overblown for a little site like ours (or theirs). \$\endgroup\$ – SevenSidedDie May 9 '16 at 2:36
7
\$\begingroup\$

This one slipped a bit in checking in on, but we've turned on MathJax for the site now.

Based on Miniman's analysis, we've figured that we should turn it on with the delimiter as \$ rather than $.

\$\endgroup\$
17
\$\begingroup\$

I support this. MathJax would extensively help a lot of our posts.

  • Server-side performance isn't an issue because we're a small SE, like others that already have MathJax enabled.
  • Client-side performance isn't an issue because it's pretty fast, as demonstrated by those same small SEs that enjoy MathJax.
  • Clearly-presented equations are topically relevant, since we accept questions about statistics of complex dice mechanics, character build performance modelling, and the like.
  • It's possible to implement with backwards compatibility — without breaking existing posts that include multiple $ on the same line — since MathJax supports customising the delimiter. (The most sensible one for our purpose might be \$?)
  • Most critically, it would be useful at RPG.se since we have a significant number of posts that would be substantially improved, just waiting to be made amazing with MathJax formatting. MathJax would let us get rid of our last remaining pockets of misused code formatting.

Since the cost is negligible and the benefits are significant, there's little reason to not use the right tool for the job. Let's enable MathJax at RPG.se!

\$\endgroup\$
  • 5
    \$\begingroup\$ I cannot imagine a better answer to this question. \$\endgroup\$ – KRyan Nov 10 '15 at 21:53
  • 2
    \$\begingroup\$ For interest's sake, there are 162 questions on the site that have one or more of those tags, so the overlap isn't as much as you might expect. \$\endgroup\$ – Miniman Nov 11 '15 at 0:29
  • 1
    \$\begingroup\$ Just FYI, the StackExchange network loads MathJax from the MathJax CDN, so enabling it should not add additional load to the SE servers. \$\endgroup\$ – Davide Cervone Nov 11 '15 at 11:32
  • \$\begingroup\$ @DavideCervone Loading MathJax has a server impact on SE in the form of the configs that need serving. I've clarified that in my post. \$\endgroup\$ – SevenSidedDie Nov 11 '15 at 19:41
  • \$\begingroup\$ @SevenSidedDie, I'm not sure that's quite accurate. The MathJax configuration file (e.g., TeX-AMS_HTML-full.js) comes from the MathJax CDN. But you are right, there is a small file (mathjax-editing.en.js at under 1.4KB compressed) that is served from SE. I had forgotten about that. \$\endgroup\$ – Davide Cervone Nov 11 '15 at 21:30
  • \$\begingroup\$ @DavideCervone That's the one, yes. I just did a run and, though MathJax and TeX-….js are cached, mathjax-editing.en.js was a 146ms GET on first load, 19ms on refresh. (Non-caching performance is relevant server-side because most of our hits, IIRC, come from non-regulars.) \$\endgroup\$ – SevenSidedDie Nov 11 '15 at 21:41
  • \$\begingroup\$ The server time is almost entirely irrelevant; the SE network seldom, if ever, goes above 5-10% CPU/disk utilization. The stats given are all about user-perceived page load latency. RPG would need to consider on that basis, not the basis of the miniscule and irrelevant server load. \$\endgroup\$ – user17995 Nov 16 '15 at 5:19
  • \$\begingroup\$ @TuggyNE I may have misunderstood the stats, and would be glad to hear that server time is irrelevant. I gathered that server time was relevant because of the concern raised in that post about 3M hits and 80 some-odd extra server-hours being generated by MathJax were it enabled on SO, which doesn't sound like end-user performance. If it's just a matter of client performance though then I think we're good: between caching and MathJax being asynchronous, there's nearly no effect. \$\endgroup\$ – SevenSidedDie Nov 16 '15 at 5:24
  • \$\begingroup\$ @SevenSidedDie: "81.9 hours a day of additional load time" reads as cumulative user load times across all SO users to me. I could be mistaken, but that's what it sounds like. \$\endgroup\$ – user17995 Nov 16 '15 at 5:28
  • \$\begingroup\$ @TuggyNE That's possibly how it was meant. Though if that's so, it's an odd thing to care about—normally there's no point in caring about the cumulative delay, since only personally-experienced milliseconds of it are relevant to user experience. \$\endgroup\$ – SevenSidedDie Nov 16 '15 at 5:31
  • 2
    \$\begingroup\$ @SevenSidedDie: It sounds like the sort of "here's the total impact to our userbase" stat that's commonly thrown out to get a different perspective when dealing with large-scale minor tweaks, in my experience. That's how I'd take it. You know, like the stats on how much money is saved by daylight savings time. \$\endgroup\$ – user17995 Nov 16 '15 at 5:32
  • \$\begingroup\$ Since it turns out my hesitations and caution about server- and client-side performance were totally misplaced, as seen by MathJax deployment for other sites like Worldbuilding, I've cut down each section into a single declarative bullet point. All signs point to MathJax being awesome here, so all that hemming and hawing was silly! \$\endgroup\$ – SevenSidedDie Jun 2 '16 at 21:39
9
\$\begingroup\$

This is a community-wiki post that everyone can edit.

Its purpose is to compile a list of RPG.se answers that would significantly benefit from LaTeX markup, as part of the use-case argument for enabling MathJax here.

Shog9 said in response to the Code Review request to enable MathJax:

Unless there's a large population of posts that could benefit extensively from it, there's no need to impose the cost on the rest of the posts. A few subscripts don't really necessitate this.

They then compiled a list of answers that would benefit significantly from MathJax support, and the request was eventually implemented.

We need to do our own due diligence and legwork!


List of answers that would improve with MathJax


Deleted answers and answers with trivial uses of mathematical notation (i.e., MathJax would likely not improve clarity) have been skipped. Answers to closed questions have been included.

\$\endgroup\$
  • \$\begingroup\$ So CodeReview presented eleven example posts which would have been improved, then SE instituted MathJax there; we've got 43 up there and I think we've been picky about what "level" of improvable post we'll list. At what point do we say we've got enough and try and flag this to SE's attention? Do we feature this Q&A? Get in touch with a CM?What's the next step? \$\endgroup\$ – nitsua60 Jun 2 '16 at 17:53
  • \$\begingroup\$ @nitsua60 I'm not sure. The [feature-request] without one of the red [status-*] flags means that it's in their queue to look at and respond to. I'm not sure why it's taking this much time to either [status-planned] or [status-declined] it. I guess I can poke a CM to see if something's gone wrong and the request has been lost? \$\endgroup\$ – SevenSidedDie Jun 2 '16 at 18:09
  • \$\begingroup\$ @nitsua60 Official word is it probably got lost in the queue. But we have MathJax support now. :D \$\endgroup\$ – SevenSidedDie Jun 2 '16 at 22:21
  • \$\begingroup\$ Okay to start slowly editing the posts on this list? Strikethrough in this post when up-converted? \$\endgroup\$ – nitsua60 Jun 2 '16 at 22:45
  • \$\begingroup\$ @nitsua60 I think if we're going to do that, making a fresh meta for it would be useful as a “call to arms” that we can [featured], something like this example, with a copy of this list in a CW answer post under it. This is useful here for historical records. \$\endgroup\$ – SevenSidedDie Jun 2 '16 at 22:48
6
\$\begingroup\$

Mathjax would be pretty cool. It's only relevant to a tiny portion of our questions though, so it had better have a completely negiligible cost to the rest.

One factor is performance impacts. I'll get to that.

More importantly, one answer suggests that something like "$100 is great, $200 is too much" would partially become MathJax. That's insane and bad, especially when our Markdown convention suggests *this * should never become italicised. That's a big usability negative for our crowd more concerned with talking about game currency and the prices of real-world products than complex mathematical formulae, which is most of them. That makes for a total no-go.

When $something like this$, no spaces either side, is the only way to get something parsed as markdown, then I'll consider that penalty nonexistent. (And it'll show the people who write "100$" what-for. Get with the convention, you reprobates!) Alternately, Davide mentions in comments that alternate delimiters like \$ ... \$ get used on some sites - this will work better for us too, 'cause who writes "\$"?


Now, performance:

The performance penalty's bad, but it's only present on first load. The original conversation on featuring it on SO mentions a ~300ms additional delay when MathJax is present, which is a lot in web terms. (The first five or so seconds are very important; some people will decide whether to close our tab in less than that time.)

It's not clear what the stats would be now two years later though: DNS was a huge contributor to that delay, and that 300ms is more like 250ms when you notice that their own ad engine accounted for an extra ~50ms load time. They also describe MathJax's config load as "blocking" — I don't know what they're seeing that I'm not, but the very graph cited seems to show concurrent downloads happening and the config not blocking much.

Nowadays I suspect we can also use async script loading which will eliminate anything related to slowing down initial page load times. Page loads, MathJax loads a few hundred milliseconds after that or whenever's convenient. (If I'm understanding the async spec correctly?)

\$\endgroup\$
  • 1
    \$\begingroup\$ I just tested the $100 is great, $200 is too much on Math SE, and can confirm that this does actually happen. Agree that it’s insane and basically kills the desirability of this. \$\endgroup\$ – KRyan Nov 11 '15 at 13:43
  • 6
    \$\begingroup\$ One can use other delimiters for in-line math mode, and SE already supports that. One site (economics?) already uses \$...\$ instead of $...$ for that reason. \$\endgroup\$ – Davide Cervone Nov 11 '15 at 13:55
  • 3
    \$\begingroup\$ @DavideCervone Ah, then that would be fine. It’s always tough to know how much SE is willing to customize things for any one particular site, but yeah, an economics site clearly has a compelling reason both to have LaTeX maths and be able to naturally use dollar signs, heh. \$\endgroup\$ – KRyan Nov 11 '15 at 15:55
  • \$\begingroup\$ How many of our posts use dollar signs? I can think of very few games that use dollars as currency (GURPS, d20 Modern?); and few of our questions could have legitimate answers that contain multiple real-world prices. I admit that I considered the likelihood of that formatting glitch mattering to be too low to bother addressing in my own answer. Was that misguided? \$\endgroup\$ – SevenSidedDie Nov 11 '15 at 17:27
  • \$\begingroup\$ @SevenSidedDie In my opinion, it would have mattered little if things had been that way from the start, but to have it as a breaking change that messes up old answers (can’t search for $ that I can tell) is a lot more severe. \$\endgroup\$ – KRyan Nov 11 '15 at 17:54
  • \$\begingroup\$ @KRyan Sorry, I mean just that I would be surprised if we had even one post affected, not to oppose anything. Given there's a way to configure it for alternative delimiters, I don't think delimiters are a factor against enabling the lib anyway. \$\endgroup\$ – SevenSidedDie Nov 11 '15 at 19:47
  • \$\begingroup\$ @SevenSidedDie Without the ability to search, though, we can’t really be sure. Hm. Maybe the SQL query thing would be able to check that. \$\endgroup\$ – KRyan Nov 11 '15 at 19:50
  • \$\begingroup\$ @DavideCervone It doesn't appear to be Economics; I just checked there at the inline delimiters are $$. I'm surprised actually. \$\endgroup\$ – SevenSidedDie Nov 11 '15 at 21:57
  • 1
    \$\begingroup\$ There are 349 posts that contain dollar signs, more than twice my estimate for posts that might benefit from MathJax (162). 137 of the 349 contain 2 dollar signs, if that matters. \$\endgroup\$ – Miniman Nov 12 '15 at 0:37
  • 3
    \$\begingroup\$ @SevenSidedDie, ok it turns out it was Electrical Engineering (and also Code Review) that use \$ rather than $. See this post for a complete list of MathJax sites (as of the date of the post). \$\endgroup\$ – Davide Cervone Nov 12 '15 at 1:06
0
\$\begingroup\$

No.

To me, some performance impact (any) and user confusion (any) is a higher cost than the benefit of LaTeX notation on the tiny handful of questions where it could apply (and of that tiny handful, how many posters will go to the trouble to learn and use it?). A possible incremental benefit on literally 5 or less Q's needs a flat zero cost to even entertain.

\$\endgroup\$
  • 1
    \$\begingroup\$ Note that the end-user performance impact is ~300ms, so for user experience purposes that cost is effectively zero. The potential for user confusion when using multiple dollar signs is a valid concern though. \$\endgroup\$ – SevenSidedDie Nov 11 '15 at 0:57
  • \$\begingroup\$ @SevenSidedDie Agreed. That concern is the probably the biggest and least-avoidable issue. \$\endgroup\$ – Axoren Nov 11 '15 at 1:08
  • 3
    \$\begingroup\$ Speaking as a Web guy, 300 ms is a lot of performance impact. \$\endgroup\$ – mxyzplk Nov 11 '15 at 1:35
  • \$\begingroup\$ @mxyzplk Applied to each pageload synchronously, yes. However, we can load the LaTeX plugin asynchronously so that this 300 ms disappears. Instead of waiting 300 ms for pageloads, we're waiting 300 ms for LaTeX markup to be turned into LaTeX output. You yourself argued that a very small number of questions would benefit from it, so the number of people affected by this will be low. However, the people affected by the laggy LaTeX rendering will be repaid the cost with proper-looking statistical formulas. \$\endgroup\$ – Axoren Nov 11 '15 at 3:35
  • 2
    \$\begingroup\$ @mxyzplk The number of people affected by the 300 ms goes from "Everybody" to "People viewing a LaTeX'd post." (Ran out of space and wanted to clarify.) \$\endgroup\$ – Axoren Nov 11 '15 at 3:36
  • 1
    \$\begingroup\$ @Axoren, no, it's a fixed cost apparently. For reasons not clear to me, the request to fetch MathJax is (partially?) a blocking operation, so other pageloading waits until it's done. More on that in the post I link to in my answer to this Q. \$\endgroup\$ – SevenSidedDie Nov 11 '15 at 5:43
  • \$\begingroup\$ @SevenSidedDie Really? That's odd. I assume the maintainers of RPG.SE don't have the luxury of making minor modifications to the plugin before including it in the community. \$\endgroup\$ – Axoren Nov 11 '15 at 5:46
  • \$\begingroup\$ @SevenSidedDie The references I read in the original were about a first-time load cost. Certainly it has to load the library and then the config. I don't see an indication we'll see the 300ms delay on every load though. \$\endgroup\$ – doppelgreener Nov 11 '15 at 7:02
  • 10
    \$\begingroup\$ The cited analysis of the cost of MathJax is actually flawed in a number of ways. For one, the long DNS lookup times were due to the fact that it used the MathJax beta site (which had just been set up at the time, and didn't have a well-known DNS entry so the lookup times were unexpectedly long). It incorrectly concludes that the loading of the configuration file is blocking, which it isn't. Its conclusion appears to be based on only one run. And so on. Comparable tests on the sites that actually use MathJax don't bear it out, though there certainly is some effect. \$\endgroup\$ – Davide Cervone Nov 11 '15 at 11:29
  • 1
    \$\begingroup\$ Additionally you can easily avoid any issues of multiple dollar sign issues by using the delimiter notation \$, like how its used in the EE and Code Review SE \$\endgroup\$ – Skyler Nov 14 '15 at 7:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .