SourceForge has been redesigned. Learn more.

Disable "Unknown control sequence"-Message

  • godemi

    godemi - 2009-05-28

    whenever jsMath finds a control sequence it doesn't know (e. g. \R), the message "Unknown control sequence" gets rendered into the website. Is it possible to disable this message and instead display the control sequence?

    Thanks for help!


    • Davide P. Cervone

      There is a discussion of one approach to this at


      which tells you how to prevent ANY error message from showing up.

      But it doesn't quite do what you ask, because it typesets none of the equation, and just shows the original TeX code for the complete equation.  If you want the rest of the math to be typeset with the unknown control sequence being shown as its name, then add the following to your easy/load.js file just above the "do not change below this" comment.  (Note that I have used underscores to get spacing at the beginning of the lines; you should change these back to spaces after pasting into the easy/load.js file).

      jsMath.styles = {
      _ '.typeset .unknown': {background: "yellow", border: "1px solid red"}

      jsMath.Parser = {prototype: {
      _ HandleCS: function (s,font,size,style) {
      ___ var cmd = this.GetCommand(); if (this.error) return;
      ___ if (this.macros[cmd]) {
      _____ var macro = this.macros[cmd];
      _____ if (typeof(macro) == "string") {macro = [macro]}
      _____ this[macro[0]](cmd,macro.slice(1)); return;
      ___ }
      ___ if (this.mathchardef[cmd]) {
      _____ this.HandleMathCode(cmd,this.mathchardef[cmd]);
      _____ return;
      ___ }
      ___ if (this.delimiter[this.cmd+cmd]) {
      _____ this.HandleMathCode(cmd,this.delimiter[this.cmd+cmd].slice(0,3))
      _____ return;
      ___ }
      ___ cmd = '<span class="unknown">'+this.cmd+cmd+'</span>';
      ___ this.mlist.Add(jsMath.mItem.TextAtom('ord',cmd,'normal'));
      _ }

      This will typeset the control sequence name in the style given by the ".typeset .missing" style declaration at the top.  You can change that to be whatever you want.

      Hope that does it for you.


      • godemi

        godemi - 2009-05-30

        Thanks a lot! That's exactly what I was looking for.


Log in to post a comment.