| 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 String.length s = 1 && Char.code s.[0] < 128 then
+ s
+ else
+ match Utf8Macro.tex_of_unicode s with
+ Some s -> s ^ " "
+ | None -> s
in
- fixed_rendering s
+ fixed_rendering s
| Pres.Mspace _ -> fixed_rendering string_space
| Pres.Mrow (attrs, children) ->
let children' = List.map aux_mpres children in
[ id = IDENT -> id, None, []
| LPAREN; id = IDENT; vars = LIST1 possibly_typed_name; RPAREN ->
id, None, vars
+ | id = IDENT; vars = LIST1 possibly_typed_name -> id, None, vars
]
];
binder: [
let attrs = make_href xmlattrs xref in
(match l with
| `Symbol s -> Mpres.Mo (attrs, to_unicode s)
- | `Keyword s -> Mpres.Mo (attrs, to_unicode s)
+ | `Keyword s -> Mpres.Mtext (attrs, to_unicode s)
| `Number s -> Mpres.Mn (attrs, to_unicode s))
and aux_layout mathonly xref pos prec l =
let attrs = make_xref xref in
let hvbox = box Ast.HV
let hovbox = box Ast.HOV
let break = Ast.Layout Ast.Break
+let space = Ast.Literal (`Symbol " ")
let builtin_symbol s = Ast.Literal (`Symbol s)
let keyword k = add_keyword_attrs (Ast.Literal (`Keyword k))
match outty_opt with
| None -> []
| Some outty ->
- [ keyword "return"; break; remove_level_info (k outty)]
+ [ space; keyword "return"; space; break; remove_level_info (k outty)]
in
let indty_box =
match indty_opt with
| None -> []
- | Some (indty, href) -> [ keyword "in"; break; ident_w_href href indty ]
+ | Some (indty, href) -> [ space; keyword "in"; space; break; ident_w_href href indty ]
in
let match_box =
hvbox false false [
hvbox false true [
- hvbox false true [ keyword "match"; break; top_pos (k what) ];
+ hvbox false true [keyword "match"; space; break; top_pos (k what)];
break;
hvbox false true indty_box;
break;
hvbox false true outty_box
];
break;
- keyword "with"
+ space;
+ keyword "with";
+ space
]
in
let mk_case_pattern (head, href, vars) =
let (params, name, ty, body) = fst_fun in
hvbox false true ([
keyword "let";
+ space;
keyword rec_op;
+ space;
name] @
params @
(match ty with None -> [] | Some ty -> [builtin_symbol ":"; ty]) @
open Gramext
let tex_of_unicode s =
+(*CSC: ??????? What's the meaning of this function?
let contractions = ("\\Longrightarrow","=>") :: [] in
if String.length s <= 1 then s
else (* probably an extended unicode symbol *)
let s = Utf8Macro.tex_of_unicode s in
try List.assoc s contractions with Not_found -> s
+*) match Utf8Macro.tex_of_unicode s with
+ Some s -> s
+ | None -> s
let needs_brackets t =
let rec count_brothers = function
with Macro_not_found _ -> s
let tex_of_unicode s =
+ (*WARNING: the space below is a nbsp (0x00A0), not a normal space *)
+ if s = " " then Some ""
+ else
try
- "\\" ^ Hashtbl.find Utf8MacroTable.utf82macro s
- with Not_found -> s
+ Some ("\\" ^ Hashtbl.find Utf8MacroTable.utf82macro s)
+ with Not_found -> None
val unicode_of_tex: string -> string
(** ... the other way round *)
-val tex_of_unicode: string -> string
-
+val tex_of_unicode: string -> string option
<entry><emphasis role="bold">(</emphasis>&id; &id; [&id;]…<emphasis role="bold">)</emphasis></entry>
<entry>n-ary constructor (binds the n arguments)</entry>
</row>
+ <row>
+ <entry/>
+ <entry>|</entry>
+ <entry>&id; &id; [&id;]…</entry>
+ <entry>n-ary constructor (binds the n arguments)</entry>
+ </row>
</tbody>
</tgroup>
</table>