Mathematics tools

Chemistry editor Atto plugin

 
Picture of Geoffrey Rowland
Chemistry editor Atto plugin
Plugin developers

Hi folks

I have adapted the Atto Equation editor plugin to work with the chemistry TeX syntax of the mhchem extension in MathJax. Simply wraps chemical equations with \ce{....} inside the usual TeX delimiters. This follows on from an earlier prototype based on the MathSlate plugin of Daniel Thies.

You will need to add mhchem to the MathJax configuration and enable the MathJax filter.

Edit Administration > Site administration > Plugins > Filters > MathJax > MathJax configuration to, for example, include:

TeX: { extensions: ["mhchem.js","color.js","AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] },

It may also be possible to add mhchem to the server-side TeX Filter configuration, though I have not tried this.

The mhchem syntax is fairly intuitive, even for direct text entry. So, the Chemistry editor may act as a useful aid memoir. There are tabs for Formulae (full and ionic equations, isotopes etc), Symbols and units, Bonds and arrows (including equilibria), Greek, Italics and a Periodic table for elements H-Cn together with the lanthanoids and actinoids.

Currently, it may be downloaded from GitHub

https://github.com/geoffrowland/moodle-editor_atto-chemistry

though has also been submitted for approval to the Moodle plugins database.

See the enclosed README file for installation instructions.

Enjoy!

Geoff

 
Average of ratings: Useful (1)
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

...and here are a couple of screenshots

Chemistry editor showing periodic tableChemistry editor showing formula

I have also added detail om mhchem TeX syntax to Moodle Docs:

https://docs.moodle.org/27/en/Chemistry_notation_using_mhchem


 
Average of ratings: Useful (4)
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Hi Geoffrey,

For the benefit of a lot of people who could use this tool, including myself, and who have no idea how to actually install it so it does not throw up an error, like "validation failed" just how do we install it?  (For myself, I don't move away from standard installs anymore, not since v2.0 was released, too much chance of breaking something, unfortunately.) I hope this will actually become part of Core, make some things a lot easier.  

Thank you


 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Colin, it is unpacked in lib/editor/atto/plugins/chemistry and then it installed fine for me. Only after the install you have to make sure that 'chemistry' is added in the Atto settings button list  and a filter is enabled or you get not button to press. 

I did have a problem with the icon loading on the toolbar, but otherwise the plugin looks useful.  The periodic layout seems intuitive.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Colin

This was released in a bit of a rush. So, apologies if installation instructions were not clear.

As Daniel indicates, it is a pretty standard moodle installation involving unpacking the folder, renamed as chemistry, into lib/editor/atto/plugins/ of your Moodle (i.e. alongside the equation folder).

However, the devil is in the detail. So you also need to:


1. Enable the MathJax filter and add the mhchem extension to the MathJax configuration:

Edit Administration > Site administration > Plugins > Filters > MathJax > MathJax configuration to include:

TeX: { extensions: ["mhchem.js","color.js","AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] },

Here, I have also added the color extension to allow coloured TeX.


2. Add a chemistry button to the Atto equation editor:

Edit Administration > Site administration > Plugins > Text editors > Atto HTML editor > Atto toolbar settings > Toolbar config, to give, for example:

insert = chemistry, equation, charmap, table, clear


3. Add the chemistry (flask) icon to the button:

Copy flask.png and flask.svg from chemistry/pix/e/ to the pix/e/ folder of your Moodle installation.


Hope that helps. As the Chemistry plugin is heavily based on Damyon's Equation plugin code (Daniel has also been a 'victim' of my 'plagiarism wink), there should no barrier to getting it into Moodle core, assuming there is enough interest.

As a start, folks can vote for MDL-44737 to get mhchem included in the Moodle default MathJax configuration.

Cheers

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Apart from a couple of hiccoughs, looks like it works well when editing formula... but what is this? BTW, I am using TeXLive 2014 so i am wondering if that is interfering...

dunno what is happening here....

and 

dunno


 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Your TeX filter seems to be falling back to mimetex.  This is probably because you need to add the mhchem package to the LaTeX preamble in the TeX filter settings.  Add the line \usepackage{mhchem} after the other packages. If it does not work run, texdebug on an expression like \ce{Fe} to check whether mhchem is loaded on your system. I think Geoff has these instructions on the TeX filter docs page.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

As Daniel suggests, adding the mhchem package to the LaTeX preamble in the TeX filter sequence may help. Either:

 \usepackage{mhchem}

or

 \usepackage[arrows-pgf-filled]{mhchem}

for neater filled arrowheads for reaction arrows

Of course, you will need to have already installed mhchem on your server. On CentOS linux, I used: 

 yum install texlive-mhchem

That said, I find the rendering of TexLive to be bigger and uglier to that of MathJax. So, the alignment of the Periodic table under the H-Cn tab may not be right, without further tweaking of , say, CSS settings.

So, I would recommend turning off the TeX (TexLive) filter and using the MathJax filter instead.

Even with MathJax, you may also need to update your MathJax configuration to use the new MathJax CDN address:

 http://cdn.mathjax.org/mathjax/latest/MathJax.js

or

 https://cdn.mathjax.org/mathjax/latest/MathJax.js

or the protocol-neutral

 //cdn.mathjax.org/mathjax/latest/MathJax.js

Hope that helps

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers
mmm don't think so...after making the changes the UI did not appear any different. I emptied the cache and so on, but still no change.   Running texdebug is not going to show what is going wrong as the error is not in the tex code but in the expression builder. 

For simple things : 

photosynthesis formula

The code for the net equation is: 

 \( \small 6CO_2 + 6H_2O +\) sunlight \( \small -> C_6H_{12}O_6 + 6O_2. \)

Which renders correctly in this forum too, considerably better than it does in my Moodle. 

 \( \small 6CO_2 + 6H_2O +\) sunlight \( \small -> C_6H_{12}O_6 + 6O_2. \)

You can see the entire equation is rendered appropriately and the expressions are rendered in sentences correctly... so it is not the rendering that is wrong.  

 When I installed the filter properly it worked first time, there were no errors, so the instructions given were correct, and I actually did add the mhchem package to the TeX filter settings. I have been using TeXLive to write PDF pages for this sort of chem, trigonometry, algebra and so on, simply because the tex rendering in Moodle is not that good - but it is a pain having to edit pages when an error is discovered or I want to change an example and so on. I really want to edit tex and chemtex in Moodle, but... 

In the meantime, while there are some issues, the basic technology seems sound and has my vote for inclusion into core - and it will only get better, I am sure.... Well done guys, really appreciate the effort you have made and your help so far.

The only other thing I have not tried has been to drop the TeXLive and just use MathJax... so that would be my next port of call. Thanks for the tip Geoff...  Unfortunately I am not a big fan of expression builders, they seem clunky to me.. so perhaps I had just better get over myself and get on with it...sad 

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

With mhchem enabled, via either MathJax (recommended) or TexLive, you should be able to write the photsynthesis equation with

\(\ce{ 6CO2 + 6H2O + sunlight -> C6H12O6 + 6O2 }\)

which apart from the \(\ce{ ... }\) is pretty intuitive, even without the chemistry editor. In many cases, mchem deals with the chemical subscript (or superscript) logic without explicitly forcing, say, 6CO_2. The chemistry editor may be more helpful for more complex constructs, ionic equations isotopes and the like.

Note (from the screenshot below) that with mhchem the element symbols are rendered upright, rather than the italics displayed in TeX mathematics mode (compare with screenshots in previous posting). Chemists prefer this wink

For photsynthesis, you could also use:

\(\ce{ 6CO2 + 6H2O ->[sunlight] C6H12O6 + 6O2 }\);

or
\(\ce{ 6CO2(g) + 6H2O(l) -> C6H12O6(s) + 6O2(g) \Delta{$H$}^{⦵}_{r} = +2803 kJ mol^{-1}}\)

Screenshot of the above three equations using the MathJax filter with mhchem configured.

photosynthesis reaction


 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

...and you could always use \mathrm{...} to force upright, roman letters with standard MathJax/TexLive, even without mhchem

\( \mathrm{6CO_2 + 6H_2O + sunlight \rightarrow C_6H_{12}O_6 + 6O_2} \) 

 

works in this forum

 \( \mathrm{6CO_2 + 6H_2O + sunlight \rightarrow C_6H_{12}O_6 + 6O_2} \)

But, it is still fiddly and gets even more cumbersome for more complex constructs.

So, please vote for MDL-44737 to include mhchem/MathJax by default and make Moodle 2.8 a little more science-friendly 'out-of-the-box' smile

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

I did find that I had some problems with using mhchem and the TeX filter with the plugin.  MathJax appears to be much more forgiving with mhchem syntax or perhaps it has a different version than I used.  One issue though is the degree symbol is in unicode instead of using \circ.  TeX binaries don't like those type characters although MathJax can interpret some. It also chokes on $ because that is the delimiter used internally by the filter.

I also do not like making minor changes to the equation editor which involve mainly changing a few hardwired parameters. Bug fixes and improvements to the equation editor will be difficult keep updated.  A better solution would be to make the equation editor more flexible so that different configurations could be loaded using the same javascript.

Picture of missing symbols

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Yes, I have noticed similar problems with TeXLive, though wasn't sure whether this just reflected my own inexperience in TeX setup. If using TexLive remains problematic, I'll firm up warnings about it in the documentation.

Hence, I have mainly focused on MathJax which, as you say, does seem more forgiving. On my setups MathJax also performs and renders better.

I did ponder on whether to use \circ or the unicode degree symbol. Settled on the latter since it

seemed simpler and worked with MathJax. That said, it is relatively easy for folks to configure for their own needs.

It does all have a rather cobbled-together feel. But I think that is the nature-of-the-beast. mhchem syntax is a somewhat cobbled together but very pragmatic solution to representing chemical equations.

The mhchem chemistry editor functions could just be added to the 'standard' equation editor. But I didn't want too many tabs or to wrap every individual symbol with \ce{...}. Also, Maths and Chemistry have different stylistic conventions (italic v uppercase) so it seemed reasonable to keep the functionality separate. It also gave more opportunity to experiment with features that *may* have pedagogic value such as the periodic table layout of Element buttons.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

... and this is what the Symbols and units tabs should look like. Using mhchem (Moodle 2.7.2 with Essential theme)

Symbols and units

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

And this is what mine looks like after disabling the TeX filter altogether...

symbols and units... 

and the periodic table....

periodic table 

A big improvement I am sure you can see, but then...

Italic buttons.... 

and my first thought is this is a great tool,and I am not second guessing anything here. it is a great tool and can be very useful to anyone developing anything to do with chemistry.  So far, it is not working properly for me, but I am trialling this on a v2.7.1,,, so it will improve. It is accepting mhchem, the same as yours... but I am somewhat dubious as to why it is displaying the $ delimeters on some buttons but not others andfew on the periodic table window, TeX Notation has been disabled, the cache emptied, the browser restarted, and it is still not displaying properly ....hmmmmm.  



 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hmmm...

Thanks Colin, I suspect that's very useful wink I just don't fully understand at the moment. sad I'll have a good look over the weekend to try to fix this for MathJax mhchem (without TeX filter). The $ are clearly breaking things for you, but not me and the periodic table element symbols should be upright, not italic. 


Just a thought (I don't have a configurable Moodle immediately to hand, to experiment). Do you have the Algebra Filter on? (I certainly don't).

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Hi Geoffrey, 

No Algebra filter... have not run that for.ooh - long - long time... Turned off the slash argument as well, no difference... but for simple formula it works, using the Chem editor, but I can still get something useful by adding the TeX, which was unexpected. However, this is what I get if I am using the Symbols and Units 

Symbols and Units....

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: Chemistry editor Atto plugin
 

Colin,

I have not tested this plugin yet (not at home now) but some ideas: Have you tried to purge all caches from administration menu? Do you have both Additional HTML MathJax script tags & mathjaxrenderer filter on in moodle 2.7. (or is it 2.7)? Order of filters in filter administration? Other plugins / Daniel's mathslate?

To my eye it looks like there might be some "confusion" between single dollars and double dollars or other delimiters (parenthesis?)

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

The $'s seem to be a significant issue with mhchem and the TeX filter.  MathJax does not seem to mind them (at least if they are not cofigured as inline delimeters, but tex binaries always consider $ a delimeter. 

I think it is a little strange that mhchem uses them, but then I am not a chemist. However, from what I can determine, the mhchem syntax works with my texlive binary with $ as long as the $'s are not enclosed in {}'s.  The plugin might be fixed by removing the extra {}'s in the button configuration. They seem redundant anyway. 

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Thanks to all who have given feedback on the Chemistry editor Atto plugin. This has helped me to update it to work with the MoodleTeX filter as well as the MathJax loader filter, at least in my hands.

I'm using the following TeX notation settings

Latex renderer settings:

\usepackage[latin1]{inputenc}
\usepackage{amsmath}\usepackage{amsfonts}
\usepackage[version=3,arrows=pgf]{mhchem}
\RequirePackage{amsmath,amssymb,latexsym}

With default settings for latex, dvips, convert and mimetex binaries, PNG convert output format and 120 resolution.

I have removed the problematic unicode symbols for degree and standard state ('plimsoll mark' or 'london underground sign') and replaced these with superscripted \circ and \ominus. Also, replaced \omicron (which is not supported in all TeX versions) with italic o. Have placed the problematic $ symbols (which allow italic characters in chemistry mode) outside curly brackets as this works better for TeX I have tweaked styles.css so that the element symbol buttons are aligned in a periodic table layout for both TeX and MathJax (Chrome, Firefox and Opera tested). However, I doubt I have fixed this for all filter-browser combinations. It is no longer necessary to move the flask icon image files to core. This new version is available as release candidate 2 from GitHub: https://github.com/geoffrowland/moodle-editor_atto-chemistry or the Moodle Plugins directory: https://moodle.org/plugins/view.php?plugin=atto_chemistry If this works for folks, I'll release it as a stable version.
 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Oops! got timed out editing the last part of the above post. Here it is again:

I have removed the problematic unicode symbols for degree and standard state ('plimsoll mark' or 'london underground sign') and replaced these with superscripted \circ and \ominus. 

Also, replaced \omicron (which is not supported in all TeX versions) with italic o. 

Have placed the problematic $ symbols (which allow italic characters in chemistry mode) outside curly brackets as this works better for TeX. 

I have tweaked styles.css so that the element symbol buttons are aligned in a periodic table layout for both TeX and MathJax (Chrome, Firefox and Opera tested). However, I doubt I have fixed this for all filter-browser combinations. 

It is no longer necessary to move the flask icon image files to core. 

This new version is available as release candidate 2 from GitHub: 

https://github.com/geoffrowland/moodle-editor_atto-chemistry

or the Moodle Plugins directory:

https://moodle.org/plugins/view.php?plugin=atto_chemistry

If this works for folks, I'll release it as a stable version.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

...and here are comparative screenshots of the Chemistry editor toolbar using either TeX or MathJax filters

TeX filter

MathJax filter

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

I just updated the mhchem editor... and found something missing...

And something is missing.....

It's never easy...
Oh, the toolbar is present for the description dialogue...


 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

OK, I give up, after searching forums and being unsuccessful, after looking at the code to see if there was anything amiss, I moved the chemistry plugin to another part of the computer and reload to update the plugin database, 

it's back

Go to the course and it is back again.... move the plugin back, update the database, and it disappears. 

Sorry to be such a pain Geoff, but I am just not that good, I am missing something.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Colin et al.

Apologies, that was probably my fault. I appear to have broken the editor with my recent updates. One of the issues was that I hadn't sorted the icon path after all. 

Should now be fixed in latest release candidate, though you still have to copy the flask icons to the core /pix/e/ folder of your Moodle.

Best to uninstall the the previous version of the Chemistry editor from Administration > Site Adminstration > Plugins > Text editors > Atto HTML editor > Atto toolbar settings > Atto plugins

Then immediately delete the \chemistry folder from \lib\editor\atto\plugins of your Moodle (if your Moodle has not done this automatically). That should clear the old configuration. Then reinstall.

Now works for me with either MathJax or TeX filters. Was a pain getting theTeX-filter to work on a CentOS 6 server as the Yum packaged TexLive did not include mchem. So, had to install binaries. I'm getting the best display using PNG conversion though still more sluggish, and less pretty, than MathJax.

Again, thanks for the feedback, it has been invaluable.

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters
Geoff, the TeX version looks really great on my end.  The initial sluggishness as images are generated should not be a problem since they are cached.  It may also depend on your internet connection to the server.  I am really impressed with how funcitonal it looks (although again I am not a chemist).  Maybe it will inspire some of us to come up with an better configuration for the mathmatics editor.
 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Thanks Geoff, will get to it asap.... but not tonight. Might be a few days, but will get back to you. Thanks for th ehelp, it is appreciated, and the fact that it looks good, all I am doing now is to champ at the bit until my employer's host service picks up v2.7.1 

,... might have a talk to the ICT guys and get a local installation of it....mmmmmmm probably go down like a lead balloon but if you never ask, you never know.


 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Nah, Geoff... couldn't wait and perfecto mundo... works like a charm now...

Thanks for your patience and it looks really good and you,  Daniel and Muano are all correct about the PNG producing a better image... 

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: Chemistry editor Atto plugin
 

Colin,

partly off-topic but I really have not changed my name to Muano - Mauno is actually a rare Finnish variant of Magnus

(more "official version" http://en.wiktionary.org/wiki/magnus) clown

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Mauno, you do know I am Australian, so everything from here is upside down..smile Can't help it, sorry... 

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Colin, don't become too attached to PNG.  In Moodle 2.8 you will want to switch to SVG. It looks even nicer.

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Daniel, I have only just gotten used to the horseless carriage - and we gotta change again??? 

Be good idea to take advantage of the universal nature of svg. Vector graphics will be a lot better in any scale. so that removes any issue around how poor the gif rendering is...


 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Glad the Chemistry editor Atto plugin seems to now be working for folks using either MathJax or Tex filters. If there are no more issues in the meantime, I'll reclassify the current release candidate as a stable release. Also get the toolbar icon working 'out of the box'. Probably at the weekend, when I'm free of teaching demands.

If you find any other issues or have feature requests, please post them in this forum or as issues, pull requests etc on GitHub.

Will be great to get SVG rendering of TeX in Moodle 2.8. Daniel, would it be viable to backport this to Moodle 2.7?

I did try to get UTF8 support into my TeX filters so as to support the degree (°) and standard state (, plimsoll mark, London underground sign) symbols. UTF8 is supported by MathJax and we moved from latin1_swedish_ci to utf8_unicode_ci collation for the Moodle MySQL database many, many Moodle versions ago.

However, had no obvious difference using a LaTeX configuration of \usepackage[utf8]{inputenc} rather than \usepackage[latin1]{inputenc}. Similarly, had no joy with \usepackage{gensymb} for \degree or \celsius. I may be missing some configuration details (the order of \usepackage{ } statements?) or some other dependencies. So, have kept superscript \circ for degree and superscript \ominus for standard state.

I did get \usepackage{txgreeks} to support \omicron, \Alpha and \Beta etc though it seemed simpler (if semantically less correct) to just use o, A and B.

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

As a matter of policy, there should not be a backport of SVG. It is a significant new feature that would cause a lot of confusion.  That said if you really wanted to run it under 2.7, you could try copying the directory filter/tex in 2.7 with the one from the master branch and change version.php if you need to.  This should work, but I think that there were some API changes in 2.7 that will prevent this from working in 2.6. Colin's carriage already has the trottle wide open anyway. 

It would be a great help if some of you could test it before 2.8 gets near and could help with the docs.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Daniel

I took due note of your warning about backporting. Then had go anyway, following your instructions to drop filter/text from 2.8dev into 2.7.2. After spending the past few weeks breaking and fixing things, then breaking them again, it was a real pleasure to have something just work, first time!

Although I have not done any rigorous benchmarking, the initial SVG display appeared at least as fast and at least as good quality as the PNG. After the initial loading, the display of the cached SVG images was virtually instantaneous.

So, by having both the TeX and MathJax filters on, the Editor toolbar is instantaneously populated with SVG icons which are then progressively replaced by higher resolution MathJax icons. So, any delay in display of MathJax is much less obvious. Neat!

Pleased to see that even the periodic table button layout worked with TeX SVG display. Not quite sure if that amounts to a test of TeX SVG or the Chemistry editor. Either way, passed with flying colours smile

One other question, Daniel. Do you have any plans to merge any of the nice 'place-holder' and 'drag-n-drop' features of MathSlate into the Moodle core Atto equation editor? This could replace and extend the functionality of the 'old' DragMath applet, but without the Java security warnings. Would be nice to have these features in the Chemistry editor too. 

If I have time, I will try to revisit the core Atto equation editor to better organise the buttons into tabs. Basic maths and algebra under the leftmost tab, then logarithms and trigonometry, then more advanced concepts, boolean algebra, calculus, matrices etc to the right. Would be good to get a better default configuration into Moodle 2.8.

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Well, sorry but it didn't for me..


Debug info: Missing version value in version.php 
Error code: detectedbrokenplugin
Stack trace:
  • line 455 of \lib\upgradelib.php: plugin_defective_exception thrown
  • line 1615 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 434 of \admin\index.php: call to upgrade_noncore()

More than likely, I have made a mess of the download, never having pulled anything from the GITHUB before. Downloading the files individually and replacing the current files is not the way to go then. I have no tool or seen a zip of tar file that resembles a complete package so I am assuming I got all the files. 

When I look at the code of the v2.7.1 version.php I have installed then the one I downloaded from the GITHUB, they are two completely different files. The original is a version file has 30 lines, and I have no idea what the version file is in the downloaded version.php, it has 2,300 lines. duh...  

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

And something else has been going on as I have not been connecting to my home Moodle, rather it is the GitHub, and I have only just fixed it, and now I can access Moodle.org to find out what is happening. 

I got an error message telling me that Moodle.org was not accessible, try again later. The post I put up and got the error message instead has not been posted, well of course.  

Anyway, that is all sorted and back to normal, but I do not seem to be able to access the dev version that Daniel mentioned. I would surely like to test this change to svg out.  

BTW, I was accessing the current release, the "master" and not getting anything new.... 

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

For the moodle 2.8dev to 2.7 backport of SVG display of TeX. I just downloaded the zip file from: https://download.moodle.org/releases/development/ (could have used GitHub, but didn't, in this case)


Unzipped, and replaced (over writing can be problematic) the filter/tex folder of a working Moodle 2.7.2 instance (NOT our 'production' version) with the downloaded filter/tex folder.

As Daniel noted,you may need to 'tweak' the version.php file inside the filter/tex folder, specifically the value of $plugin->version, . This needs to be larger (e.g. by 1 added to the right-most digit) than the $plugin->version value of the previously installed filter.

See: https://docs.moodle.org/dev/version.php for more detail. 

This ensures that your Moodle 2.7 will recognise it as a newer version of the TeX filter, and let you install it smile

After installation, I did check (adjusting if necessary) Administration > Site administration > Plugins > Filters > TeX notation > LaTeX renderer settings to ensure that:

1. Path of dvisvgm binary was correct. dvisgm generates the SVG output. Needs to be (already) installed as, say, part of your LaTeX/TeXLive bundle.

2. Output image format is SVG

A tad fiddly, but reasonably straight-forward. Be aware that as Moodle 2.8dev code evolves, it may no longer work, may break things and 'eat all the cheese in your fridge'. If you are not comfortable with this, then just be patient and wait for the Moodle 2.8 stable release in November.wink

Good luck
 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters


Geoff,

Glad this worked for you.  I have been testing the chemistry plugin on my 2.8dev installation.  There are no real differences that I am aware of between 2.7 and 2.8dev. So it should work without modification in 2.8 when it is out. I probably should have suggested earlier using the equation editor code from MDL-45867 instead of the current 2.7 code to remove the typing bug from your plugin.

I don't really have plan to merge Mathslate features with the core editor.  I think they make more sense as different plugins because they really address different needs.  Although when I get the time I would like to put the Atto version of Mathslate into the plugin directory.  Lately I have been playing with a graphical configuration tool and thinking about how it might be used as a drag and drop question type.

Regarding fixes for 2.8 equation editor there is not much time until the freeze.


 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Thanks for the heads up for MDL-45867. I'll merge the fix into the chemistry editor code once it's passed peer review.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Have just updated the Chemistry editor, in the Plugins directory and GitHub, to release candidate 4. 

Includes bug fixes for MDL-45867, kindly provided by Daniel Thies. Should result in a more responsive Chemistry editor.

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Hi Geoff, 

Just downloaded and installed the Beta v2.8 got that running, (didn't want to play around with a working tool - I know, no guts, no glory) then the latests version of the Chem editor. Updated the database, went in and had an issue or two and no idea what was causing it, but logged out, logged back in and it worked. Still no idea, but this is a beta, so obviously I have done something that made it have bit of a hissy. 

Anyway, I reset the default to the svg, and the end result is considerably better than I have ever seen TeX or Mathjax before.  Works fine now.... really, really happy.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Kudos belongs with Daniel for the SVG display of TeX (MDL-44925) and a recent usability fix (MDL-45867).

Still, good to have really, really happy customers wink

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Finally managed to fix the icons so that there is no longer any need to copy them to the Moodle core pix folder after installation. Checkout latest version from the Plugins directory or GitHub

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

I have gone through a number of uninstall reinstall cycles on Moodle 2.7 without issue. So, have now designated the Atto Chemistry editor as a Stable release (v2.7-1) in the Moodle  Plugins directory or GitHub (271 branch).

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Reinstalled on my v2.7.1 and get this....

A button set for the chem plugin not working...

The only thing different was that I added a couple of TeX commands, and it just spit the dummy. I uninstalled it and reloaded, then installed it again and this is the result... latest download, btw. Lost it, just don't know what happened... sad

And the v2.8Moodle with chem editor is working well... which helps...smile 

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

First try removing the TeX commands you added, i.e. revert to the default configuration for the editor.


Otherwise, looks as if the TeX filter or MathJax Filter is not working or mhchem not installed/configured. 


To diagnose, try typing and saving in Atto (without using the Equation or Chemistry Editor buttons): 

\(\pi)\ or $$\pi$$ and see if it is rendered as the symbol pi (test if TeX/MathJax is working)

Then try

\(\ce{H2SO4} or $$\ce{H2SO4}$$ which should be rendered as H2SO4 (test if mhchem is installed/configured)


If these work, then we'll need to investigate the editor/editor configuration more...

I'll also recheck my end of things, in case I have broken the code (though my recent updates were essentially just an SVG icon fix)



 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Colin

I have just tested complete uninstallation and reinstallation of the Chemistry editor (latest stable version from the plugins directory) on Moodle 2.7.2+. All behaved as expected.

So, I still think your issue lies with whether Tex/MathJax and mhchem are correctly installed/configured. Remember to check Course-specific filters as well as Moodle-wide filters. My own preference is for the MathJax + mhchem alternative as it is easier to set up.

Also, if you think the TeX customisations you were trying might be of general interest, then forward details and I'll add them to the default configuration.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

...Oops! That should read.

To diagnose, try typing and saving in Atto (without using the Equation or Chemistry Editor buttons): 

\(\pi\) or $$\pi$$ and see if it is rendered as the symbol pi (test if TeX/MathJax is working)

Then try

\(\ce{H2SO4}\) or $$\ce{H2SO4}$$ which should be rendered as H2SO4 (test if mhchem is installed/configured)

If these work, then we'll need to investigate the editor/editor configuration more...

Apologies for any confusion caused by the typos



 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

This is really confusing. I have rechecked the settings and they are below...

settings for mhchem

and something else I have noticed before and didn't think too much of it, the flask icon is not appearing in either the v2.7 nor the beta2.8 in the toolbar, yet the settings are the same.... The beta2.8 has never had the TeX filter initiated, so has nothing in the string settings, so should be using the default mimetix 

There was no issue when the plugin was inserted into the database... but that has where there might be a problem. If there was something lingering from the previous install, could that cause it not to install properly? But the deletion displayed the Notifications page to update the database as the plugin was now not there. mmmmmm 

EDIT: 

Just looked in the database and this is the toolbar settings as saved...

database toobar setting in atto...

and the database entries for the mhchem filter are the same, but there is far too many to post here as images...(This came via the Adminer plugin.) So as you can see, the  toolbar settings are right, there is no duplication anywhere, so...je né compris pas!

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

..and neither the MathJax or mimetex is working now.... 


 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Colin

The configurations that you have shown look fine, though there are least a couple of other issues here. I am sure we can fix them.

1. The missing 'flask' icon is due to a corrupt icon.svg file included in a recent release candidate for the plugin. Although it gives a 'blank' button it should not affect functionality. A quick fix is just to delete icon.svg from the chemistry/pix folder. Moodle should then default to the icon.png version which looks fine unless you really zoom in with your browser. A better fix is to update to the very latest stable release of the plugin (v2.7-1) which has a working icon.svg. You *may* have to purge Moodle server and browser caches to ensure the icon is displayed.

2. The more fundamental issue is the fact that neither the TeX nor MathJax filters are working. In the first instance, I suggest you focus on MathJax as, in my experience, it is usually easier to sort.

Suggest you make both the MathJax and TeX filters 'Off but available' across your Moodle, but turn on the MathJax filter only (Not the TeX filter) in the course you are testing. Then try, after purging caches etc.

Also, check the MathJax CDN URLs are correct in Site Administration > plugins > Filters > MathJax

They should be: 

http://cdn.mathjax.org/mathjax/latest/MathJax.js

https://cdn.mathjax.org/mathjax/latest/MathJax.js

If this doesn't work, then check server firewall/proxy settings are not blocking access to the Mathjax CDN.

Good luck!

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

That is interesting, this image says something different... 

default paths...


These are the same in my v2.8 as well - different than what you have above, but it doesn't matter, the v2.7.1 is still not working but the v2.8 is, perfectly. I have gone over all the settings, the config, and nothing is different, but nothing works...  

The firewall settings are the same as they always have been and have always worked in the past, it is just this one item... 

Oh...I changed the icons, and it has made no difference, while the chem editor works there is no icon on the button... which is why i suspect I missed it before, it worked so I just did not notice....

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Colin

Go with:

http://cdn.mathjax.org/mathjax/latest/MathJax.js

https://cdn.mathjax.org/mathjax/latest/MathJax.js

if you want the very latest stable release version of MathJax (currently 2.4)

or

http://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js

https://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js

If you want to stay 'locked' to the 2.3 version of MathJax

'Pay-your-money-and-make-your-choice' wink

The MathJax 2.3 release is the 'officially' tested version for Moodle 2.7/2.8 but the MathJax 2.4 release has a number of bug fixes that *may* improve your experience.

http://docs.mathjax.org/en/latest/whats-new-2.4.html

Not sure what is going on with the SVG icon. It is working fine for me, but you are not entirely alone in having issues. Can only suggest reinstalling the very latest version from the Plugins directory, purging Moodle caches, clearing browser history etc. If problem persists, I'll investigate further at the weekend.

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Colin et al.

I should have finally fixed long-standing issues with the 'flask' icon in the Atto toolbar. Turns out that the problematic icon.svg file actually had the font awesome flask character embedded in it. So, if you had font awesome installed/available (as I did!) the flask displayed correctly. If you didn't then it... er... didn't.

Have now replaced it with a 'proper' SVG only icon file. 

So, I recommend you upgrade to the latest stable version on the Moodle plugins directory (I have hidden previous versions with the dodgy icon) or GitHub (271 branch).

Apologies for any confusion caused. By all means let me know if this fixes things (or not) for you.

 
Average of ratings: -
Picture of AL Rachels
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Geoffrey,

I just installed the Chemistry editor Atto plugin from your github 271 branch. Things went as expected. I copied the examples from a few entries above here and once I cleared the formatting that came along with the copy, the formulas rendered nicely.

However, when I go and try to enter a formula using the editor (H2SO4), there is a space added after each character when I click on one of the editor buttons. I have to manually delete the extra spaces to get the formula to render correctly. Is this the correct behavior?

Thanks for the plugin,

AL

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Al, I just tried this using the chem editor and got something unexpected..

 H_2SO_4  and H2SO4 H2SO4

Both formats rendered exactly as they should, and I would have thought that the first would have, but the second not...


@Geoff, I am going to reinstall that Moodle altogether, I have done something, obviously, causing the whole thing to just stop working. Will only take a few minutes and will just update or refresh or something... And your recommendation to move away from the 2.3 release of MathJax works properly in the vbeta2.8.. so far...smile but I haven't bothered to purge caches or anything so we shall see.

 
Average of ratings: Useful (1)
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Colin

Have no fear. If you check the full mhchem documentation, or the slightly shorter version in Moodle docs you'll see that these are both expected behavior. That's precisely why mhchem is an extension to normal TeX (mathematics) behavior. When wrapped in \ce{...} delimiters, mhchem 'knows' H2SO4 should be rendered as H2SO4 etc. 

Indeed, when you get used to the mhchem syntax, it is often simpler to just type the equation or expression. However, the Chemistry equation editor provides a useful prompt for occasionally used features, novice users etc.

 
Average of ratings: Useful (1)
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Colin

One other thing that may (or may not) be related to your display issues.

Be aware that some contexts in a Moodle course have their own, separate, Filter configurations. So, if you are using the Chemistry equation editor in, say, a Forum posting, it may be necessary to turn filters on/off appropriately  (i.e. in Administration > Forum administration > Filter settings as well in as Administration > Course administration > Filter settings)

I recently overlooked this, and encountered similar symptoms to those you reported. May be something else going on, but just in case...

 
Average of ratings: Useful (1)
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

AL

Hmmm...

It is expected behavior for the way I tend to use the editor, but I can also see why it could become cumbersome. When I get some free time, perhaps at the weekend, I'll try a few options to see if a way can be found to match most/all modes of use.

As noted in other recent postings, when using the chemistry editor, which effectively just wraps content inside \ce{...} delimiters, you can often just type expressions (without using the buttons) and they are formatted correctly. See Chemistry notation using mhchem in Moodle Docs

 
Average of ratings: Useful (1)
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

And I just updated the Moodle to the latest build and for my next trick... I am further back to where I was the first time I installed the plugin I am not getting the $ signs, but I am not getting the plugin rendering. It all looks like the image below, nothing else at all.

a rendering gone wrong...

Only this time, the plugin is not rendering code either...  (something just does not like me in this version, I am sure of it.. but I have never held out for universal popularity anyway so I really don't care...smile  )

Aghh that is a problem for the morning now.... 


 
Average of ratings: -
Picture of AL Rachels
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Colin and all,

I just upgraded one of my experimental dev sites and ran into the same problem as shown in Colin's Monday, 29 September 2014, 8:09AM and Wednesday, 1 October 2014, 9:06 AM entries. Like him, I compared to other versions where the Chemistry editor was working and everything matched perfectly.

AND, since I just KNEW I had set owner/permissions for the new chemistry folder when I uploaded it, it took me about an hour before I double checked them. blush

The upshot of it is, won't work for owner=root but works as it is supposed to for owner=Apache. wide eyes

Hope this will help others,

AL

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Colin,

Another thing that you might check is whether the HTMLTidy filter is enabled. I think this is your production machine. There is a recent report of problems with using that with the MathJaxloader MDL-47533.

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Thanks for that Al, but no, TinyMCE has been disabled. This is not a production machine it is my test bed, I wouldn't dare try anything new on my production sites. Need to know what can go wrong and how to fix it before I use it on my production sites. The Chem editor is useful only on my school site and that is hosted, so no chance of getting on until v2.8 is the standard anyway, I expect.  

And apart from  little tinkering in a few areas, I do not open and edit code much at all. So where is owner=root as opposed to owner=Apache in the code? 

 
Average of ratings: -
Picture of AL Rachels
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Colin,

The remark about root and apache has to do with my web server. The user apache is the only one on my server that has permission to access and run code in folders containing anything to do with web pages.

I don't remember seeing what you are running your test bed on, but my sites are all run on a Linux Centos 6.5 box and apache needs to be the owner/user for all the folders where I have Moodle installed.

However, I transfer files using WinSCP logged in as root, to that box and therefore, root gets assigned as owner of any files and folders involved in the transfer. Sometimes, I forget to change the ownership from root to apache after completing an install, which can result in weird behavior such as the chem editor buttons not rendering correctly.



 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Hello AL,

The chemistry plugin has inherited some behavior from the equation editor plugin. A space is entered there because all the buttons there are inserting TeX command words which are safer to insert with the trailing space.  However, I would agree it would be more expected behavior here not to have space at least with the elements.  The code would have to disguish between TeX words and plain characters because most of the buttons do have TeX commands in them.

 
Average of ratings: Useful (2)
Picture of AL Rachels
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Thanks everyone,

I thought it probably was supposed to be that way. Mostly it won't affect me as I normally just type directly into the editors because I like the "instant" render that lets me know I am building what I actually want. 

Thanks again for all of the editors,

AL

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Daniel has explained the issue well. 

Most/all of the chemistry editor button mhchem expressions have already been 'over-engineered' with parentheses etc to keep them 'isolated' from each other. So, the editor-added spaces may not be necessary. It would be nice to have more intuitive behaviour. I'll investigate further over the next few days.


 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Indeed, there do not appear to be many problems removing spaces with mhchem syntax. However, the other TeX commands used in the editor e.g. \circ, \Delta, \alpha etc often need a trailing space.

One possible fix appears to be to use {\circ}, {\Delta}, {\alpha} etc. Then you don't need the trailing space. Not exactly elegant, but since, in a chemistry context, these will generally be used much less than element symbols etc, perhaps a good option.

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Well, so far, no good. The MathJax filter is not working unless the TeX filter is on. Set it to "Off, but available", it does not work. 

What I am finding so puzzling is that the filter is working really well in the betav2.8 I have installed. 

I must have changed something in the database for it to not be working... but the only thing I have done is to take a snapshot of the atto toolbar config settings... 

So I will keep on plugging away...blush 

(that was pretty groan worthy I know.. but it has been a long night and I am just working to fill the gaps..)  

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

And i have tried everything I can think of, but neither the MathJax nor the Chem plugins are going to run without the TeX filter being turned on. If the TeX filter is Off, but available, it still does not work. The chem filter is doing this: 

the periodic table not displaying

This is the periodic table, not displaying.... I can add a formula, written in the best TeX but it does not render and the display is as it was written, not even getting the broken image graphic. But it is only in this version.... No idea!!! 

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

i think that Colin is actually intending to refer the Equation Editor plugin rather than the MathJaxloader filter.   This was used to create the chemistry editor.  He is having problems with another bug in it, and consequently also with chemistry editor. 

The equation editor renders the previews using a PHP script in ajax.php.   This is supposed to check the context and run the appropriate filters.  However, it seems to be checking the wrong context.  Instead of getting the current context of the editor, it is checking the system context of the site.  The result is that what Colin is observing is correct.  Any filter that is going to be used most be enabled on the frontpage of the site.  It can be disabled in the courses if desired. If it is set to Off, but available and later enabled in a course, none of the TeX editor plugins will work.

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Thanks Daniel, that is probably a better explanation, but I am not getting the "enabled in the frontpage of the site". I understood that all plugins were managed through the Site Administration > Manage Plugins page or Plugins > Filters > Manage Filters, with individual settings in the appropriate, linked, pages. There does not seem to be any indication that the MathJax filter is disabled, anywhere. Unless there is something in the database I have missed. I have things like Poodll and Adminer working and i am going to be inserting other plugins as time goes on. I just don't get the editor was not displaying but working, then it was doing both right, then it has stopped. I just do not understand what I have done to change the state. It has to be something I have done, these things do not just happen. 

Please, Geoff, it is not the plugin that is the problem it is something else and if I can make this kind of mess, then I am sure someone else will too, or something similar. It may very well be I have missed something somewhere, something that should have been deleted, or dropped from the database - that is what I have to find- and I am not having any luck in this one instance. So any help is really appreciated, and this may very well become a trivial problem in the near future for someone else with an answer found here.  


 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Daniel & Colin

I may be missing something too. I have never noticed this problem and have failed to recreate it. I seem to be able to set the filters to Off but available, and Off on the front page but can still turn them On in individual courses or forums. Using Moodle 2.7.2+.

Geoff

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Yep, same version v2.7.2+ and still no joy. 

I added a plugin that does not appear in the beta v2.8, so I have removed the plugin, then deleted all references from the database, and still nothing. 

The MathJax Equation Editor is in exactly the same state as the Chemistry Equation Editor, no buttons with the correct symbols in them, just the raw TeX. So for some reason, the MathJax filter has become dependent on the TeX filter, so the Chem filter depends on the MathJax filter, which depends upon the TeX filter. TeX filter is disabled, so nothing is working... 

So where and why has this dependency been created? 

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

I am not able to reproduce the problem now. It has been several days since I have noticed it and I can not remember the exact circumstances.  Colin,  how are you getting to the editor? with a new course page or forum?

 
Average of ratings: -
moi!!! it is what is is...
Re: Chemistry editor Atto plugin
Documentation writersParticularly helpful Moodlers

Have not progressed past labels and new pages in the v2.7.2+, Daniel.

In the beta v2.8 it works in label, glossary, forum, assignment and page, and that is all the time I have spent on it there. More or less to make sure it works, but it was far more interested in testing the SVG rendering. 



 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Colin

"The MathJax filter is not working unless the TeX filter is on"

Be aware that the MathJax filter and TeX filter are *different* ways of achieving the same ends i.e. the display of LaTeX-format expressions and formulae. When trouble-shooting, it's easier to work out what's going on by enabling one or the other, but not both. There should be no direct dependency between them.

The TeX filter is the 'traditional' Moodle way of doing things using server-side installed/configured LaTeX binaries and related packages. These may be tricky to install and configure as up-to-date versions are not always readily available for different server operating systems. Also, the quality of the rendering may not be great, though is often improved by using PNG rather than GIF output format - or by using Daniel's new SVG output (in Moodle 2.8).

The MathJax filter does a similar job but shifts the workload to the browser. Although, depending on connectivity factors etc, display may be slightly delayed, MathJax generally gives better quality rendering. Also, as you can just 'plug into' the MathJax Content Delivery Network (CDN), it is typically easier to set-up and configure.

In addition to the above, for chemical formulae display (as used by the Chemistry editor) you need the the mhchem extensions to be available to either the TeX-filter or the MathJax-filter. Again, installation of the mhchem binaries server-side may be tricky. In contrast, the mhchem is already part of recent MathJax releases, though you still need to enable it in the MathJax configuration

The symptoms you describe seem to indicate MathJax is not working at all on the 'problematic' server. This suggests a problem in configuration, or in connectivity to the MathJax Content Delivery Network (CDN). Hence my suggestion to check the filter settings, MathJax URL, firewall configuration etc. In some circumstances other 3rd-party JavaScript/AJAX libraries used in Moodle may also 'block' MathJax function.

With the TeX-filter enabled, it appears basic rendering of LaTeX format is working, but the mhchem extension is not. Again, this could be an installation/availability issue on the server, or a misconfiguration.

Be aware that if Moodle can't access the server-side binaries used by the TeX-filter, it does default to it's own MImeTeX package which does a  lower quality job of rendering LaTeX-format equations. As far as I am aware, MimeTeX does not include mchchem. So won't support the chemistry equation editor. Perhaps this is what is occurring for you.

Hope that helps clarify things and is not just restating the blinking obvious. Others may have further/better diagnoses or suggestions.

Geoff


 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi AL

I have just updated the plugin to v2.7-2 in the Moodle plugins repository.

Includes a regex fix from Daniel which should solve the spacing issue for mhchem expresssions whilst not causing issues with LaTeX (\Delta etc) - together with a few other tweaks.

Also, includes group numbers (1-18) at the top of the periodic table. These 'double-up' as numbers that you can easily add to a formula using a mouse-click, rather than keyboard.

Here is a screenshot

Periodic table with group numbers

 
Average of ratings: -
Picture of AL Rachels
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Geoffrey,

Thanks for the update. Had a 'doh' moment when trying out the updated version. No numbers...until I finally realized that since I already had the previous version installed, I had to go to the editor settings and put the numbers in.

Then I came across a glitch. Formal White theme is not compatible. It puts 21 buttons across each row of the periodic table. A switch to Clean or More and it looks as it should. When I get a chance I will have to dig around in the Formal White css files and see if I can find what needs to be changed to get the right number of buttons per row.

Thanks again to you and Daniel for the nifty work,

AL

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers
Hi AL

I have had a few of those 'doh' moments myself whilst updating and testing... and reupdating and testing... wink

Had not come across theme-dependent issues, but am not surprised by them. I have have tested a little with Clean and More, but mainly with the Essential theme.

You should find it relatively easy to tweak the styles.css file in the plugin to work with (or override) Formal White.

The periodic layout was simply obtained by trial-and-error resizing (min-width) of the buttons. Probably should do something more robust that works across themes.
 
Average of ratings: Useful (1)
Picture of AL Rachels
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Geoffrey,

Thanks for the clue about the plugin styless.css file. Truthfully, I had not noticed it. After school yesterday I finally got the chance to check and sure enough, changing line 13 of the styles.css file from min-width: 2.2em to min-width: 2.5em fixed the problem and now the buttons align correctly.

Thanks,

AL

 
Average of ratings: -
Picture of Daniel Thies
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Chemists should be more careful with units than the mathematicians. wink The dialogue is given a width of 600 px in the YUI code.  The same units should be used for the buttons (e.g. min-width: 31px) .  Using  em bases the width on the font-size.

 
Average of ratings: Useful (2)
Picture of AL Rachels
Re: Chemistry editor Atto plugin
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Daniel,

Thanks for the info. I changed to min-width: 31px and now the periodic table lines up for all three of the themes I tried.

AL

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Just a note that the Chemistry editor Atto plugin has been updated to version 2.8-1. Should work with Moodle 2.8.x or 2.7.x.

This should have more consistent behaviour and work with either the MathJax filter or TeX filter including the new SVG rendering option in Moodle 2.8. In general, it also uses simpler, more natural, mhchem syntax and more robust separation of TeX mathematics symbols (now all wrapped in $.)

After upgrade, you will also need to update the configuration e.g. by copying across from the default options in:

Administration > Site administration > Plugins > Text editors > Atto HTML editor > Chemistry editor settings

You can 'cherry-pick' or customise these to meet your particular requirements. Alternatively, complete uninstallation of the Atto Chemistry plugin followed by reinstallation of the new version will apply the new default configurations.

In more detail:

1. The 'blank' buttons used as spacers in the periodic table layout can cause issues with SVG rendering of TeX in some browsers (particularly Chrome). As a workaround, a . (period, full-stop) is now used as a spacer.

2. The [arrows=pgf] or [arrows=pgf-filled] mhchem configuration options, if used, can also result in SVG rendering issues. So, a simple
\usepackage{mhchem} added to the TeX configuration preamble is now recommended. This also give more consistent behaviour, comparing the TeX and MathJax filters.

3. Simpler, more natural, mhchem syntax is used for e.g. ions M+, subscripts X2Y3, bonds - = and

4. Up/down arrows now use ^ and v (with spaces each side) rather than (^) and (v) or \uparrow and \downarrow

5. Standard TeX mathematics symbols, greek symbols, italic characters etc are now wrapped by $ symbols to clearly differentiate from mhchem syntax and give more consitent editing behaviour. As a result, it is no longer necessary for the editor to add spaces around these.

6. The editor still adds a space before and after reaction and equilibrium arrows, for consistent display and editing behaviour.

7. There are new buttons to insert the TeX 'mid space' \:  and 'em space' \quad. Although mhchem usually provides automatic spacing, this may be useful if, say, additional spacing is required between a reaction equation and its associated enthalpy change etc.

8. Labels above and below arrows or other symbols (\overset, \underset) are now consistently displayed in chemistry (rather than mathematics) format i.e wrapped with \ce{...}.

I have tested as much as I can, but there are very large number of possile permutations with respect to server-side TeX setup, Filter configuration, MathJax setup, browser choice etc. So, let me know if you spot any other bugs or have specific feature requests.


 
Average of ratings: -
Peacock
Re: Chemistry editor Atto plugin
 

Hi Geoffrey,

I have uninstalled and installed new version on Moodle 2.7 and followed the instructions detailed here. Still, I don't find Chemistry editor icon on the Atto toolbar.

What could be the reason?

Indira


 
Average of ratings: -
Picture of Jonathan Fahed
Re: Chemistry editor Atto plugin
 

help please!

I'm facing this problem, as well as the Editor is not displaying anything (I tried the H2SO4 example) it displays the code itself



 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Jonathan

May be a few reasons for this. It will help to diagnose things more quickly if you would tell us:

What version of Moodle are you using? 

Are you using the TeX filter (with mhchem extensions) or the MathJax filter (with mhchem extensions)?

Is the 'standard' Atto Equation editor working in the same context? If it isn't then you need to enable the MathJax or Tex filters. If it is working, then it suggests a problem with mhchem configuration.

Geoff

 
Average of ratings: -
Picture of Jonathan Fahed
Re: Chemistry editor Atto plugin
 

Hello,

I did not understand what do you mean by Atto standard editor, but the text editor is fine, as well as the equation editor, I am facing this problem only in the chemistry editor.
I am using moodle 2.7 .
I tried both filters, each one alone, then again both filters together. Same error.
Your fast reply is highly appreciated!
Thank you!
 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Jonathan

Atto is the default text editor for Moodle 2.7 and 2.8.

Have you set up the mhchem extension for either MathJax or Tex (LaTeX) filters?

The Moodle Docs have details of mhchem installation/configuration.

Probably simpler to set things up using MathJax, as you don't have to install server-side mhchem executables and MathJax+mhchem produces nice equation rendering.

That said, the TeX filter can give good results too, particularly when configured for SVG (Moodle 2.8) or PNG output.

Also, be aware that filters can be switched on/off in various contexts (e.g. forums, labels etc) within a course. So, check the filter is actually on in the context you are using. I have been caught out by this on occasion.

Hope that helps. Get back if you still have issues.

Geoff

 

 
Average of ratings: -
Picture of Jonathan Fahed
Re: Chemistry editor Atto plugin
 

Hey Geoffrey,

I tried everything you told me about, And the filters are enabled, any other suggestions please, I need the editor ASAP!

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi again

Your screenshot (with 'broken' images rather than symbols) suggests that the mhchem extension (whether provided by LaTeX or MathJax) is not working. To diagnose things further I would work through the following steps, if possible, with a fresh course and the MathJaX filter turned ON and the TeX filter turned OFF. Initially test the MathJax filter function only (i.e. without using the equation editor toolbar buttons). 

In the text (Atto) editor in, say, a label, type \( \alpha \) and save. This should display as \( \alpha \) if the MathJax filter is working.

If not Check the MathJax configuration as

Once MathJax is working. Add the mhchem extension. This should include
TeX: {extensions: AMSmath.js","AMSsymbols.js","mhchem.js","noErrors.js","noUndefined.js"]

 
Average of ratings: -
Picture of Jonathan Fahed
Re: Chemistry editor Atto plugin
 

Hey Geoffrey, I tried what you asked me, look at the result

Alpha symbol is shown, but chemistry symbols (pic) is not shown:

error 1

 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Just to check

Is this with the MathJaX filter ON and the TeX filter OFF?

From the screenshot the alpha symbol looks grainy, suggesting the TeX filter is actually being used (though this may just be the resolution of the screenshot itself). 

I was timed-out during editing of my previous post. So, it was missing some further detail. However, it will be helpful to be certain which filter you are using before taking things further.


 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Hi Jonathan

As a follow up, I can reproduce your symptoms exactly with the MathJax filter OFF and the TeX filter ON (but without mhchem added to the TeX filter configuration). The broken image icons in your screenshots also indicate a TeX image rendering issue.

So, you need to EITHER get the TeX filter working properly with the mhchem extension OR get the MathJax filter working with the mhchem extension. Usually, the latter is easier. So, I'll focus on that. If, for whatever reason, MathJax proves to be problematic, we can try 'PlanB', server-side TeX filter configuration. 

In Administration > Plugins > Filters > MathJaX check that the HTTP MathJax URL and HTTPS MathJax URL are correct.

The defaults (in latest Moodle 2.7.x) of: 

http://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js

and 

https://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js

should be fine, but be aware that the MartJax CDN URL changed during 2014 and you may have the older, non-functional, address.

Also, it may be that access to the MathJax CDNs is blocked by a proxy, firewall etc. In that case you may need to use the URL of  a local server installation of MathJax.

If MathJax is working then the alpha symbol, or other simple TeX expression, should still render correctly with the TeX filter turned OFF (and the MathJax filter ON). You will probably notice better quality display by the MathJax filter as compared to the TeX filter.

Then revisit Administration > Plugins > Filters > MathJaX

and check that the mhchem.js extension is added to the MathJax configuration. My working configuration includes:

 TeX: {

        extensions: ["AMSmath.js","AMSsymbols.js","mhchem.js","noErrors.js","noUndefined.js"]

    },

Now mhchem syntax expressions (and the Atto chemistry editor) should work!

Good luck!

If you still have problems with MathJax e.g. with performance or conflict with other JavaScript libraries, then we can try 'PlanB'.

 
Average of ratings: -
Picture of Siddhant Wankar
Re: Chemistry editor Atto plugin
 

help please!

I'm facing this problem, as well as the Editor is not displaying anything (I tried the H2SO4 example) it displays the code itself



 
Average of ratings: -
Picture of Greg Padberg
Re: Chemistry editor Atto plugin
 

We previously experienced an issue where TeX notation within Calculated Multichoice Questions does not seem to work using the standard MathJax or TeX Moodle filters.  It only seems to work when MathJax is loaded for all Moodle pages (adding MathJax javascript loader at Site Administration > Appearance > Additional HTML within HEAD).  Further discussion can be found here.

Because of the above mentioned issue, we are loading MathJax via Additional HTML (with MathJax and TeX filters both disabled) and have recently installed the Chemistry editor plugin for Atto.  Can somebody post an example configuration of how to add the mhchem extension where MathJax loads from CDN?



 
Average of ratings: -
Picture of Geoffrey Rowland
Re: Chemistry editor Atto plugin
Plugin developers

Something like:

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({ 
    config: ["Accessible.js", "Safe.js"],
    TeX: {
        extensions: ["mhchem.js"]
    },
    errorSettings: { message: ["!"] },
    skipStartupTypeset: true,
    messageStyle: "none"
  });
</script>
<script type="text/javascript"
    src="https://cdn.mathjax.org/mathjax/latest/MathJax.js">
</script>

See also: http://mathjax.readthedocs.org/en/latest/tex.html#mhchem


 
Average of ratings: Useful (1)
Picture of Greg Padberg
Re: Chemistry editor Atto plugin
 

Thanks Geoffrey, that worked a treat!  I just had to remember that the MathJax setup was configured inline in the "Additional HTML" section rather than in the MathJax filter configuration.  As such, it worked when the the MathJax filter configuration info (configuration filter_mathjaxloader | mathjaxconfig) was left empty.

 
Average of ratings: -