Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LaTeX in GetSimple
#1
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 Smile Could someone give me a hint, where I should start?
Reply
#2
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)
Reply
#3
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 $$...
Reply
#4
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 $$ ... $$.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#5
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. Smile
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.
Reply
#6
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.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#7
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
Reply
#8
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
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#9
(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. [Image: smile10.gif]

There is already a plugin for formulas here.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#10
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
Reply
#11
(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.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#12
Is there any effect with this news?
https://www.mathjax.org/cdn-shutting-down/
Reply
#13
just share the VisualMathEditor
https://goo.gl/5KrfM0
Reply
#14
(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.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 1 Guest(s)