1
$\begingroup$

So I just tried to write a simple formula with Microsoft Math Input Panel and it didn't work. When I press the "insert" button in the app, nothing happens. Is there a way to make it work?

I suspect the issue can be in the browser, as it may not be recognized as a compatible MathML application, with which this app is supposed to work, as per its help file.

This app is included in all editions of Windows 7. It'd be a shame for it to be useless for SE sites.

$\endgroup$
  • $\begingroup$ Surprisingly, there is no tag for formulas. Am I the only one to have this problem ever? $\endgroup$ – user1306322 Jan 8 '14 at 0:06
  • $\begingroup$ Are you sure there's no "Copy as LaTeX" option in the app somewhere? It seems weird that a popular formula creator wouldn't have this. $\endgroup$ – Alexander Gruber Jan 8 '14 at 0:14
  • $\begingroup$ There's only "insert". It's probably not popular, but it sure works with MS Word, and I bet that's good enough for MS. I can copypaste the textual representation of the formula from MS Word, but it's not recognized by the site. And even if it did, it'd require owning MS Word, which is an extra step in pasting a handwritten formula. $\endgroup$ – user1306322 Jan 8 '14 at 0:18
  • $\begingroup$ It also works with Microsoft OneNote $\endgroup$ – Guy Coder Dec 30 '15 at 23:22
4
$\begingroup$

Update

The answer below was written under the assumption that you could get MathML markup from Math Input Panel. This turned to be false.

The Math Input Panel doesn't offer fallback text representations of the XML markup on the clipboard. Marko Panic, the program manager for the development of this tool confirmed to me that this was a design decision as they didn't want the end user to be faced with raw XML.

What a wasted opportunity. The Input Panel generates MathML markup for your formulas, but it won't give it to the user. It could be that seeing an XML tag was found to cause brain damage in Microsoft users, I'm not sure. The result is that the Input Panel works only with expensive products like MS Word and MathType, which are designed to receive the data in the way that the input panel produces.

If you don't mind spending $97 on MathType, then that may be a solution: MathType claims to produce LaTeX in a way that is "MathSE-compatible". I'd rather not link to their site.

In case anyone is interested in what Math Input Panel looks like (I never saw it until today), here is a screenshot. The insert button is the only thing that outputs the markup, and it bypasses the user, sending data directly into the application that currently has focus.

MIP

Old answer follows.


Short answer

Math Input Panel outputs your equations in MathML format. MS Word, its OpenOffice analog, and some other software can render MathML. Browsers, for the most part, cannot do it natively, but with the MathJaX script they do. The main problem is that SE is not configured to allow MathML tags as user input.

Suggested workaround: try to convert MathML to LaTeX and then paste LaTeX code here. Unless the Input Panel can produce LaTeX directly...

Long answer

An additional complication to the above is that the MarkDown parser used by SE kills all XML tags except for a very limited set. MathML looks like this:

<math>
  <mrow>
    <mfrac>
      <mrow><mi>x</mi></mrow>
      <mrow><mi>y</mi></mrow>
    </mfrac>
  </mrow>
</math> 

but after the MarkDown parser does its job, what remains is

x
y

Yet there is hope

The parser knows to spare the content between dollar signs. E.g., in $<math> </math>$ MathJaX gets to see the tags. MathJaX is perfectly capable of rendering MathML, but unfortunately it concludes from the dollar signs that the content is TeX, and we get $<math> </math>$. This suggests two plausible solutions:

  1. MathJaX should understand that $<math> ... </math>$ is MathML pretending to be TeX to avoid MarkDown.

  2. MarkDown parser should treat <math> ... </math> the same way it treats $ ... $ now, i.e., ignore it.

The second solution is cleaner: you'd be able to paste MathML without surrounding it with extraneous dollar signs. It is also better future-proof, if in the future browsers begin to support MathML directly and scripts like MathJaX will no longer be needed.

I'd like to see the second solution implemented here. It would take some work, but I think it's doable.

$\endgroup$
  • $\begingroup$ The second solution would take virtually no work at all on the Markdown side: just a case of altering one regex to tell it that math is a valid block tag. The part which might require work is the anti-XSS processing: it's almost certainly whitelisting tags, and the whitelist would need to be updated with every MathML tag. $\endgroup$ – Peter Taylor Jan 8 '14 at 12:07
  • $\begingroup$ As you write in the long answer, pasting MathML isn't a problem because of lack of browser support (since math.SE uses MathJax). The problem is that Stackexchange currently does not want to support MathML as an input format (similar to not wanting HTML as an input). Perhaps the short answer could reflect that. $\endgroup$ – Peter Krautzberger Jan 8 '14 at 15:41
  • $\begingroup$ @PeterTaylor I think it could be simpler: at present you can put whatever tags you want into MathSE post, if they are in a block surrounded by dollar signs. Whitelisting is not applied inside: the system trusts that MathJaX will process those things and produce safe output. If <math> wrapper was treated the same as dollar signs, problem would be solved. $\endgroup$ – Post No Bulls Jan 8 '14 at 16:20
  • $\begingroup$ @PeterKrautzberger I edited the answer. Any comment on the first option, which (it seems) would not require any changes on the SE part? $\endgroup$ – Post No Bulls Jan 8 '14 at 16:22
  • $\begingroup$ @PeterKrautzberger (I am not sure if the ping goes to your inbox or to Peter Taylor's): basically I'm proposing a non-LaTeX environment $\begin{mathml} (MathML goes here) \end{mathml}$. I think MathJaX already has some environments that are not in standard LaTeX... $\endgroup$ – Post No Bulls Jan 8 '14 at 18:09
  • $\begingroup$ While that would be possible, it wouldn't really solve the problems that block regular MathML input. Sanitization would still have to be done, you would still have to convince the communities to want that and finally Stackexchange to load the additional MathJax component. I think the MathJax part is the least complex part here. $\endgroup$ – Peter Krautzberger Jan 9 '14 at 20:46

You must log in to answer this question.

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