On sites with TeX support, people can turn comments into full fledged posts with dozens of lines without much effort, which can be quite useful. However, there are some less-desirable pure-noise uses that can occur.

As an egregious example of what's possible:

I actually can't even click the X to delete it unless I went and tried to remove page elements with Chrome's inspector. I'm guessing there are also some mod tools there that could be difficult to click under the right (wrong) circumstances.

Is there a way to limit the feature set of MathJax in comments to thwart some of this? The annoying-formatting-factor of comments is ordinarily quite low, so non-mods not being able to edit them isn't a big deal, but all bets are off with MathJax.

-
Hear! Hear! At a minimum do not allow block formatted equations in comments, as those have been abused by several troublesome users on Physics. –  dmckee Jun 10 '12 at 4:24
@dmckee really? (i myself have used them once to create a linebreak, but thats about it). What examples of "abuse by troublesome users" are there? –  Manishearth Jun 10 '12 at 5:42
Whoa, I didn't even know that mathjax supported that. suppresses need to try it out. Yeah, comments do need mathjax, but there ought to be a way to limit stuff like that. Or maybe just kill the \style{} mathjax thingy in comments. –  Manishearth Jun 10 '12 at 5:47
It would probably be reasonable to disable the \style macro (and a few other similar ones), as Tim suggests, since these are not necessary for normal mathematical typesetting. It is not hard to do that using MathJax's configuration options. –  Davide Cervone Jun 10 '12 at 12:26
seems like repeat offenders can be banned easily enough... –  sarnold Jun 14 '12 at 23:54

I have made an extension that disables the \style, \class, \cssId, and \href macros in MathJax on StackExchange sites that (currently) support MathJax. It also limits access to a few other obscure macros that allow access to style attributes (e.g., \bbox). Finally, it removes the \LARGE, \huge, and \Huge macros as well as \tiny and \Tiny, which can also be used to adjust the font size (but it leaves the smaller sizes like \large so that some font changes can be made). It does not limit spacing commands, which I understand have been misused in some situations; I don't see a viable way to limit them effectively while still allowing their appropriate uses.

This extension can be used in all the major browsers, though some require plug-ins to make it work. See the installation section of this post for details concerning those plug-ins. To use it in IE, you will need to download it and then change the name so it ends in .ieuser.js rather than .user.js (silly, but true).

I hope this helps you out.

Edit: I have added the style settings suggested below to prevent MathJax spacing and positioning macros from being able to cause MathJax output to cover over the voting buttons or other links below questions or answers, or the attribution for comments.

