LaTex render or other math notation extension

Looking for an Extension? Have an Extension request? Post your request here for help. (Note: This forum is community supported; while there is an Extensions Development Team, said team does not dedicate itself to handling requests in this forum)
Scam Warning
User avatar
nou nou
Registered User
Posts: 756
Joined: Sat Oct 29, 2016 8:08 pm

LaTex render or other math notation extension

Post by nou nou »

Hello again,


I have users asking me about math notation possibilities, and found this topic:

viewtopic.php?f=72&t=653165#p3671325

I wonder if what is described in there would still work in 3.2, though I'm wary of core code changes, I haven't needed to do any since going up from 3.0

There are other ways to do math notation, but all of them seem to require a html security risk in custom BBCodes.

Has anyone come across an extension? Even one in dev?

Thanks!
User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3637
Joined: Wed Oct 27, 2004 11:35 pm
Name: William

Re: LaTex render or other math notation extension

Post by bonelifer »

One was submitted to the CDB, but it was denied.
William Jacoby - Community Team
Knowledge Base | phpBB Board Rules | Search Customisation Database
Please don't contact me via PM or email for phpBB support .

phpBB Modders is looking for developers! If you have phpBB experience and want to join us, click here!
User avatar
nou nou
Registered User
Posts: 756
Joined: Sat Oct 29, 2016 8:08 pm

Re: LaTex render or other math notation extension

Post by nou nou »

Oh shame.

Denied as in "we'll try again soon" or as in "no way this is ever going to happen"?

:)
User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3637
Joined: Wed Oct 27, 2004 11:35 pm
Name: William

Re: LaTex render or other math notation extension

Post by bonelifer »

Not sure why, other than possibly it either didn't work or had bad security flaws. Their github shows they haven't commited since 2015, they have logged in here since October 2016. It was marked abandoned.
William Jacoby - Community Team
Knowledge Base | phpBB Board Rules | Search Customisation Database
Please don't contact me via PM or email for phpBB support .

phpBB Modders is looking for developers! If you have phpBB experience and want to join us, click here!
User avatar
JoshyPHP
Code Contributor
Posts: 1291
Joined: Mon Jul 11, 2011 12:28 am

Re: LaTex render or other math notation extension

Post by JoshyPHP »

You should look into MathJax or any JavaScript library.
I wrote the library that handles markup in phpBB 3.2+.
User avatar
Ger
Registered User
Posts: 2120
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: LaTex render or other math notation extension

Post by Ger »

I have a working LaTeX renderer with BBcode. It's not yet field-tested, but the underlaying Latexrender class has been in use for over a decade. It does have some specific server requirements though, from the top of my head at least ghostscript of course LaTeX itself. It eventually turns LaTeX formulas inside [tex]...[/tex] BBcode into a PNG image.

Could this be something you can use? If so, I can work it out a bit further since it's now very rough and tailor-made for my usage.

I wonder, since you also asked for footnotes: are you on a science related board? Can you provide your board URL? I'm related to a local (Dutch) science board as well, we might learn from each other.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

Kinderpraktijk SensIQ

-Don't PM me for support-
User avatar
nou nou
Registered User
Posts: 756
Joined: Sat Oct 29, 2016 8:08 pm

Re: LaTex render or other math notation extension

Post by nou nou »

Hi Ger,


The forum I'm involved with deals with graphics software and related development. Not so much a science forum, more a creative and support hub. I can send you a PM if you're interested.

Does your BBcode solution involve a {TEXT} token inside an html attribute? That's what I would like to avoid...

In the meantime I stumbled upon this:

https://github.com/marcovo/phpbb_mathjax

Which I'll check out very carefully on a test board... :)
User avatar
Ger
Registered User
Posts: 2120
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: LaTex render or other math notation extension

Post by Ger »

nou nou wrote: Wed Nov 29, 2017 4:12 pm Does your BBcode solution involve a {TEXT} token inside an html attribute? That's what I would like to avoid...
Not sure what you exactly mean with this question, but the BBcode usage would be like this:

