Documentation

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • Wiris Quizzes

      • Learning Lemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Miscellaneous

                      • Wiris Integrations

                        • Home
                        • MathPlayer
                        • Getting Started on a Translation
                        • Some info about the files
                        • Some info about the files

                        File Syntax

                        Reading time: 1min

                        Here is some information about the syntax of rules. You do not need to know this -- it is only for informational purposes for the curious who have some programming background. The pattern matcher works on a tree and finds the first match it can in a file. The pattern matcher tries to match a node in the input tree and if it finds a rule that matches, produces an output node. Nodes have a name, can have attributes (name/value pairs), and can have children. In general, a rule looks like

                        nodeName ? boolean tests
                         => newNodeName(children) {attribute values}
                        

                        An example from

                        UIWord ? (ruleRef=="RR_simpleSuperScript" )
                        => UIInput(string{text=(::verbosity < ::v_full) ? "to the" : "raised to the";})
                         { ruleRef="RR_simpleSuperScript"; };
                        

                        In this example, the nodeName is "UIWord" and we are testing its "ruleRef" attribute is the string "RR_simpleSuperScript". If it is, then we generate a new tree node named "UIInput" with the child named "string". String has a text attribute whose value depends upon the value of the global variable "verbosity". "UIInput" has the attribute named "ruleRef".

                        A lot of the syntax is based on C/C++ and is similar to Java and Javascript. One piece of syntax that is used a lot in the rules is the conditional operator

                        condition ? value-if-true : value-if-false
                        

                        The example above uses it to return different strings to speak depending on the values of the global variable "verbosity".

                        Note that all global variables are accessed using the "::" syntax as in "::verbosity".

                        Was this article helpful?

                        Yes
                        No
                        Give feedback about this article

                        Related Articles

                        • Autoformat
                        • Formula into Plotter Area
                        • Symbols
                        • Target Group

                        Making people’s STEM work more meaningful

                        MathType

                        • MathType for Office Tools
                        • MathType for Mac
                        • MathType for Microsoft 365
                        • MathType for Google Workspace
                        • MathType for LMS
                        • MathType for XML Editors
                        • Arabic notation
                        • Our products accessibility
                        • MathType is online

                        WirisQuizzes

                        Learning Lemur

                        Solutions for Education

                        • Blackboard Learn
                        • Brightspace by D2L
                        • Canvas
                        • Google Classroom
                        • Moodle
                        • Schoology

                        Solutions for Publishing Houses

                        Solutions for Technical Writers

                        Solutions for Chemistry

                        Integrations

                        • HTML Editors
                        • MathType in WordPress

                        Pricing

                        Company

                        Careers

                        Blog

                        Contact Us

                        Buy Now

                        Plugin Downloads

                        © Wiris 2025

                        • Cookie Settings
                        • Cookie Policy
                        • Terms of Use
                        • Privacy Policy / GDPR
                        • Student Data Privacy
                        • Compliance
                        • Powered by Helpjuice
                        Expand