Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


Skip LaTeX errors

  • Samuele Kaplun
    Samuele Kaplun

    Dear jsMath developers,
    which would be the best way to instruct jsMath to skip errors and displays plain original text instead of the yellow box with the error message?
    jsMath would definitively bring a great added value to our online scientific digital repository, but unfortunately some records, e.g.
    <>, that contains broken LaTeX appear definitively worse than without the error.

    Thanks a lot for your help and this great tool!

    • Add the following lines to your easy/load.js file just before the comment about not changing anything after that.  (Underscores are used at the beginning of the lines to show indenting, since I haven't been able to figure out any way to get spaces at the beginning of the line.  You should change the underscores to spaces.)

      _ jsMath.styles = {
      ___ '.typeset .error': 'font-style: italic; color: grey'
      _ };

      _ jsMath.Parse = function (s,font,size,style) {
      ___ var parse = new jsMath.Parser(s,font,size,style);
      ___ parse.Parse();
      ___ if (parse.error) {parse.error = s};
      ___ return parse;
      _ }

    • PS, you can set the '.typeset .error' style to however you want to error LaTeX to appear.  grey italics is just a sample.


    • Samuele Kaplun
      Samuele Kaplun

      Dear Davide,
      thanks a lot of your quick and complete answer. That solved perfectly my issue!