2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
19 (* internal functions *******************************************************)
21 let special = "\\{}$&#^_~%" (* LaTeX reserves these characters *)
27 let quote s c = try s ^ L.assoc c special with
28 | Not_found -> s ^ S.make 1 c
30 let rec out_item och = function
31 | T.Free s -> P.fprintf och "%s" s
32 | T.Text s -> P.fprintf och "%s" (X.fold_string quote "" s)
33 | T.Macro s -> P.fprintf och "\\%s%%\n" s
34 | T.Group t -> P.fprintf och "{%a}%%\n" out_text t
35 | T.Note s -> P.fprintf och "%% %s\n" s
37 (* interface functions ******************************************************)
40 L.iter (out_item och) t