### Author Topic: Incorporating maths expressions (LaTeX notation) to SMF 2.x  (Read 4997 times)

#### Ian Wild

• Semi-Newbie
• Posts: 20
• Gender:
##### Incorporating maths expressions (LaTeX notation) to SMF 2.x
« on: June 16, 2018, 01:58:42 PM »
Hi all,

It's been a while since I was last on here (over 10 years ) but I'm back with more work on incorporating math notation editors into SMF - in this case SMF 2.0.15 and fMath.

Just for a bit of background, DragMath has "kind of" been abandoned - Chris Sangwin [nofollow], who is responsible for the STACK project (of which DragMath is a part) isn't progressing development of DragMath at the moment so I've been focusing on fMath [nofollow] as an alternative. At the moment this works in conjunction with the MathJax mod.

I have put together a new package mod for SMF 2.0.15, which is currently available from http://luminaconsultancy.com/wp-content/uploads/2018/06/SMF-fMath-0.0.1.zip [nofollow]

The project itself is fully available on GitHub at https://github.com/iandavidwild/SMF2.0-fmath-mod [nofollow]

... I now know how to build a new package - see my comments from 2007 at http://www.simplemachines.org/community/index.php?topic=192052.0

I would be grateful to know what you all think.

Thanks,

Ian.
« Last Edit: June 16, 2018, 02:17:08 PM by Ian Wild »

#### GigaWatt

• The Smiley Guy
• SMF Friend
• SMF Hero
• Posts: 2,187
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #1 on: June 16, 2018, 02:24:44 PM »
I think it's great somebody actually did some development in this field, scientific mods .

I run an electronics forum, so I don't really need a whole equation editor (maybe in some rare cases, but this is in 2 or 3 posts a year, when some of the members start discussing some theoretical stuff in the audio section ... audiophiles, go figure ), but what I actually needed was a modification of this mod, except I needed it to use Greek letters like Ω, μ, ω, Σ, δ, π, τ, φ, ect. I started doing some of the work, but it's not finished yet. I'll make it public when it is .

Although, I have to add that the mod is a little large (unpacked 180MB, or so)... the fonts it uses take up a large portion of that. Can't this be cut down to, one or two fonts?
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

#### d3vcho

• Sempiterno
• On Hiatus
• SMF Hero
• Posts: 4,491
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #2 on: June 16, 2018, 02:57:24 PM »
I know about a Spanish mathematics SMF forum that is still running 1.1.x because they are using a LaTeX mod for that version, and couldn't find a way to convert to 2.0.x. I think that this will be an interesting choice for them to finally decide to convert to 2.0.x.

Thanks for your work, and welcome back

"Greeting Death as an old friend, they departed this life as equals."

#### Ian Wild

• Semi-Newbie
• Posts: 20
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #3 on: June 17, 2018, 04:35:01 AM »
Hi GigaWatt and thanks for your message.

I run an electronics forum, so I don't really need a whole equation editor (maybe in some rare cases, but this is in 2 or 3 posts a year, when some of the members start discussing some theoretical stuff in the audio section ... audiophiles, go figure ), but what I actually needed was a modification of this mod, except I needed it to use Greek letters like Ω, μ, ω, Σ, δ, π, τ, φ, ect. I started doing some of the work, but it's not finished yet. I'll make it public when it is .
Have you taken a look at MathQuill [nofollow]? I have a semi-working mod that will add this to a forum. This should be with us soon and I'll make this one public too. I'm thinking that MathQuill would be a great way for my students to learn LaTeX.
Although, I have to add that the mod is a little large (unpacked 180MB, or so)... the fonts it uses take up a large portion of that. Can't this be cut down to, one or two fonts?
Sadly yes your're right the fMath editor itself is very powerful (coming with different themes and so on). I've been trying to reach out to the author of fMath but so far haven't had a response - I don't want this plugin to be based on a dead project

Thanks again,

Ian.

#### GigaWatt

• The Smiley Guy
• SMF Friend
• SMF Hero
• Posts: 2,187
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #4 on: June 17, 2018, 06:02:07 PM »
No, actually I only searched the SMF mods site. The mod in the link I provided is really close to what I need... with the exception that I have to rework it .

