output \isasymbols;
authorwenzelm
Thu, 21 Oct 1999 18:43:06 +0200
changeset 7900 e62973fccc97
parent 7899 58c91ff28c3d
child 7901 c21c3d2256ef
output \isasymbols;
src/Pure/Thy/latex.ML
--- a/src/Pure/Thy/latex.ML	Thu Oct 21 18:42:38 1999 +0200
+++ b/src/Pure/Thy/latex.ML	Thu Oct 21 18:43:06 1999 +0200
@@ -18,6 +18,8 @@
 
 (* symbol output *)
 
+local
+
 val output_chr = fn
   " " => "~" |
   "\n" => "\\isanewline\n" |
@@ -34,8 +36,19 @@
   "\\" => "{\\isabackslash}" |
   c => c;
 
-(* FIXME replace \<forall> etc. *)
-val output_sym = implode o map output_chr o explode;
+fun output_sym s =
+  if size s = 1 then output_chr s
+  else
+    (case explode s of
+      cs as "\\" :: "<" :: "^" :: _ => implode (map output_chr cs)
+    | "\\" :: "<" :: cs => "{\\isasymbol" ^ implode (#1 (Library.split_last cs)) ^ "}"
+    | _ => sys_error "output_sym");
+
+in
+
+val output_syms = implode o map output_sym o Symbol.explode;
+
+end;
 
 
 (* token output *)
@@ -57,12 +70,12 @@
         else if T.is_kind T.Command tok then
           if s = "{{" then "{\\isabeginblock}"
           else if s = "}}" then "{\\isaendblock}"
-          else "\\isacommand{" ^ output_sym s ^ "}"
+          else "\\isacommand{" ^ output_syms s ^ "}"
         else if T.is_kind T.Keyword tok andalso Syntax.is_identifier s then
-          "\\isakeyword{" ^ output_sym s ^ "}"
-        else if T.is_kind T.String tok then output_sym (quote s)
-        else if T.is_kind T.Verbatim tok then output_sym (enclose "{*" "*}" s)
-        else output_sym s
+          "\\isakeyword{" ^ output_syms s ^ "}"
+        else if T.is_kind T.String tok then output_syms (quote s)
+        else if T.is_kind T.Verbatim tok then output_syms (enclose "{*" "*}" s)
+        else output_syms s
       end
   | output_tok (Markup (cmd, txt)) = "%\n\\isamarkup" ^ cmd ^ "{" ^ strip_blanks txt ^ "}\n"
   | output_tok (Verbatim txt) = "%\n" ^ strip_blanks txt ^ "\n";