Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-61558

ChemJax: Adding the Chemistry filter ChemJax to Moodle core filters

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.1
    • Fix Version/s: None
    • Component/s: Filters
    • Affected Branches:
      MOODLE_34_STABLE

      Description

      THIS IS AN MUA PROJECT PROPOSAL THAT WILL BE OR HAS BEEN SUBMITTED FOR POSSIBLE MUA FUNDING.  ANY EXISTING TRACKER ITEMS THAT THIS MIGHT DUPLICATE SHOULD BE LINKED TO BELOW.  

      Overview

      The ChemJax filter (winner of Moodle Association of Japan's 2017 best innovations award) has been implemented by Kenichi Miura and Takayuki Matsuki from Tokyo Kasei University. This filter, much like its counterpart MathJax, allows for drawing complicated chemical structural formulas. These formulas display graphically in Moodle via Moodle filter mechanisms and short codes. The code is completed and was funded by a grant from the Moodle Association of Japan.

      See screen shots and examples on the Moodle Association of Japan Best Innovations Showcase at this link: https://showcase.moodlejapan.org/inno/course/view.php?id=7

      Summary

      • Project size: small
      • Audience: primary schools, universities, work places, any place using chemical notation
      • Target users: teachers, students, administrators

      Goals

      The code has already been implemented and will be made available. The goals of this project will be to properly improve the plugin to comply with all Moodle core module standards. The process of moving a 3p plugin to core module needs to be implemented. Help texts may need to be written in English, however Moodle Association of Japan will provide support for any translation from Japanese to English that is required.

      This is the MathJax advanced feature/extension as a plugin for Moodle to draw complex chemical formulas.

      (1) Plugin name : ChemJax plugin filter_chemjax

      (2) Plugin type: filter

      (3) main features: This plugin makes it possible to draw chemical formula and chemical equation. Moreover, graphics are also able to be drawn with constitutional formula with branchings and rings.

      • It works as MathJax advanced feature or extension.
      • TeX translation : Applying mhchem
      • Drawing program : Using xy-pic.js
      • Command of chemical equation : Chemfig compliant
      • Input additional characters and charge number of ion : automatic recognition by mhchem
      • Future development : stereochemical structure and electronic formulas

      This plugin is supported by MAJ (Moodle Association  of Japan) Research and Development Grant in 2017.

      User Stories 

      As a teacher, I should be able to easily implement and display chemical notations within any activities and resources that I create in Moodle that fall under the filter processing rules of Moodle.

      As a student, I should be able to submit my own chemical notations in areas.

      As an admin, I should be able to enable and disable the filter within the various areas of the Moodle site as can be done with other filters.

      Links to existing tracker issues, forum discussions, contrib plugins

      A demo course showing the filter in action can be seen here: https://showcase.moodlejapan.org/inno/course/view.php?id=7

      The source code will be made available when this project is picked up.

      Requirements

      https://showcase.moodlejapan.org/inno/course/view.php?id=7

       

      Basic commands of ChemJax

      bond options: -[<angle>, <magnification of bond length>, <integer1>, <integer2>}

      where <integer{1,2}>=the numbers of the desired departure and arival atoms.

      1) Specify options: Some options can be omitted when necessary options are given. For instance, -[4,2] determines angle and magnification. If one wants to omit some options, one may insert a couple of commas like -[1,,1,2].

      2) Specify type of bonds:
      Single bond: -
      Double bond: =
      Triple bond: ~

      3) First option in square brackets: Specify angle

      There are three ways to specify angles.

      • Specification using multiple of 45 degrees: To express 90, [2] 0 through 7 are effective.
      • Specification using absolute angle: To express 90, [:90] Minus value of angle is possible, e.g., -[:-90] gives us downward lines.
      • Specification using relative angle: To express 30, [::30]. This means the rotation angle from that place.

      4) Second option: Specify magnification
      Specify how long bond should be, For instance, -[1.5] lengthenes a bond 1.5 times longer.

      5) Third and fourth options: Specify positions of atoms bonded
      As a default, the first atoms are bonded. To change this, one has to specify by third and fourth options.

      Examples:

      1) Simple exmaple:

      \cjx{CH_3 CH ([2]CH_3) -CH_2 -C (=[:60]O) -[:-60]O -H}

      2) Specify relative angles:

      \cjx{C -C -[::20]C -[::20]C -[::20]C}

      3) Specify bonding atoms by third and fourth options:

      \cjx{CH_3CH_2 -[:-90,,3]OH}

      4) Specify branched structure:

      \cjx{CH_3 CH ([2]CH (-CH3) -[2]CH3) -CH3}

      5) Carbon abbreviation (which is used in texbooks in universities. Skelton structures can be drawn.):

      \cjx{[:-30] -[::60] (=[2]O) -[::-60] =[::60] ([::60]) -[::-60]}

      6) Decription of ring structures:

      \cjx{H2C (-[-2,,2,2]H2C -[0]CH2 -[2]CH2) -CH2}

      7) Description of a molecule with multiple rings:

      \cjx{C =[6]C [::60]C -[::60]C =[::60]C -[::60]C ([-2,2]\phantom{X}) -[::60]\phantom{X}}

      (example of a dewar benzene)

      8) Description of a molecule with with a regular polygon

      \cjx{[:-30] =[::60] -[::60] =[::60] -[::60] =[::60]} \cjx{[:-60] =[::60] -[::60] =[::60] -[::60] =[::60]}

      (One can easily draw molecules like benzenes with regular polygons.)

      9) Specify an angle for a whole molecule:

      \cjx{[:-30,0] -[::-30] =[::60] -[::60] =[::60] -[::60] =[::60]} \cjx{[:-30,0] -[::-60] =[::60] -[::60] =[::60] -[::60] =[::60]}

      (This rotates the example in 8).
      Specifying [:-30] in the front, one can rotate a whole molecule.)

      10) Extend rings and branches from a ring structure:

      \cjx{\vphantom{X} =[:0] [::60] ([::-60,0.7]N =[,0.5]N [,0.7] -[::-60] ([::-60] =[::60] [::60] -[::60] -[::60]) =[::60] -[::60] =[::60] -[::60] ([::-60]HO) =[::60]) =[::60] -[::60] =[::60] -[::60]}

      (This is an orange thyme made of a benzene diazonium chloride and azo dye made of 2-naphthol.)

      11) Specify an atom on the ring structure:

      \cjx{\vphantom{X} =[:-30] [::60] ([:-18]NH [::72,,1] =[::72] ([::-72]CH2 [2]CH ([4]H2N\phantom{X}\phantom{X}) -[0]COOH) -[::72]) =[::60] -[::60] =[::60] -[::60]}

      (This is an example of alpha-amino acid.)

      Further reading

      https://moodle.org/mod/forum/search.php?id=5&search=ChemJax posts discussing request for ChemJax (relating to MathJax)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tallthom Thom Rawson
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: