let string_space = " "
let string_space_len = String.length string_space
-let string_indent = string_space
+let string_indent = (* string_space *) ""
let string_indent_len = String.length string_indent
let string_ink = "##"
let string_ink_len = String.length string_ink
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 choose_action size markup =
let max_size = max_int in
let rec aux_box =
function
| 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
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)