Code: Select all

[tex]
 {5 \choose 2} = \frac{5 !}{2 ! \cdot 3 !} 
[/tex]
That would eventually lead to this html:

Code: Select all

<img class="bbc_img" src="./images/latex/632d0be3ef5da8787784b00be868adfe.png" alt="LaTeX" />
e.g. this picture: Image

The picture is stored in with an MD5 hash as filename. When the hash already exists the rendering doesn't happen but the existing formula picture is used.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

Kinderpraktijk SensIQ

-Don't PM me for support-
User avatar
nou nou
Registered User
Posts: 756
Joined: Sat Oct 29, 2016 8:08 pm

Re: LaTex render or other math notation extension

Post by nou nou »

Interesting approach, though it's nicer still to not have to go through images?

In fact I managed to get the above extension to work with some minor changes in the code to point at the new Mathjax CDN. It's nice, actually. Not everything works as it should, but it's functional. Give it a try if you like?

Who knows, one day I'll learn PHP proper and I can polish it up a little. That elusive future era where I have time... :)
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 4021
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay

Re: LaTex render or other math notation extension

Post by Kailey »

Ger wrote: Wed Nov 29, 2017 8:06 am Could this be something you can use? If so, I can work it out a bit further since it's now very rough and tailor-made for my usage.
Would you still be willing to share this? I have a client asking for LaTex rendering.
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules
If you have any questions about the rules/customs of this website, feel free to send me a PM.

My little corner of the world | Administrator @ phpBB Modders
User avatar
Ger
Registered User
Posts: 2120
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: LaTex render or other math notation extension

Post by Ger »

kinerity wrote: Fri Dec 01, 2017 12:27 pm
Ger wrote: Wed Nov 29, 2017 8:06 am Could this be something you can use? If so, I can work it out a bit further since it's now very rough and tailor-made for my usage.
Would you still be willing to share this? I have a client asking for LaTex rendering.
I've put it on Github just now. Remember: it's a bit in rough shape so you might need to polish it a bit.

If you use it commercially I'd appreciate some coffee and any feedback for improvements.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

Kinderpraktijk SensIQ

-Don't PM me for support-
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 4021
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay

Re: LaTex render or other math notation extension

Post by Kailey »

Thanks, I'll play with it tonight and see what I can work out. :)
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules
If you have any questions about the rules/customs of this website, feel free to send me a PM.

My little corner of the world | Administrator @ phpBB Modders
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 4021
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay

Re: LaTex render or other math notation extension

Post by Kailey »

Quickly playing with it - not working? https://dev.project-w.org/viewtopic.php?f=7&t=5

Code: Select all

When [tex]\(a \ne 0\)[/tex], there are two solutions to [tex]\(ax^2 + bx + c = 0\)[/tex] and they are [tex]$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$[/tex]

Code: Select all

[tex]\sqrt{\frac{a}{b}}[/tex]
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules
If you have any questions about the rules/customs of this website, feel free to send me a PM.

My little corner of the world | Administrator @ phpBB Modders
User avatar
Ger
Registered User
Posts: 2120
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: LaTex render or other math notation extension

Post by Ger »

It has several server requirements
  1. Latex itself of course
  2. Ghostscript
  3. Write permissions for the picture path
Please check them all.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

Kinderpraktijk SensIQ

-Don't PM me for support-
User avatar
Kailey
Community Team Leader
Community Team Leader
Posts: 4021
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Snay

Re: LaTex render or other math notation extension

Post by Kailey »

Ger wrote: Fri Dec 01, 2017 2:58 pm
  1. Write permissions for the picture path
Forgot to install LaTex. By "picture path", do you mean /images/ or /files/?
Kailey Snay - Community Team Leader
Knowledge Base | Documentation | Community rules
If you have any questions about the rules/customs of this website, feel free to send me a PM.

My little corner of the world | Administrator @ phpBB Modders

Return to “Extension Requests”