I took a look at what MathQuill is and no, it doesn't actually suit my needs. You can write equations with it it can solve equations (useful, but not too useful on my forum), but you can't set custom symbols (Greek letters in particular) with it. See, I only need to be able to write "the resistance of the resistor is 2.2KΩ" without having to do a copy/paste of the symbol Ω (as I did now). That's why the mod I pasted the link to is exactly what I need... at least in form, I still have to edit the symbols :S. Basically, all I need is a simple symbol insertion tool .

I hope you do reach the fMath author because it does seem like a powerfull editor. As I wrote, I don't need this kind of equation edition power ATM, but if you think I can help in any way (code edits, testing, I'll have a test forum up and running in no time ), I'll be glad to help . My forum is mostly populated by pro/semi pro users in the field of electronics and nobody is actually that much into math (unfortunately ), but once (upon a time ) I was thinking about opening a local forum about math problems, but this was a long time ago and I kind of gave up on the idea since I had to do a lot of things manually (customizations), but if there's a mod that can automate the process, integrate an equation editor inside the regular text editor, this might be incentive enough for me to go back and resurrect my old math forum idea .
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

#### Biology Forums

• SMF Hero
• Posts: 3,779
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #5 on: June 18, 2018, 01:14:54 PM »
Would love to see this in action, any demos?

#### Kindred

• The Mean One
• Support Specialist
• SMF Legend
• Posts: 59,656
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #6 on: June 18, 2018, 01:20:47 PM »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

#### Biology Forums

• SMF Hero
• Posts: 3,779
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #7 on: June 18, 2018, 01:22:10 PM »
@ Kindred, the first one doesn't support https. While link 2 and 3 are pretty much identical. I was hoping this mod would include an editor

#### Ian Wild

• Semi-Newbie
• Posts: 20
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #8 on: June 18, 2018, 01:56:10 PM »
Hi all,

I've just been putting together a fresh install of SMF for the 'YourMathsTutor' forum at https://forum.yourmathstutor.info [nofollow]. Please do feel free to sign up if you wanted to check out the plugin in action (the fMath button has a 'pi and pencil' graphic on it).

While putting this together I noticed that there were some case sensitivity issues in the package I uploaded previously (the YourMathsTutor forum is deployed on Linux but I built it on Windows - I know: my bad ) so I have put together a new package here:

https://luminaconsultancy.com/?attachment_id=178 [nofollow]

Thanks

#### GigaWatt

• The Smiley Guy
• SMF Friend
• SMF Hero
• Posts: 2,187
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #9 on: June 19, 2018, 12:26:43 AM »
I was hoping this mod would include an editor

Exactly the problem I ran into when I had the math forum idea... nobody likes to write codes without seeing what the end result would be. In this particular case, a WYSIWYG editor is really needed.

How do you use it? It tried using it on your forum, but when I click the Pi button, BBCode doesn't appear (a bug ).

And, as Study Force asked, does the fMath mod include an editor with a realtime preview? Or is the Preview button the only way to get a preview .
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

#### Biology Forums

• SMF Hero
• Posts: 3,779
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #10 on: June 19, 2018, 12:35:52 AM »
I was using a Xenforo forum and they had this incredible math editor. I would surely pay for an add-on like that

#### Ian Wild

• Semi-Newbie
• Posts: 20
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #11 on: June 19, 2018, 10:25:44 AM »
Thanks GigaWatt for checking out my forum The way I have it set up is to have the fMath editor generate the LaTeX and use the MathJax filter to typeset it. That's partly because here in the UK that's how students will be expected to generate math notation. I've just tested it again and it seems to work okay, although the site is a bit of a work in progress so it wouldn't surprise me if there was an issue.

Study Force: do you know which math editor they had incorporated in the Xenforo forum you were using?

#### GigaWatt

• The Smiley Guy
• SMF Friend
• SMF Hero
• Posts: 2,187
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #12 on: June 19, 2018, 05:27:00 PM »
Not related to this thread, but I'd advise you to use this guide on how to set up some of the registration questions. Not everybody knows that Marry had a little lamb .

The way I have it set up is to have the fMath editor generate the LaTeX and use the MathJax filter to typeset it.

You should have mentioned that a popup appears . I have an outdated popup blocker that's not really detecting popups as it's supposed to, so had to switch to IE, which also didn't work and finally switch to Chrome, which opened the popup .

