diff --git a/math/html.ml b/math/html.ml
index e880f07..1b0e8cb 100644
--- a/math/html.ml
+++ b/math/html.ml
@@ -28,6 +28,7 @@ let rec html_render_flat ctx = function
TEX_LITERAL (HTMLABLE (ft,_,sh))::r -> (html_liberal (); (font_render sh (ctx,ft))^html_render_flat ctx r)
| TEX_LITERAL (HTMLABLEC(ft,_,sh))::r -> (font_render sh (ctx,ft))^html_render_flat ctx r
| TEX_LITERAL (MHTMLABLEC(ft,_,sh,_,_))::r -> (font_render sh (ctx,ft))^html_render_flat ctx r
+ | TEX_LITERAL (MHTMLABLEFC(ft,_,sh,_,_,_))::r -> (font_render sh (ctx,ft))^html_render_flat ctx r
| TEX_LITERAL (HTMLABLEM(ft,_,sh))::r -> (html_moderate(); (font_render sh (ctx,ft))^html_render_flat ctx r)
| TEX_LITERAL (HTMLABLE_BIG (_,sh))::r -> (html_liberal (); sh^html_render_flat ctx r)
| TEX_FUN1hl (_,(f1,f2),a)::r -> f1^(html_render_flat ctx [a])^f2^html_render_flat ctx r
@@ -75,6 +76,7 @@ let rec html_render_deep ctx = function
| TEX_LITERAL (HTMLABLEM(ft,_,sh))::r -> (html_moderate(); ("",(font_render sh (ctx,ft)),"")::html_render_deep ctx r)
| TEX_LITERAL (HTMLABLEC(ft,_,sh))::r -> ("",(font_render sh (ctx,ft)),"")::html_render_deep ctx r
| TEX_LITERAL (MHTMLABLEC(ft,_,sh,_,_))::r -> ("",(font_render sh (ctx,ft)),"")::html_render_deep ctx r
+ | TEX_LITERAL (MHTMLABLEFC(ft,_,sh,_,_,_))::r -> ("",(font_render sh (ctx,ft)),"")::html_render_deep ctx r
| TEX_LITERAL (HTMLABLE_BIG (_,sh))::r -> (html_liberal (); ("",sh,"")::html_render_deep ctx r)
| TEX_FUN2h (_,f,a,b)::r -> (html_liberal (); (f a b)::html_render_deep ctx r)
| TEX_INFIXh (_,f,a,b)::r -> (html_liberal (); (f a b)::html_render_deep ctx r)
diff --git a/math/lexer.mll b/math/lexer.mll
index 8a667b2..c53a43f 100644
--- a/math/lexer.mll
+++ b/math/lexer.mll
@@ -6,9 +6,9 @@
let space = [' ' '\t' '\n' '\r']
let alpha = ['a'-'z' 'A'-'Z']
let literal_id = ['a'-'z' 'A'-'Z']
-let literal_mn = ['0'-'9']
+let literal_mn = ['0'-'9' '.']
let literal_uf_lt = [',' ':' ';' '?' '!' '\'']
-let delimiter_uf_lt = ['(' ')' '.']
+let delimiter_uf_lt = ['(' ')']
let literal_uf_op = ['+' '-' '*' '=']
let delimiter_uf_op = ['/' '|']
let boxchars = ['0'-'9' 'a'-'z' 'A'-'Z' '+' '-' '*' ',' '=' '(' ')' ':' '/' ';' '?' '.' '!' '\'' '`' ' ' '\128'-'\255']
@@ -52,7 +52,7 @@ rule token = parse
| literal_id { let str = Lexing.lexeme lexbuf in LITERAL (MHTMLABLEC (FONT_IT, str,str,MI,str)) }
| literal_mn { let str = Lexing.lexeme lexbuf in LITERAL (MHTMLABLEC (FONT_RM, str,str,MN,str)) }
| literal_uf_lt { let str = Lexing.lexeme lexbuf in LITERAL (HTMLABLEC (FONT_UFH, str,str)) }
- | delimiter_uf_lt { let str = Lexing.lexeme lexbuf in DELIMITER (HTMLABLEC (FONT_UFH, str,str)) }
+ | delimiter_uf_lt { let str = Lexing.lexeme lexbuf in DELIMITER (MHTMLABLEC (FONT_UFH, str,str,MO,str)) }
| "-" { let str = Lexing.lexeme lexbuf in LITERAL (MHTMLABLEC (FONT_UFH,"-"," − ",MO,str))}
| literal_uf_op { let str = Lexing.lexeme lexbuf in LITERAL (MHTMLABLEC (FONT_UFH, str," "^str^" ",MO,str)) }
| delimiter_uf_op { let str = Lexing.lexeme lexbuf in DELIMITER (MHTMLABLEC (FONT_UFH, str," "^str^" ",MO,str)) }
@@ -60,20 +60,31 @@ rule token = parse
| "\\sqrt" space * "[" { FUN_AR1opt "\\sqrt" }
| "\\xleftarrow" space * "[" { Texutil.tex_use_ams(); FUN_AR1opt "\\xleftarrow" }
| "\\xrightarrow" space * "[" { Texutil.tex_use_ams(); FUN_AR1opt "\\xrightarrow" }
- | "\\" (latex_function_names as name) space * "(" { LITERAL (HTMLABLEC(FONT_UFH,"\\" ^ name ^ "(", name ^ "(")) }
- | "\\" (latex_function_names as name) space * "[" { LITERAL (HTMLABLEC(FONT_UFH,"\\" ^ name ^ "[", name ^ "[")) }
- | "\\" (latex_function_names as name) space * "\\{" { LITERAL (HTMLABLEC(FONT_UFH,"\\" ^ name ^ "\\{", name ^ "{")) }
- | "\\" (latex_function_names as name) space * { LITERAL (HTMLABLEC(FONT_UFH,"\\" ^ name ^ " ", name ^ " ")) }
- | "\\" (mediawiki_function_names as name) space * "(" { (Texutil.tex_use_ams(); LITERAL (HTMLABLEC(FONT_UFH,"\\operatorname{" ^ name ^ "}(", name^ "("))) }
- | "\\" (mediawiki_function_names as name) space * "[" { (Texutil.tex_use_ams(); LITERAL (HTMLABLEC(FONT_UFH,"\\operatorname{" ^ name ^ "}[", name^ "["))) }
- | "\\" (mediawiki_function_names as name) space * "\\{" { (Texutil.tex_use_ams(); LITERAL (HTMLABLEC(FONT_UFH,"\\operatorname{" ^ name ^ "}\\{", name^ "{"))) }
- | "\\" (mediawiki_function_names as name) space * { (Texutil.tex_use_ams(); LITERAL (HTMLABLEC(FONT_UFH,"\\operatorname{" ^ name ^ "}", name ^ " "))) }
+ | "\\" (latex_function_names as name) space * "("
+ { LITERAL (MHTMLABLEFC(FONT_UFH,"\\" ^ name ^ "(", name ^ "(", MF, name, "(")) }
+ | "\\" (latex_function_names as name) space * "["
+ { LITERAL (MHTMLABLEFC(FONT_UFH,"\\" ^ name ^ "[", name ^ "[", MF, name, "[")) }
+ | "\\" (latex_function_names as name) space * "\\{"
+ { LITERAL (MHTMLABLEFC(FONT_UFH, "\\" ^ name ^ "\\{", name ^ "{", MF, name, "{")) }
+ | "\\" (latex_function_names as name) space *
+ { LITERAL (MHTMLABLEC(FONT_UFH,"\\" ^ name, name ^ " ", MF, name)) }
+ | "\\" (mediawiki_function_names as name) space * "("
+ { (Texutil.tex_use_ams(); LITERAL (MHTMLABLEFC(FONT_UFH,
+ "\\operatorname{" ^ name ^ "}(", name ^ "(", MF, name, "("))) }
+ | "\\" (mediawiki_function_names as name) space * "["
+ { (Texutil.tex_use_ams(); LITERAL (MHTMLABLEFC(FONT_UFH,
+ "\\operatorname{" ^ name ^ "}[", name ^ "[", MF, name, "["))) }
+ | "\\" (mediawiki_function_names as name) space * "\\{"
+ { (Texutil.tex_use_ams(); LITERAL (MHTMLABLEFC(FONT_UFH,
+ "\\operatorname{" ^ name ^ "}\\{", name ^ "{", MF, name, "{"))) }
+ | "\\" (mediawiki_function_names as name) space *
+ { (Texutil.tex_use_ams(); LITERAL (MHTMLABLEC(FONT_UFH,"\\operatorname{" ^ name ^ "}", name ^ " ", MF, name))) }
| "\\," { LITERAL (HTMLABLE (FONT_UF, "\\,"," ")) }
| "\\ " { LITERAL (HTMLABLE (FONT_UF, "\\ "," ")) }
| "\\;" { LITERAL (HTMLABLE (FONT_UF, "\\;"," ")) }
| "\\!" { LITERAL (TEX_ONLY "\\!") }
- | "\\{" { DELIMITER (HTMLABLEC(FONT_UFH,"\\{","{")) }
- | "\\}" { DELIMITER (HTMLABLEC(FONT_UFH,"\\}","}")) }
+ | "\\{" { DELIMITER (MHTMLABLEC(FONT_UFH,"\\{","{",MO,"{")) }
+ | "\\}" { DELIMITER (MHTMLABLEC(FONT_UFH,"\\}","}",MO,"}")) }
| "\\|" { DELIMITER (HTMLABLE (FONT_UFH,"\\|","||")) }
| "\\_" { LITERAL (HTMLABLEC(FONT_UFH,"\\_","_")) }
| "\\#" { LITERAL (HTMLABLE (FONT_UFH,"\\#","#")) }
@@ -109,7 +120,7 @@ rule token = parse
| '%' { LITERAL (HTMLABLEC(FONT_UFH,"\\%","%")) }
| '$' { LITERAL (HTMLABLEC(FONT_UFH,"\\$","$")) }
| '~' { LITERAL (HTMLABLE (FONT_UF, "~"," ")) }
- | '[' { DELIMITER (HTMLABLEC(FONT_UFH,"[","[")) }
+ | '[' { DELIMITER (MHTMLABLEC(FONT_UFH,"[","[",MO,"[")) }
| ']' { SQ_CLOSE }
| '{' { CURLY_OPEN }
| '}' { CURLY_CLOSE }
diff --git a/math/mathml.ml b/math/mathml.ml
index b6c76af..d01414c 100644
--- a/math/mathml.ml
+++ b/math/mathml.ml
@@ -1,13 +1,15 @@
open Tex
open Render_info
-type t = TREE_MN of string | TREE_MO of string | TREE_MI of string
+type t = TREE_MN of string | TREE_MO of string | TREE_MI of string | TREE_MF of string | TREE_MFB of string * string
let rec make_mathml_tree = function
TREE_MN a::otr,TEX_LITERAL(MHTMLABLEC(_,_,_,MN,b))::itr -> make_mathml_tree(TREE_MN (a^b)::otr,itr)
| otr,TEX_LITERAL(MHTMLABLEC(_,_,_,MN,a))::itr -> make_mathml_tree(TREE_MN a::otr,itr)
| otr,TEX_LITERAL(MHTMLABLEC(_,_,_,MO,a))::itr -> make_mathml_tree(TREE_MO a::otr,itr)
| otr,TEX_LITERAL(MHTMLABLEC(_,_,_,MI,a))::itr -> make_mathml_tree(TREE_MI a::otr,itr)
+ | otr,TEX_LITERAL(MHTMLABLEC(_,_,_,MF,a))::itr -> make_mathml_tree(TREE_MF a::otr,itr)
+ | otr,TEX_LITERAL(MHTMLABLEFC(_,_,_,MF,a,b))::itr -> make_mathml_tree(TREE_MFB (a,b)::otr,itr)
| otr,TEX_CURLY(crl)::itr -> make_mathml_tree(otr,crl@itr)
| otr,[] -> List.rev otr
| _ -> failwith "failed to render mathml"
@@ -16,5 +18,7 @@ let render_mathml_tree = function
TREE_MN s -> ""^s^""
| TREE_MI s -> ""^s^""
| TREE_MO s -> ""^s^""
+ | TREE_MF s -> ""^s^"⁡"
+ | TREE_MFB (s,b) -> ""^s^"⁡"^""^b^""
let render tree = try Some (Util.mapjoin render_mathml_tree (make_mathml_tree ([],tree))) with _ -> None
diff --git a/math/parser.mly b/math/parser.mly
index 29882fb..29200df 100644
--- a/math/parser.mly
+++ b/math/parser.mly
@@ -2,7 +2,7 @@
open Tex
open Render_info
- let sq_close_ri = HTMLABLEC(FONT_UFH,"]", "]")
+ let sq_close_ri = MHTMLABLEC(FONT_UFH,"]", "]",MO,"]")
%}
%token LITERAL DELIMITER
%token FUN_AR2 FUN_INFIX FUN_AR1 DECL FUN_AR1opt BIG FUN_AR2nb
diff --git a/math/render_info.mli b/math/render_info.mli
index d5e7fde..ee1c8b1 100644
--- a/math/render_info.mli
+++ b/math/render_info.mli
@@ -11,10 +11,13 @@ type math_class =
MN
| MI
| MO
+ | MF
+
type t =
HTMLABLEC of font_class * string * string
| HTMLABLEM of font_class * string * string
| HTMLABLE of font_class * string * string
| MHTMLABLEC of font_class * string * string * math_class * string
+ | MHTMLABLEFC of font_class * string * string * math_class * string * string
| HTMLABLE_BIG of string * string
| TEX_ONLY of string
diff --git a/math/texutil.ml b/math/texutil.ml
index 61c27de..efbf6a3 100644
--- a/math/texutil.ml
+++ b/math/texutil.ml
@@ -9,6 +9,7 @@ let tex_part = function
| HTMLABLEM (_,t,_) -> t
| HTMLABLEC (_,t,_) -> t
| MHTMLABLEC (_,t,_,_,_) -> t
+ | MHTMLABLEFC (_,t,_,_,_,_) -> t
| HTMLABLE_BIG (t,_) -> t
| TEX_ONLY t -> t