Recent Topics

Request: Plugin for mathematical expressions

Started by on Sep 07, 2018 – Contents updated: Oct 12, 2018

Sep 07, 2018 17:04    

Hi there,
I am new to b2evo and have not yet found a solution as how to write mathematical formulars into a web page. Is there a plugin, e.g. MathJax (www.mathjax.org), or a similar tool available?
Thanks,
Marian

Sep 08, 2018 11:17

Hi Marian

Althought this forum doesn't allow HTML code my b2evo site does so I can type expressions via the character codes, but sure it would be good to have a plugin that would allow a simple click like a virtual keyboard.

How many expressions to you anticipate would suffice, lets say for a simple version?

Sep 08, 2018 11:59

The reason I ask how many expressions as it is relatively easy to modify an existing plugin to add a few terms

As examples
I modified a plugin to add a target attribute to the links tab and added various extra buttons for styling for example http://rogerlovejoy.net/blog/b2evo.php/my-tags-plugin.
So it is possible to add buttons for any character to be inserted and if you want a big set then yes a new plugin would be convenient.
Apart from being busy and not in urgent need for such it sounds like a nice little script to make, but hey! maybe there is one or you or someone would like to make it sooner than later.

Can you hack an exisitng plugin as I've shown, as if so it's worth a try on your own :)

You could try and modify one of the existing plugins as I have shown and just add a &plusmn, µ to get the process working then you can add whatever you like :}

Sep 08, 2018 13:54

As a further example I have modified a plugin as explained above.
I added a line to [plugins/mytags_plugin/_mytags.plugin.php]

Go to my site http://rogerlovejoy.net/blog/b2evo.php/math-terms to see efforts so far

The image below shows how it looks in the post creation/editing mode. You can see the button just above the [Teaserbreak][/s]
See #8 below

 MoreButtons[MoreButtons.length] = new AnotherButton( 'math_1','&plusmn;','maths','<span class="math1">&plusmn;</span>'
		);

I'm not saying this is a definitive way of doing it, but it works until a more sophisticated way in made, as can add exactly the terms you want to use as your own specific plugin.
EDIT
Added micro button
If you are really not up to doing it yourself, maybe let me know exactly what terms you want and I will find time to do it for a laugh.

Sep 08, 2018 14:26

Ok you've got me going. I'm going to make a new plugin for my own limited use.
The questions arising now are

  1. Whether to have a class for each term so that the font can be formatted or leave that to just default adjustments by html tags (big,small, bold, em) etc.
  2. If to have it functional so that calculations can be made live, a bit dodgey maybe as someone may find a way of entering a malicious function.

Sep 08, 2018 15:23

Just to confirm I have modified a plugin just for math expressions/terms call [_mymathterms] so will make it available to you soon.
It will be simple but you will be able to add any expression you want. Initially this will mean adding code which is very simple, maybe later a user will be able to add via the back-office.
Out on the town tonight as it's Sat eve soon in the UK so won't get much done in the next few hours or days maybe.

This won't be an 'official' plugin for now as I'm adapting an existing one given I'm not sure of the process from start. However once you and I are happy with it we can make it public proper.

Sep 08, 2018 17:51

amoun,

This is awesome. I am out of town, too, but will read through your posts once again over the weekend. I am not a developer, so I am not sure whether I have understood everything, let alone whether I can do it, but I thank you very much for your support.
I will come back to this forum next week.

Thanks again a nice weekend to all,
Marian

Sep 08, 2018 20:47

No problem
The Unicodes are at
https://en.wikipedia.org/wiki/Mathematical_operators_and_symbols_in_Unicode and
https://www.compart.com/en/unicode/category/Sm
Typical use is [&#x2211;] for the Capital Sigma

With a dozen or so it's easy to hard code as I have done, but if you want (any and all - hundreds) then an input box could be used and you could type in the Unicode from one of the lists above. But note that you can just type in the code in any post that doesn't block Unicode inserts.

As mentioned &#x2211; resolves as the Big Sigma on my sites

If you want to format each symbol it would need another box to enter css properties. So not knowing the details I'm going to stop adding symbols to my first effort as shown on my site

My working example is now at http://rogerlovejoy.net/blog/b2evo.php/math-terms

This post has 3 feedbacks awaiting moderation...


Form is loading...

blog software – This forum is powered by b2evolution CMS, a complete engine for your website.