diff -ruN orig/lexer.mll neo3/lexer.mll --- orig/lexer.mll 2002-12-19 15:32:35.000000000 +0100 +++ neo3/lexer.mll 2003-01-01 16:32:19.000000000 +0100 @@ -7,7 +7,8 @@ let alpha = ['a'-'z' 'A'-'Z'] let literal_it = ['a'-'z' 'A'-'Z'] let literal_rm = ['0'-'9'] -let literal_uf = ['+' '-' '*' ',' '=' '(' ')' ':' '/' ';' '?' '.' '!' '|' '\'' ] +let literal_uf_lt = [',' '(' ')' ':' ';' '?' '.' '!' '\''] +let literal_uf_op = ['+' '-' '*' '=' '/' '|'] let boxchars = ['0'-'9' 'a'-'z' 'A'-'Z' '+' '-' '*' ',' '=' '(' ')' ':' '/' ';' '?' '.' '!' ' ' '\128'-'\255'] let aboxchars = ['0'-'9' 'a'-'z' 'A'-'Z' '+' '-' '*' ',' '=' '(' ')' ':' '/' ';' '?' '.' '!' ' '] @@ -42,7 +43,8 @@ BOX ("\\vbox", String.sub str n (String.length str - n - 1)) } | literal_it { let str = Lexing.lexeme lexbuf in LITERAL (HTMLABLEC (FONT_IT, str,str)) } | literal_rm { let str = Lexing.lexeme lexbuf in LITERAL (HTMLABLEC (FONT_RM, str,str)) } - | literal_uf { let str = Lexing.lexeme lexbuf in LITERAL (HTMLABLEC (FONT_UFH, str,str)) } + | literal_uf_lt { let str = Lexing.lexeme lexbuf in LITERAL (HTMLABLEC (FONT_UFH, str,str)) } + | literal_uf_op { let str = Lexing.lexeme lexbuf in LITERAL (HTMLABLEC (FONT_UFH, str," "^str^" ")) } | "\\" alpha + { Texutil.find (Lexing.lexeme lexbuf) } | "\\sqrt" space * "[" { FUN_AR1opt "\\sqrt" } | "\\," { LITERAL (HTMLABLE (FONT_UF, "\\,"," ")) } @@ -57,6 +59,8 @@ | "\\%" { LITERAL (HTMLABLE (FONT_UFH,"\\%","%")) } | "&" { NEXT_CELL } | "\\\\" { NEXT_ROW } + | "\\begin{matrix}" { Texutil.tex_use_ams(); BEGIN__MATRIX } + | "\\end{matrix}" { END__MATRIX } | "\\begin{pmatrix}" { Texutil.tex_use_ams(); BEGIN_PMATRIX } | "\\end{pmatrix}" { END_PMATRIX } | "\\begin{bmatrix}" { Texutil.tex_use_ams(); BEGIN_BMATRIX } @@ -67,8 +71,8 @@ | "\\end{vmatrix}" { END_VMATRIX } | "\\begin{Vmatrix}" { Texutil.tex_use_ams(); BEGIN_VVMATRIX } | "\\end{Vmatrix}" { END_VVMATRIX } - | '>' { LITERAL (HTMLABLEC(FONT_UFH,">",">")) } - | '<' { LITERAL (HTMLABLEC(FONT_UFH,"<","<")) } + | '>' { LITERAL (HTMLABLEC(FONT_UFH,">"," > ")) } + | '<' { LITERAL (HTMLABLEC(FONT_UFH,"<"," < ")) } | '%' { LITERAL (HTMLABLEC(FONT_UFH,"\\%","%")) } | '~' { LITERAL (HTMLABLE (FONT_UF, "~"," ")) } | '[' { LITERAL (HTMLABLEC(FONT_UFH,"[","[")) } diff -ruN orig/parser.mly neo3/parser.mly --- orig/parser.mly 2002-12-21 13:55:52.000000000 +0100 +++ neo3/parser.mly 2003-01-01 15:57:42.000000000 +0100 @@ -10,8 +10,8 @@ %token Tex.t->string*string*string)> FUN_AR2h %token Tex.t list->string*string*string)> FUN_INFIXh %token EOF CURLY_OPEN CURLY_CLOSE SUB SUP SQ_CLOSE NEXT_CELL NEXT_ROW -%token BEGIN_PMATRIX BEGIN_BMATRIX BEGIN_BBMATRIX BEGIN_VMATRIX BEGIN_VVMATRIX -%token END_PMATRIX END_BMATRIX END_BBMATRIX END_VMATRIX END_VVMATRIX +%token BEGIN__MATRIX BEGIN_PMATRIX BEGIN_BMATRIX BEGIN_BBMATRIX BEGIN_VMATRIX BEGIN_VVMATRIX +%token END__MATRIX END_PMATRIX END_BMATRIX END_BBMATRIX END_VMATRIX END_VVMATRIX %type tex_expr %start tex_expr @@ -74,6 +74,7 @@ { TEX_INFIX($3,$2,$4) } | CURLY_OPEN ne_expr FUN_INFIXh ne_expr CURLY_CLOSE { let t,h=$3 in TEX_INFIXh(t,h,$2,$4) } + | BEGIN__MATRIX matrix END__MATRIX { TEX_MATRIX ("matrix", $2) } | BEGIN_PMATRIX matrix END_PMATRIX { TEX_MATRIX ("pmatrix", $2) } | BEGIN_BMATRIX matrix END_BMATRIX { TEX_MATRIX ("bmatrix", $2) } | BEGIN_BBMATRIX matrix END_BBMATRIX { TEX_MATRIX ("Bmatrix", $2) } diff -ruN orig/texutil.ml neo3/texutil.ml --- orig/texutil.ml 2002-12-21 14:39:10.000000000 +0100 +++ neo3/texutil.ml 2003-01-01 16:28:23.000000000 +0100 @@ -58,10 +58,12 @@ | TEX_FUN1hf (_,ff,a)::r -> (html_render_flat (new_ctx ff) [a])^html_render_flat ctx r | TEX_DECLh (_,ff,a)::r -> (html_render_flat (new_ctx ff) a)^html_render_flat ctx r | TEX_CURLY ls::r -> html_render_flat ctx (ls @ r) - | TEX_DQ (a,b)::r -> (let bs = html_render_flat ctx [b] in match html_render_size ctx a with + | TEX_DQ (a,b)::r -> (html_conservative := false; + let bs = html_render_flat ctx [b] in match html_render_size ctx a with true, s -> raise Too_difficult_for_html | false, s -> s^""^bs^"")^html_render_flat ctx r - | TEX_UQ (a,b)::r -> (let bs = html_render_flat ctx [b] in match html_render_size ctx a with + | TEX_UQ (a,b)::r -> (html_conservative := false; + let bs = html_render_flat ctx [b] in match html_render_size ctx a with true, s -> raise Too_difficult_for_html | false, s -> s^""^bs^"")^html_render_flat ctx r | TEX_FQ (a,b,c)::r -> (html_conservative := false; @@ -307,6 +309,9 @@ | "\\hookleftarrow" -> LITERAL (TEX_ONLY "\\hookleftarrow ") | "\\mp" -> LITERAL (TEX_ONLY "\\mp ") | "\\approx" -> LITERAL (TEX_ONLY "\\approx ") + | "\\flat" -> LITERAL (TEX_ONLY "\\flat ") + | "\\sharp" -> LITERAL (TEX_ONLY "\\sharp ") + | "\\natural" -> LITERAL (TEX_ONLY "\\natural ") | "\\int" -> LITERAL (HTMLABLE_BIG ("\\int ", "∫")) | "\\sum" -> LITERAL (HTMLABLE_BIG ("\\sum ", "∑")) | "\\prod" -> LITERAL (HTMLABLE_BIG ("\\prod ", "∏"))