In any case, the editor itself is pretty impressive .

Although, it would be even nicer if a new editor popped up under the regular text editor, in the same window (I guess I'm asking for too much ). Now that would be really cool .

And it's not working for derivatives (differentials), since I tried to input the code for the equation in the pics above and it just kept returning this error.

Code: [Select]
Undefined control sequence \DifferentialDx
This is the LaTeX code.

Code: [Select]
$y = \int_{- 1}^1 e^x \DifferentialDx$
But, seems to work with this code.

Code: [Select]
$y = \int_{- 1}^1 e^x\;\mathrm{d}x$

Seems that the generated LaTeX code is not correct .
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

#### Biology Forums

• SMF Hero
• Posts: 3,779
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #13 on: June 19, 2018, 11:20:07 PM »
Mary had a little lamb isn't a good question...

I've downloaded the math editor, it's good but not great. For example, it isn't intuitive, like when you write '^', it doesn't understand that it's a superscript.

Regardless, it's a lot better than what I'm using at the moment.

Thank you

#### GigaWatt

• The Smiley Guy
• SMF Friend
• SMF Hero
• Posts: 2,187
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #14 on: June 19, 2018, 11:30:45 PM »
Mary had a little lamb isn't a good question...

It's not that it's not a good question... well, now that I think about it, you're probably right, it's not a really good question .

I was thinking more in the terms of... well, most of native English speakers will probably be able to answer that question, but not non-native English speakers. Not everybody went to sleep with "Marry had a little lamb" while they were kids.

All of the questions are sort of like that. Native English speakers will know the answers, but most non-native English speakers probably won't... or would have to Google the answer.

I've downloaded the math editor, it's good but not great. For example, it isn't intuitive, like when you write '^', it doesn't understand that it's a superscript.

Yeah, I also noticed this. It looks like it doesn't respond well to direct input in the LaTeX translation. The trick is to reload the page... at least that's what worked for me.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

#### Biology Forums

• SMF Hero
• Posts: 3,779
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #15 on: June 19, 2018, 11:39:21 PM »

In terms of the mod, I feel like it's dated and not fluid. That's my main issue with it, though it is highly functional. Given our options, it's the best one out there. Mine's a lot more basic but way more fluid.

#### GigaWatt

• The Smiley Guy
• SMF Friend
• SMF Hero
• Posts: 2,187
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #16 on: June 20, 2018, 12:37:40 AM »
In terms of the mod, I feel like it's dated and not fluid.

Agreed.

That's my main issue with it, though it is highly functional.

=||=

Given our options, it's the best one out there.

Yes, it's the best I've seen too... though I've seen only two other, which were better, not as functional, but as you said, more fluid. They were on proprietary scripts though.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

#### Biology Forums

• SMF Hero
• Posts: 3,779
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #17 on: June 20, 2018, 12:41:44 AM »
Do you still recall the websites that used them?

#### GigaWatt

• The Smiley Guy
• SMF Friend
• SMF Hero
• Posts: 2,187
• Gender:
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #18 on: June 20, 2018, 01:00:35 AM »

The other one was an IEEE site or a subdomain... can't really remember... I was doing some research on 3G networks, once again, in my student days , and I ran into this site that I THINK was either a redirect from an IEEE site or a subdomain... can't really recall. In any case, there were some equations on probability theory and statistics and you could edit them, but the changes had to be approved by an admin, so... I just kind of messed around with the editor . Really powerful... not as this one, but really responsive and, like you said, fluid.

The one we had on the university site was a bit more powerful than yours. It had more options, like differentials and integrals, but nothing as complex as the one in this thread... I mean, come on, three dimensional curve integrals ... I've only seen that in magnetism and math theory books, nowhere else .
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

#### Biology Forums

• SMF Hero
• Posts: 3,779
##### Re: Incorporating maths expressions (LaTeX notation) to SMF 2.x
« Reply #19 on: June 20, 2018, 01:12:52 AM »
I got the impression you found them on an SMF forum, that's why I requested the link. I've used Desire 2 Learn before, which is a platform used by most colleges, and their editor is great. I dug into the code and found that they lease a software. Like you said, a paid proprietary solution. I'll install this one on a test website, and I'll try to cut out as much as I can, like the double and triple integrals lol I'm certain it's possible