X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fcontent_pres%2FboxPp.ml;h=ca51c0ed3e46d8c14730301bd7640bfb598d6a7e;hb=47988107f44566d53fd5a71fd64a015bbf24a380;hp=53149877ea73a1eb71e3c5b2f75ec4f7f78df552;hpb=f45affb2ac7e6c1b35350642f8028ca48a781fbe;p=helm.git diff --git a/helm/software/components/content_pres/boxPp.ml b/helm/software/components/content_pres/boxPp.ml index 53149877e..ca51c0ed3 100644 --- a/helm/software/components/content_pres/boxPp.ml +++ b/helm/software/components/content_pres/boxPp.ml @@ -93,7 +93,7 @@ let fixed_rendering s = let s_len = String.length s in (fun _ -> s_len, [s]) -let render_to_strings choose_action size markup = +let render_to_strings ?(map_unicode_to_tex = true) choose_action size markup = let max_size = max_int in let rec aux_box = function @@ -193,11 +193,15 @@ let render_to_strings choose_action size markup = | Pres.Mgliph (_, s) -> fixed_rendering s | Pres.Mo (_, s) -> let s = - if String.length s > 1 then - (* heuristic to guess which operators need to be expanded in their - * TeX like format *) - Utf8Macro.tex_of_unicode s ^ " " - else s + if map_unicode_to_tex then begin + if String.length s = 1 && Char.code s.[0] < 128 then + s + else + match Utf8Macro.tex_of_unicode s with + | Some s -> s ^ " " + | None -> s + end else + s in fixed_rendering s | Pres.Mspace _ -> fixed_rendering string_space @@ -236,6 +240,7 @@ let render_to_strings choose_action size markup = in snd (aux_mpres markup size) -let render_to_string choose_action size markup = - String.concat "\n" (render_to_strings choose_action size markup) +let render_to_string ?map_unicode_to_tex choose_action size markup = + String.concat "\n" + (render_to_strings ?map_unicode_to_tex choose_action size markup)