-
Note: there are legit uses of \huge etc. Sometimes, mathjax makes big equations with complicated exponents too tiny. –  Manishearth Jun 14 '12 at 14:26
@TimManishEarth: Sure, there are legitimate uses of \huge; and there are legitimate uses of all the other ones, too, but I suspect that there is not much that requires \huge where \Large could not do as well. Note also that this extension only changes things for your viewing, so the original TeX remains unchanged. If you prefer, you can edit the extension to not remove \LARGE, \huge, and \Huge if you prefer to allow them; that is up to you. Most of the extension-mangers allow you to edit the scripts after they are installed. –  Davide Cervone Jun 14 '12 at 17:17
Hmm, yeah. One more thing: the negative space can be used to do all sorts of craziness, since it IIRC uses relative positioning. With some careful alignment, you can make it obscure the voting arrows/etc. I'll test this when I'm back on main and get back to you. –  Manishearth Jun 14 '12 at 17:21
@TimManishEarth: As I said, I have not limited the spacing macros. Negative space has some critical uses in math typesetting, and so it can't be removed entirely. I suppose the extension could check the bounding box of the final expression and adjust its size if it extends significantly outside of that. I'll think about how best to do that. –  Davide Cervone Jun 14 '12 at 17:33
Oh, I know of the legit uses. I've used it a few times. Also, it can be dealt with on a per-case basis, it can always be removed. I was just putting it out there--I doubt any time needs to be spent here :) –  Manishearth Jun 14 '12 at 17:53
@TimManishEarth: It might actually be better to have the page CSS handle clipping of things that extend over the voting arrows and such. For example, setting div.post-text, div.comment-text {overflow:hidden} would prevent the contents of the questions, answers, and comments from overlaying the buttons on the left or the link/edit/delete/flag links underneath. (This would not prevent overlaying the link to the poster's name in a comment, but that could be handled by using z-index settings, I suspect.) –  Davide Cervone Jun 14 '12 at 17:55
Hmm, nice idea. Note that it may bork large images (then again, those destroy the whole layout and ought to be replaced with linked thumbnails, ao this is a good thing) –  Manishearth Jun 14 '12 at 17:59
Perhaps using z-index to make the arrows and links be above the text would be sufficient, so even if something went beyond the bounding box the comment or post, it would fall underneath the buttons. It looks to me like all the elements have classes, so it should be easy to do. So something like .post-taglist, table.fw, .comment-user, .comment-date, .comment-actions, .vote-cell, {position: relative; z-index: 10} should do it. Something like this could be added to the extension I link to above. –  Davide Cervone Jun 14 '12 at 18:08
Yep, that would work. Could possibly break something else, but that can be tweaked. Thanks! :) –  Manishearth Jun 14 '12 at 18:17
I have added the CSS that I mentioned above to the extension, so if you remove the old one and use the link above again, you should get one that improves the situation with overlapping the user interface elements near the answers and comments. You can check it on this answer. –  Davide Cervone Jun 14 '12 at 22:06

You can also post an answer with an image for every letter, but you don't see that happening every day, do you? Should we now ban images in answers too?

Unless you see widespread abuse of MathJax for breaking the site layout (and I don't mean in sandboxes), then I'm opposed to any change. This will hurt people who have legitimate use for latex in comments.

-
Oh, this is not using Stack Exchange's Imgur account? I smell image rot ;-) (Also, I assume you did not create those image on your computer, right?) –  Arjan Jun 10 '12 at 9:22
Ah, your question mark is missing! –  Arjan Jun 10 '12 at 9:23
@Arjan I did create them on my computer... I wasn't careful enough and I stripped the commas and the question mark (they got replaced by spaces). I didn't check the output carefully — just dumped it to a folder and uploaded it. They're not really rot free... they use imgur instead of stack.imgur... SE doesn't support batch upload and I wasn't going to upload 100+ images one-by-one :P –  Lorem Ipsum Jun 10 '12 at 9:25
Man, if I could upvote again for effort then I would :-) –  Arjan Jun 10 '12 at 9:26
-1. lacks punctuation ;p –  Journeyman Geek Jun 10 '12 at 10:16
-1. I got an headache. –  jokerdino Jun 10 '12 at 10:23
Recall that low rep user face image posting limits. My problem kids with supper long MathJaxy comments were both low rep. –  dmckee Jun 10 '12 at 16:20
Lots of people have the ability to edit posts to "repair" such things, but those that can edit comments are far fewer in number. I'm not suggesting that MathJax be axed altogether from comments, just limited in some sort of way (or is that not possible?) –  Nick T Jun 10 '12 at 17:15
@dmckee If they don't have the rep to post images (10), then they don't have the rep to comment either (50). –  Lorem Ipsum Jun 10 '12 at 19:08
@yoda: In general, yes, but they were doing it under their own questions. –  dmckee Jun 10 '12 at 19:11
@NickT If someone is deliberately making such comments, I don't see why it should even be edited... just flag it. Mods can delete flagged comments without having to reach for the little (x) in the right corner. I guess you could limit some of the size and spacing macros, but I'm not exactly sure if it is possible without breaking something else (it might make a good question on TeX - LaTeX — how much to remove so that nearly all functionality remains, but cannot be used to abuse spacings and such...) –  Lorem Ipsum Jun 10 '12 at 19:17
Yes, we will not be very friendly about such matters. Your answer made me die inside, but very well posted point. –  Kortuk Jun 11 '12 at 12:19