CodeMirror.defineMode("stex",function(){function h(k,l){k.cmdState.push(l)}function g(k){if(k.cmdState.length>0){return k.cmdState[k.cmdState.length-1]}else{return null}}function j(l){if(l.cmdState.length>0){var k=l.cmdState.pop();k.closeBracket()}}function a(n){var m=n.cmdState;for(var l=m.length-1;l>=0;l--){var k=m[l];if(k.name=="DEFAULT"){continue}return k.styleIdentifier()}return null}function b(m,l,n,k){return function(){this.name=m;this.bracketNo=0;this.style=l;this.styles=k;this.brackets=n;this.styleIdentifier=function(){if(this.bracketNo<=this.styles.length){return this.styles[this.bracketNo-1]}else{return null}};this.openBracket=function(){this.bracketNo++;return"bracket"};this.closeBracket=function(){}}}var c=new Array();c.importmodule=b("importmodule","tag","{[",["string","builtin"]);c.documentclass=b("documentclass","tag","{[",["","atom"]);c.usepackage=b("documentclass","tag","[",["atom"]);c.begin=b("documentclass","tag","[",["atom"]);c.end=b("documentclass","tag","[",["atom"]);c.DEFAULT=function(){this.name="DEFAULT";this.style="tag";this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function d(l,k){l.f=k}function e(o,n){if(o.match(/^\\[a-zA-Z@]+/)){var l=o.current();l=l.substr(1,l.length-1);var k;if(c.hasOwnProperty(l)){k=c[l]}else{k=c.DEFAULT}k=new k();h(n,k);d(n,f);return k.style}if(o.match(/^\\[$&%#{}_]/)){return"tag"}if(o.match(/^\\[,;!\/]/)){return"tag"}var m=o.next();if(m=="%"){if(!o.eol()){d(n,i)}return"comment"}else{if(m=="}"||m=="]"){k=g(n);if(k){k.closeBracket(m);d(n,f)}else{return"error"}return"bracket"}else{if(m=="{"||m=="["){k=c.DEFAULT;k=new k();h(n,k);return"bracket"}else{if(/\d/.test(m)){o.eatWhile(/[\w.%]/);return"atom"}else{o.eatWhile(/[\w-_]/);return a(n)}}}}}function i(l,k){l.skipToEnd();d(k,e);return"comment"}function f(n,m){var l=n.peek();if(l=="{"||l=="["){var k=g(m);k.openBracket(l);n.eat(l);d(m,e);return"bracket"}if(/[ \t\r]/.test(l)){n.eat(l);return null}d(m,e);k=g(m);if(k){j(m)}return e(n,m)}return{startState:function(){return{f:e,cmdState:[]}},copyState:function(k){return{f:k.f,cmdState:k.cmdState.slice(0,k.cmdState.length)}},token:function(m,l){var k=l.f(m,l);return k}}});CodeMirror.defineMIME("text/x-stex","stex");CodeMirror.defineMIME("text/x-latex","stex");