Posts: 10
Threads: 3
Joined: Jan 2011
2011-07-09, 23:22:09
(This post was last modified: 2011-07-09, 23:25:43 by joneskelark65.)
I try to enable LaTeX in GetSimple as it is possible in many other cms.
Currently there are two known methods:
1. create an image of the LaTeX code and implement it into the page
2. send a JavaScript to the client and it parses the LaTeX to symbols locally
For the image version, there is mathTeX. You can use a simple POST method to get an image from their website:
Code: <img src="/cgi-bin/mathtex.cgi?f(x)=\int_{-\infty}^xe^{-t^2}dt" alt="" border=0 align="middle">
Now in the GetSimple editor every \ is replaced, so I have to use escape characters to parse the correct LaTeX code to their site. This looks then somewhat like this:
http://www.disi.me/index.php?id=latex-test
As you can see the second equation was parsed without escape characters and should show the same as the third.
I cannot get the JavaScript method to work using MathJax. If I put the needed script into the header of a template, it removes everything and I get the error that en empty page cannot be saved. This would be the code in the header:
Code: <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
What I would want is either method (preferred the image solution), to detect LaTeX code if I put it between $$. I am willing to investigate this and learn how the different php scripts play together to find where text is parsed into code and grap $$ to use my own snippen, but with your help that might be much faster Could someone give me a hint, where I should start?
Posts: 3,491
Threads: 106
Joined: Mar 2010
disi Wrote:Now in the GetSimple editor every \ is replaced,
Your server has php 5.3.x and/or magic quotes disabled.
GS 2.0x had this issue, but it was fixed in 3.0 (Your site is 2.03)
Posts: 10
Threads: 3
Joined: Jan 2011
Carlos Wrote:disi Wrote:Now in the GetSimple editor every \ is replaced,
Your server has php 5.3.x and/or magic quotes disabled.
GS 2.0x had this issue, but it was fixed in 3.0 (Your site is 2.03)
I upgraded to 3.0 and can now simple put in the backslash without escape character, thanks.
Still looking through, how I might tripper a script to replace everything between $$ and $$...
Posts: 2,094
Threads: 54
Joined: Jan 2011
2011-07-10, 04:02:19
(This post was last modified: 2013-01-06, 02:47:08 by mvlcek.)
disi Wrote:Still looking through, how I might tripper a script to replace everything between $$ and $$...
You don't need a script to replace anything, if you are using the Javascript version.
However, I played around a bit with both methods of getting nice math formulas and whipped up the attached small plugin. Just change the variable at the top to use one of the methods: - $math_mode = 1: Images
- $math_mode = 2: Javascript
- $math_mode = 3: Javascript, but if Javascript is switched off, images are shown.
In any case you enter formulas between $$ ... $$.
Posts: 10
Threads: 3
Joined: Jan 2011
2011-07-10, 04:13:23
(This post was last modified: 2011-07-10, 04:14:11 by joneskelark65.)
mvlcek Wrote:disi Wrote:Still looking through, how I might tripper a script to replace everything between $$ and $$...
You don't need a script to replace anything, if you are using the Javascript version.
However, I played around a bit with both methods of getting nice math formulas and whipped up the attached small plugin. Just change the variable at the top to use one of the methods:- $math_mode = 1: Images
- $math_mode = 2: Javascript
- $math_mode = 3: Javascript, but if Javascript is switched off, images are shown.
In any case you enter formulas between $$ ... $$.
Thanks mvlcek, that works great.
I could get MathJax to work if I set it to 2 and mathTeX if I set it to 1 but 3 doesn't work, which is no problem.
Posts: 2,094
Threads: 54
Joined: Jan 2011
disi Wrote:I could get MathJax to work if I set it to 2 and mathTeX if I set it to 1 but 3 doesn't work, which is no problem.
Forgot to mention: you need to include jQuery in your template for option 3 to work.
Posts: 35
Threads: 2
Joined: Jan 2013
2013-01-24, 02:37:13
(This post was last modified: 2013-01-24, 03:04:20 by leestwise.)
This is pretty cool! It took me awhile to get it to work, however. To use Forkosh's mathtex.cgi, the link in the plug-in needs to be changed by omitting "dreamhost.". If my hosting server supports the requisite LaTEX and dvipng software, I will be downloading mathtex.cgi to my site so I don't need to depend on another site.
...lee
Though I suppose it can be expected that anyone wishing to use this plug-in should know the TEX format for math formulas, the merely curious will not be able to tell from the example in the plug-in's description whether they would like to learn. The example will not work as it stands. It should be
Code: $$ \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) $$
I'm sure the example code on the GS site was mangled by the posting software; but, it would be really nice for a prospective user to be able to block, copy and paste it into a web page to see how it looks.
...lee
Posts: 6,267
Threads: 182
Joined: Sep 2011
I was going to make a plugin out of this.
http://www.xm1math.net/phpmathpublisher/
But I never did.
This might be better off combined into n00dles shortcode plugin.
Also there are alot more solutions now.
mathml
http://www.mathjax.org/
etc
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2013-10-30, 11:13:56)peleus Wrote: Quote:I was going to make a plugin out of this.
http://www.xm1math.net/phpmathpublisher/
But I never did.
Hi. Any chance that this plugin could be developed maybe next year? I'd love to see this.
There is already a plugin for formulas here.
Posts: 12
Threads: 1
Joined: Dec 2013
By the way, is there a way to show inline equations?
In LaTeX normally it is done by using $ ... $, but I don't know how to do it with this plugin, if possible.
--
vicent
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2013-12-12, 07:14:36)vginer Wrote: By the way, is there a way to show inline equations?
In LaTeX normally it is done by using $ ... $, but I don't know how to do it with this plugin, if possible.
Add a rule to your CSS:
Code: .MathJax_Display { display: inline; }
Then everything should be displayed inline. You can of course still put the formula into a separate paragraph.
Posts: 18
Threads: 3
Joined: Oct 2015
Is there any effect with this news?
https://www.mathjax.org/cdn-shutting-down/
Posts: 18
Threads: 3
Joined: Oct 2015
just share the VisualMathEditor
https://goo.gl/5KrfM0
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2017-05-14, 21:13:19)bigthanks Wrote: Is there any effect with this news?
https://www.mathjax.org/cdn-shutting-down/
New version with changed URLs for js and image fallback.
|