Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.
We've just setup some LaTeX support, thanks to the great work of "OlegK", the author of the "SELaTeX" project, and John Forkosh, the author of the mathtex project.
You'll see a sidebar on the right, which allows you to type LaTeX and provides a real-time preview. When you're done, you can copy and paste the code over to your post. The code it produces is MarkDown syntax for an image tag. It generates alt-text containing the original LaTeX, so you can edit and see other people's source if you need to.
We've modified the original SELaTeX code in order to use our own LaTeX renderer, rather than the one over at codecogs.com. It's possible we'll have issues with this, so please report any problems.
We are well aware of the insufficiencies of this solution. In particular, it would be lovely to provide MathML to browsers that can handle it, but for now that's beyond us. It would be great to be able to write LaTeX inline in your post, rather than having to jump to the sidebar, but that will have to wait on support from FogCreek, the makers of the StackExchange software. Anyway -- perfect is the enemy of good, so for now we're going with this.
Known bug: the sidebar doesn't appear while you're editing an answer.
It looks a little wonky if you use latex with a sentence: http://mathoverflow.net/questions/4062/can-homgpg-h-fail-to-be-representable-for-affine-algebraic-groups.
I know this is just being really picky, but is it possible to call this something more accurate than "LaTeX"? It's LaTeX mathematics mode, so you don't need to put in the dollars, and ordinary text commands may or may not work, depending on whether or not they are valid in mathematics mode.
But apart from that, that's a great feature to have.
Yes and No. In the Grand Scheme of Things, then no, it doesn't really matter. In the scheme of trying to make the site as useful as possible, then yes, it does matter. You can't type arbitrary LaTeX syntax into that box, it doesn't work. You can type a simplified subset of LaTeX. Exactly what that subset is, I don't know. A little experimenting showed that it stripped out certain commands, but not others.
The preview feature mitigates this a little, since it's obvious that stuff isn't appearing as one would expect, but it's still not technically correct to say that you can use LaTeX input.
@David Brown: The problem is that the underscores in the alt text are special Markdown characters. When you have two underscores on a line, everything between them gets italicized. Since this is the "intended" behavior, I don't think Fog Creek will fix it, but we can. We just have to decide how to. The problem is that if we change the alt text (e.g. by escaping all the underscores and stars), then it becomes slightly harder to edit the source. I think this is a tolerable price to pay. I'll see if I can modify the javascript to escape underscores and stars. For now, you can escape them manually, like I did in your question.
@Andrew: I'd be happy to use a more accurate name. I get the same little twinge of annoyance every time I see (or use) the term "LaTeX", but I don't see a good way around it without constantly launching into explanations about how it isn't really LaTeX.
@fedja: sometimes, the box doesn't appear for me, but it appears after reloading the page. Does this work for you?
That behaviour with the underscores shouldn't happen. That's a bug. It ought to get "protected" as it ends up inside the alt tag, and thus inside an HTML tag. However, a quick experiment shows that it's a "feature" (ie bug) in the original Markdown so you may be right about the difficulty of getting it fixed (though it really would be simplicity itself to fix). Escaping it just involves putting in backslashes, as I'm sure you're aware. However, I presume that this isn't a long-term solution (at least, I hope not!) and once something is integrated with the interpreter then irritations like this should disappear.
As for the name, why not simply "LaTeX-style equations"? That makes it clear that it might not be quite LaTeX (and I'd suggest a thread here where people can note common differences) and also makes it clear that it's for equations only. Otherwise someone might be tempted to write their whole answer in LaTeX!
My vote is also "LaTeX-style equations" in the help box. On the other hand I reserve the right to fudge the difference while discussing it further here. :-)
Great work! Would it be possible to make it perfect by adding a button to paste text from the right box to the left in a single click?
@Ilya, re: automatically pasting. This would require some ever so slightly deeper javascript magic. In principle I think I know how to do it, but won't unless someone comes by my office to do it with me. :-)
Re: the underlying bug in Markdown for handling underscores and stars in the alt text.
Does anyone know how the Markdown code is maintained? Does FogCreek use a standard distribution of Markdown, or have they forked. Can we just submit bug reports and/or patches to someone further upstream than FogCreek?
Do you know what language MO uses? That would give us a high probability of identifying the source of the markdown. Even if they've forked it, it's highly likely that they would implement upstream patches.
Actually, we can do a little detective work ... nope, none of the syntax in extended markdown seems to work which implies that it is plain, ordinary Markdown. In which case, you need to go to the top.
Edit: A little more detective work reveals that this might well be one of the bugs fixed in the latest version of PHP Markdown suggesting that they're not using this version. I'd need to experiment to see if this really is the same bug. Hang on, I can experiment here!
and a
(I guess you need to look at the alt tags to see what I'm testing, but if the bug was in PHP Markdown then the "and a" would be italicised)
@Scott: here's the Javascript: document.getElementById("wmd-input").value += ' ' +document.getElementById("code-box").value + ' '
I wasn't able to paste a javascript link here, but you can prefix above with javascript:
and put into your bookmarks. Clicking on this bookmark will copy text from the code box to the edit box. Tested: Safari 4.
They forked the Markdown, see this SO blog post.
Ah, so they've already spotted the dangers of underscores in the middle of words so they should be open to a bug report on underscores in images.
(curiously, there's one mention of PHP markdown in that discussion but it doesn't get taken up)
@hanche Flott! Jeg viste ikke denne løsningen. Jeg lærer nye ting hver dag.
I've changed the javascript to escape _'s and *'s in the alt text, so this problem should be alleviated. This is kind of hacky because it means that if you edit the source later, you have to manually unescape these characters. Markdown should really protect these characters when they are alt text. I found a bug report on meta.SO which was essentially declined (marked [status-bydesign]), and I posted a new bug report on meta.SE. If there is some kind of Markdown main project, we should file a bug report with them.
I've just added a comment to the first link mentioning the issue and added the remark about it being fixed in PHP markdown to the second.
I've commented over on the SO blog post Ilya pointed out, complaining that the upstream fix to MarkDown hasn't been merged.
Depending on which page I'm on, I either get the jsMath banner or the "LaTeX in the box" banner.
Also, what's the default: jsMath or LaTeX-via-images?
For some reason, the system messages are heavily cached, so when I change it, you get a mix of the two. We're going to keep the LaTeX-via-images box for a few days while we're ironing out any jsMath issues that arrise, but I think jsMath is clearly far superior, so I think we should get rid of the LaTeX-via-images box as soon as we're pretty sure jsMath is stable.
@Dave Penneys: can you explain what issues you're having? Are these problems with the LaTeX sidebar, or with jsMath (where you just put stuff between dollar signs)? What exactly did you try?
I'm guessing you're probably having issues with jsMath. The problem is the interaction between jsMath an Markdown. You can "solve" the problem by escaping special Markdown characters (like _, *, \, and {) with a backslash. Try using \_ and \left\\\{. In fact, you usually don't have to escape underscores and curly braces (but you do have to escape the backslash before a curly brace) because the server side implementation of Markdown is smarter than the javascript version that does the preview. See this post and the jsMath page for more details. I hope the preview will be better in the beta 5 version of the software. It looks like jsMath doesn't recognize \sb, but you should just be able to use underscores.
@cdouglas: This question belongs on the "bugs with jsMath" thread, so I'll copy it there. I can reproduce this bug in chrome on linux.
Images inserted from the side bar don't appear in the mathoverflow.net/questions page.
Example: look at this question. The author apparently used the sidebar to create the symbol C^infty. If you bring up the "all questions" page and scroll until you see this question (page 1 at the moment), you see
Given a compact smooth manifold $M$, it's relatively well known that $(M)$ determines $M$ up to diffeomorphism.
That symbol "(M)" should be "C^infty(M)".
Good catch. Maybe this is the right time to get rid of the png image LaTeX support, since it's pretty clear that jsMath is superior. Weirdly, the asker actually wrote $C^\infty$ (instead of an image) in one spot.
1 to 34 of 34