Page **1** of **1**

### Math formulas rendering

Posted: **Fri Aug 29, 2014 12:28 am**

by **peopleopinion**

What about to implement a new feature for writing and rendering math formulas into posts?

I implemented it with the use of an external service, as I talked into this post on my web site:

http://peopleopinion.altervista.org/vie ... __EFoF_vUI.

Why?

I think having formulas well formatted and rendered as on paper, will help users (including mods and admins) to express better concepts and readers to understand better what writers wrote.

Having this feature with an external site works but slows the page rendering. So I think it will be a good thing to make things more quick for visitors and readers and more simple for admins implementing the feature into the core and having some option into the ACP to activate / deactivate and configure it.

----------

View idea at:

Math formulas rendering
Posted by

peopleopinion

### Re: Math formulas rendering

Posted: **Fri Aug 29, 2014 7:38 am**

by **Paul**

The use for this will be really limited for nearly all forums, this is really better as extension in my opinion.

### Re: Math formulas rendering

Posted: **Tue Jun 16, 2015 4:02 am**

by **peopleopinion**

Paul wrote:The use for this will be really limited for nearly all forums, this is really better as extension in my opinion.

Extention? Well I don't know. There are some web sites that offer such a service to integrate in another web site or board as well as external service like I did into mine, here an example:

http://peopleopinion.altervista.org/vie ... X-Z24G88-q.

So I was wondering that it could be an idea to evaluate just to insert in ACP an option to activate the reference to such web site (or a better one) while the core of the math formula code is not implemented into the phpbb core at all but just Linked to the external service. There are pretty good services out there. So may be this one could be an alternative solution to evaluate. Also to implement a feature this way could be very easy and it needs very few hardcoding and just one more var in database table to store if the option is active or not.

This scenario is like as doing referring to jquery library directly to the original dev web site instead to import it into own web site. (idea borrowed from "using jQuery with a CDN" article).

**But I'm not an expert to evaluate every possible consequence of this scenario.**

### Re: Math formulas rendering

Posted: **Tue Sep 29, 2015 7:31 am**

by **AmigoJack**

peopleopinion wrote:possible consequence

An unavoidable consequence is that for everybody the board code needs a longer execution time, no matter if they use this feature or not. That's why an extension is by far the better solution.

### Re: Math formulas rendering

Posted: **Wed Sep 30, 2015 3:52 am**

by **peopleopinion**

AmigoJack wrote:peopleopinion wrote:possible consequence

An unavoidable consequence is that for everybody the board code needs a

**longer execution time**, no matter if they use this feature or not. That's why an extension is by far the better solution.

Longer execution time that happens only if into the page browsed are present math formulas, though.

### Re: Math formulas rendering

Posted: **Wed Sep 30, 2015 8:05 am**

by **AmigoJack**

peopleopinion wrote:only if

No, conditions need to be evaluated always.

### Re: Math formulas rendering

Posted: **Wed Sep 30, 2015 9:58 pm**

by **peopleopinion**

AmigoJack wrote:peopleopinion wrote:only if

No, conditions need to be evaluated always.

Evaluating the condition "if there is a formula into the page" is pretty fast than rendering it (if found any into the page).

I have implemented as bbcode formulas rendering feature into my forum/site as external service and the event "render the formula" is triggered only if a "a formula was found" event calls the "render" event. So browsing a page is not quicker or slower if I disable or enable the feature respectively on pages where no formulas are present: the load speed is about the same. If there is any difference, is for the computer timing, not for the the "human timing": humans (me too) don't get any significant differences when browsing pages with or without that function active if in the page isn't present any formula. Of course if some formulas are in the page, then the page is a little bit slower, very few seconds. Maybe it depends on the fact that it is an external plugin to be load from another server that has to be contacted to render the math formulas. I don't know what is its "normal" workload and general server performances. But usually it works pretty well, IMHO, because its loading timing is still acceptable: a little price to see complex formulas rendered well formatted instead the inline version, that was mostly incomprehensible for the majority of people.

And, anyway, in my experience, the external service my site uses, the page isn't as slow as when into is active the adds or the social widget (facebook, twitter, g+ or google analytics, etc.): infact adds and social widgets make pages slower than math formula rendering widget.

The problem with the external widget is that the math formula is not rendered at all if the external server is down or the related web site service closes for any reason. In this (rare) case will be showed an error. This problem will be solved if the feature will be implemented into the same web space and integrated (in the core or as ext).

### Re: Math formulas rendering

Posted: **Thu Oct 01, 2015 7:59 am**

by **AmigoJack**

peopleopinion wrote:Evaluating the condition "if there is a formula into the page" is pretty fast

That alone is too simplified - it's a formula

**per post**, hence a condition needs to be evaluated for topics like these at least 15 times. And now add all the other ideas from you where posts should be augmented. Yet only fraction of

