mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.15k stars 1.16k forks source link

Support for Chemfig #554

Open tomascat opened 11 years ago

tomascat commented 11 years ago

Chemfig is a really nice package for chemistry formulae and structures in TeX: http://www.ctan.org/pkg/chemfig

Would be super super useful for us out in chemistry.SE land as well as physics & biology if this was made available to us!

Thanks for considering this issue :)

pkra commented 11 years ago

Thanks for the feature request. This is extremely difficult to do since chemfig depends on tikz which is a monster of a graphical package. If somebody wants to tackle this, probably the best way is to write an extension that works more like an API on top of xyjax, mathapedia or a javascript library for general visualization (threejs, processing.js etc).

tomascat commented 11 years ago

I see!

pkra commented 11 years ago

Sorry for having been a bit negative. It always depends on what you want. If you're looking for a re-implementation of chemfig, that will be hard. But I could imagine that writing macros on top of an existing MathJax extension like xyjax could go a long way. I've never used chemfig but perhaps there's a subset of it that would cover most use cases.

tomascat commented 11 years ago

No worries, the request was kind of a long shot! As you know, StackExchange use MathJax and there was a question on meta chemistry SE about TeX supported ways to implement chemistry diagrams and someone suggested asking you guys!

pkra commented 11 years ago

Contacting us is good advice :) The big obstacle is to write a MathJax extension to get this functionality. The next is to convince stackexchange to use it. We can help with both, of course. Writing the extension is not in our backlog but improving the situation for graphical extensions definitely is (though not very high).

Helping contributors is always high on our list -- so if someone is interested in trying this, they could reach out on our developer list.

tomascat commented 11 years ago

I see! How do I find out btw, about the process of how to make a MathJax extension?

pkra commented 11 years ago

Here's (a draft for) a tutorial https://github.com/mathjax/MathJax-docs/wiki/Tutorial-Extension-Authoring/

A quick way might be to write macros on top of xyjax. The problem is: then you'll have to convince stackexchange to load both xyjax and your extension. Since xyjax was written by a single volunteer (not the MathJax team), this might be a problem for them (i.e. support).

A completely different approach might be to write an extension where the MathJax macros are less MathJax-oriented and more like an API for other graphical javascript libraries (like raphael.js, processing.js, d3.js etc).

OlyDLG commented 7 years ago

Sorry to comment on an old thread, but please clarify: does MathJax currently support xyjax? (It looks like it might be usable as-is (once learned) to execute a lot of required functionality for 2-D chem.)

I'm using MathJax in LightPaper, a Mac WYSIWYG MU editor, via:

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({ TeX: { extensions: ["_extension_.js"] }});
</script>

where, for example, both _extension_=color and mhchem work (!), but xyjax doesn't, using as test code:

\begin{xy}
\xymatrix {
U \ar@/_/[ddr]_y \ar@{.>}[dr]|{\langle x,y \rangle} \ar@/^/[drr]^x \\
 & X \times_Z Y \ar[d]^q \ar[r]_p & X \ar[d]_f \\
 & Y \ar[r]^g & Z}
\end{xy}

obtained from:

http://sonoisa.github.io/xyjax/xyjax.html

Do I have to import xyjax from somewhere else, or import a pre-req to get it to work?

Thanks; I'll start a fresh thread if I haven't heard anything within a week.

pkra commented 7 years ago

@OlyDLG you can load xyjax from our third party extension repository, cf. http://docs.mathjax.org/en/latest/options/ThirdParty.html#mathjax-third-party-extension-repository and https://github.com/mathjax/MathJax-third-party-extensions/tree/master/xyjax