# LaTeX to MathJax

Sometimes an answer posted on math.stackexchange is long, containing sections, formula numbering, cross-references and even a bibliography with in-text citations, like a little article. It is unwieldy to write such answers directly in MathJax. A much better approach would be to write the answer in LaTeX and then convert it to MathJax. Is this possible? How?

• Could you give an example of such an answer?
– quid Mod
Jun 25 '17 at 10:31
• @quid: This answer, for instance, exhibits some of these features, namely sections and a bibliography. This answer, which I once wrote, has sections and could have benefitted from formula numbering, if only I was able to accomplish it easily. Jun 25 '17 at 10:35
• Thanks for the illustrative examples. A remark, formatting on SE other than that for math is not done by MathJax; instead Markdown (and HTML) is used. Thus, what you likely actually want is a LaTeX to this mix of Markdown and MathJax.
– quid Mod
Jun 25 '17 at 10:46
• It's not exactly what you are asking for, but perhaps some of the editors supporting MathJax and MarkDown could be useful. Jun 25 '17 at 11:23
• @MartinSleziak: That's a good start, however another good reason for a conversion program is I occasionally find myself wanting to incorporate stuff that I wrote on math.stackexchange into my own personal documents, which are written exclusively in LaTeX. If they could have been composed originally in LaTeX, it would have made matters so much easier! Jun 25 '17 at 11:29
• @EvanAad There are some tools related to what you ask in your last comment (i.e., incorporating MSE posts in LaTeX documents; meaning converting MathJax+MarkDown -> TeX, which is the opposite direction than what you mention in question). Although I assume they only convert basic stuff. You can have a look at Save the answer in TEX? and Save the answer in TeX/PDF - revisioned (or some other related posts). Jun 25 '17 at 11:43
• I have not looked into it, but a possibility is to check with meta on TeX - LaTeX to see how they handle this. They may know of a StackApps userscript that deals with this as well.
– user455973
Jun 28 '17 at 1:49
• @GypsySpellweaver: You can't typeset mathematics on the TeX forum. Jun 28 '17 at 2:07
• If they have a user script for converting LaTeX into markdown+LaTeX for posting to their site, perhaps it could also handle converting LaTeX into markdown+MathJax. Or be modifiable to handle your use case. Just a trail to follow, as I don't know if such a thing exists. Since they deal with LaTeX a lot, someone there might have done something along these lines.
– user455973
Jun 28 '17 at 2:10
• @GypsySpellweaver: AFAIK the only way to display a typeset document fragment on the TeX forum is by embedding a screenshot or a pdf file. Jun 28 '17 at 2:20
• Oh, well. It was a thought I had for investigation. Sorry it didn't pan out.
– user455973
Jun 28 '17 at 2:23