*phpBB* administrators will use formulas at all - that's why it is still a rather wasted bloat to the core - no matter how fast the additional code is: it

**has** to be executed and will always affect performance.

### Re: Math formulas rendering

Posted: **Fri Oct 02, 2015 2:23 am**

by **peopleopinion**

AmigoJack wrote:peopleopinion wrote:Evaluating the condition "if there is a formula into the page" is pretty fast

That alone is too simplified - it's a formula

**per post**, hence a condition needs to be evaluated for topics like these at least 15 times. And now add all the other ideas from you where posts should be augmented. Yet only fraction of

*phpBB* administrators will use formulas at all - that's why it is still a rather wasted bloat to the core - no matter how fast the additional code is: it

**has** to be executed and will always affect performance.

IMHO we are talking about milliseconds. Which User is interested to milliseconds? (S)He doesn't even notice.

Also, if implemented as internal feature [or as installable ext] (in a lot of boards sooner or later some math is used), it would be possible to use conditional html phpbb template comments (are they called this way lines similar to: <-- IF S_MATH --><javascript to eval the math code><-- ENDIF --> ?). Such kind of implementation will prevent even the insertion of the js code if no [math] tag is in the page. So the evaluation of the code for rendering the math formula is 0 at all.

Any way this happens only if no formula is into the page. If there is some, than some slowness could be present. And not only for just one formula per post, but it could be more and more, depending on the number of formulas to be rendered into the whole page.

Sorry I don't understand the meaning of the following sentence:

AmigoJack wrote:And now add all the other ideas from you where posts should be augmented.

Yet only fraction of *phpBB* administrators will use formulas at all

I agree with, but admins aren't the lone users of the board.

### Re: Math formulas rendering

Posted: **Fri Oct 02, 2015 2:24 am**

by **peopleopinion**

And also, if present, who makes math formulas saves a lot of time instead because doesn't have to make images any more to communicate his/her thoughts, and images could be complicate (for someone at least) to make the right way and heavy to download.

Also without this feature users are motivated to use the linear notation that is a bit more difficult to interpret and so they are demotivated to write something math and try to write a lot of extended explications to explicate by using words to explicate a thing that a formula could explicate in less space and more exactly and the easier way.

Nevertheless this feature could start a positive stimulation in the direction of starting new board sites based on math topics. And everybody knows how much it will be such useful thing for a world that lacks so much of math passion

especially for young students would be really useful to allow them to exchange a lot of infos about this obscure subject that math sometimes is.

In my humble opinion the way to go would be to implement some kind of math editor engine... to place side by side to rendering engine. But this is something yet more complex.

### Re: Math formulas rendering

Posted: **Fri Oct 02, 2015 6:50 am**

by **AmigoJack**

peopleopinion wrote:IMHO we are talking about milliseconds

No, it all depends on the underlying system - you don't know on which processor PHP is running and how many processor time it gets. Nowadys people use

*Raspberry Pi*s and suddenly it makes sense again to use slimweight software (not rage consuming memory).

peopleopinion wrote:(in a lot of boards sooner or later some math is used)

Even that is something I never experienced, being a user on many boards. Here on

*phpbb.com* I haven't seen one topic with math in it. Not to speak of never having encountered formulas.

peopleopinion wrote:Which User is interested to milliseconds?

The owner. On a frequented board there could be hundreds of users being active at the same time, and suddenly all their "milliseconds" sum up to a remarkable performance hit.

peopleopinion wrote:conditional html phpbb template comments

...

the evaluation of the code for rendering the math formula is 0 at all

Yes, but not the template conditions - they're also processed everytime.

peopleopinion wrote:If there is some, than some slowness could be present

We're talking the whole time about the server side performance. The client side performance is a different subject; and based on how good the client is all the JS execution is no thing to care about.

peopleopinion wrote:Sorry I don't understand the meaning of the following sentence

Sum up all the conditions that would needed to be processed from all your other suggestions that are related to posts and you'll see how much more code needs to be executed. Everytime.

### Re: Math formulas rendering

Posted: **Fri Oct 02, 2015 7:36 am**

by **david63**

Interesting as this discussion may be, can I ask - "how may people actually use mathematical formulae when posting in a forum"?

### Re: Math formulas rendering

Posted: **Thu Oct 12, 2017 5:13 pm**

by **Jocelyn79**

MathML was designed for the purpose of rendering mathematical formulas.

So, a better idea would be :

- either to allow the use of MathML in posts

- or create custom BBcodes that render MathML instead of HTML (I'm not sure if it is currently possible)

But again...how many of us need mathematical formulas in phpbb?

Click

this link to see some examples of what MathML can display.

(it looks like there is good MathML support in Firefox, but not in Google Chrome)