Texutil.ml

From Knot Atlas
Jump to: navigation, search
(*
*)
(*This is texutil.ml modified from the form it comes with in mediawiki 1.4.7 *)
(*Scott modified it slightly to allow use of \bigcirc.*)
(*Scott further modified it allow use of Dror's package dbnsymb.*)
(*This requires putting dbnsymb.sty and dbnsymb.mf somewhere where LaTeX can find them.*)
open Parser
open Render_info
open Tex
open Util

let tex_part = function
    HTMLABLE (_,t,_) -> t
  | HTMLABLEM (_,t,_) -> t
  | HTMLABLEC (_,t,_) -> t
  | MHTMLABLEC (_,t,_,_,_) -> t
  | HTMLABLE_BIG (t,_) -> t
  | TEX_ONLY t -> t
let rec render_tex = function
    TEX_FQ (a,b,c) -> (render_tex a) ^ "_{" ^ (render_tex  b) ^ "}^{" ^ (render_tex  c) ^ "}"
  | TEX_DQ (a,b) -> (render_tex a) ^ "_{" ^ (render_tex  b) ^ "}"
  | TEX_UQ (a,b) -> (render_tex a) ^ "^{" ^ (render_tex  b) ^ "}"
  | TEX_LITERAL s -> tex_part s
  | TEX_FUN1 (f,a) -> "{" ^ f ^ " " ^ (render_tex a) ^ "}"
  | TEX_FUN1hl (f,_,a) -> "{" ^ f ^ " " ^ (render_tex a) ^ "}"
  | TEX_FUN1hf (f,_,a) -> "{" ^ f ^ " " ^ (render_tex a) ^ "}"
  | TEX_DECLh (f,_,a) -> "{" ^ f ^ "{" ^ (mapjoin render_tex a) ^ "}}"
  | TEX_FUN2 (f,a,b) -> "{" ^ f ^ " " ^ (render_tex a) ^ (render_tex b) ^ "}"
  | TEX_FUN2h (f,_,a,b) -> "{" ^ f ^ " " ^ (render_tex a) ^ (render_tex b) ^ "}"
  | TEX_FUN2sq (f,a,b) -> "{" ^ f ^ "[ " ^ (render_tex a) ^ "]" ^ (render_tex b) ^ "}"
  | TEX_CURLY (tl) -> "{" ^ (mapjoin render_tex tl) ^ "}"
  | TEX_INFIX (s,ll,rl) -> "{" ^ (mapjoin render_tex ll) ^ " " ^ s ^ "" ^ (mapjoin render_tex rl) ^ "}"
  | TEX_INFIXh (s,_,ll,rl) -> "{" ^ (mapjoin render_tex ll) ^ " " ^ s ^ "" ^ (mapjoin render_tex rl) ^ "}"
  | TEX_BOX (bt,s) -> "{"^bt^"{" ^ s ^ "}}"
  | TEX_BIG (bt,d) -> "{"^bt^(tex_part d)^"}"
  | TEX_MATRIX (t,rows) -> "{\\begin{"^t^"}"^(mapjoine "\\\\" (mapjoine "&" (mapjoin render_tex)) rows)^"\\end{"^t^"}}"
  | TEX_LR (l,r,tl) -> "\\left "^(tex_part l)^(mapjoin render_tex tl)^"\\right "^(tex_part r)

(* Dynamic loading*)
type encoding_t = LATIN1 | LATIN2 | UTF8

let modules_ams = ref false
let modules_nonascii = ref false
let modules_dbnsymb = ref false
let modules_encoding = ref UTF8

let tex_use_ams ()     = modules_ams := true
let tex_use_nonascii () = modules_nonascii := true
let tex_use_dbnsymb () = modules_dbnsymb := true
let tex_mod_reset ()   = (modules_ams := false; modules_nonascii := false; modules_dbnsymb := false; modules_encoding := UTF8)

let get_encoding = function
    UTF8 -> "\\usepackage{ucs}\n\\usepackage[utf8]{inputenc}\n"
  | LATIN1 -> "\\usepackage[latin1]{inputenc}\n"
  | LATIN2 -> "\\usepackage[latin2]{inputenc}\n"

let get_preface ()  = "\\nonstopmode\n\\documentclass[12pt]{article}\n" ^
              (if !modules_nonascii then get_encoding !modules_encoding else "") ^
              (if !modules_ams then "\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\usepackage{amssymb}\n" else "") ^
              (if !modules_dbnsymb then "\\usepackage{dbnsymb}\n" else "") ^
              "\\pagestyle{empty}\n\\begin{document}\n$$\n"
let get_footer  ()  = "\n$$\n\\end{document}\n"

let set_encoding = function
    "ISO-8859-1" -> modules_encoding := LATIN1
  | "iso-8859-1" -> modules_encoding := LATIN1
  | "ISO-8859-2" -> modules_encoding := LATIN2
  | _ -> modules_encoding := UTF8

(* Turn that into hash table lookup *)
exception Illegal_tex_function of string

let find = function
      "\\alpha"            -> LITERAL (HTMLABLEC (FONT_UF,  "\\alpha ", "α"))
    | "\\Alpha"            -> LITERAL (HTMLABLEC (FONT_RTI, "A", "Α"))
    | "\\beta"             -> LITERAL (HTMLABLEC (FONT_UF,  "\\beta ",  "β"))
    | "\\Beta"             -> LITERAL (HTMLABLEC (FONT_RTI, "B",  "Β"))
    | "\\gamma"            -> LITERAL (HTMLABLEC (FONT_UF,  "\\gamma ", "γ"))
    | "\\Gamma"            -> LITERAL (HTMLABLEC (FONT_RTI, "\\Gamma ", "Γ"))
    | "\\delta"            -> LITERAL (HTMLABLEC (FONT_UF,  "\\delta ", "δ"))
    | "\\Delta"            -> LITERAL (HTMLABLEC (FONT_RTI, "\\Delta ", "Δ"))
    | "\\epsilon"          -> LITERAL (HTMLABLEC (FONT_UF,  "\\epsilon ", "ε"))
    | "\\Epsilon"          -> LITERAL (HTMLABLEC (FONT_RTI, "E", "Ε"))
    | "\\varepsilon"       -> LITERAL (TEX_ONLY "\\varepsilon ")
    | "\\zeta"             -> LITERAL (HTMLABLEC (FONT_UF,  "\\zeta ", "ζ"))
    | "\\Zeta"             -> LITERAL (HTMLABLEC (FONT_RTI, "Z", "Ζ"))
    | "\\eta"              -> LITERAL (HTMLABLEC (FONT_UF,  "\\eta ", "η"))
    | "\\Eta"              -> LITERAL (HTMLABLEC (FONT_RTI, "H", "Η"))
    | "\\theta"            -> LITERAL (HTMLABLEC (FONT_UF,  "\\theta ", "θ"))
    | "\\Theta"            -> LITERAL (HTMLABLEC (FONT_RTI, "\\Theta ", "Θ"))
    | "\\vartheta"         -> LITERAL (HTMLABLE  (FONT_UF,  "\\vartheta ", "ϑ"))
    | "\\thetasym"         -> LITERAL (HTMLABLE  (FONT_UF,  "\\vartheta ", "ϑ"))
    | "\\iota"             -> LITERAL (HTMLABLEC (FONT_UF,  "\\iota ", "ι"))
    | "\\Iota"             -> LITERAL (HTMLABLEC (FONT_RTI, "I", "Ι"))
    | "\\kappa"            -> LITERAL (HTMLABLEC (FONT_UF,  "\\kappa ", "κ"))
    | "\\Kappa"            -> LITERAL (HTMLABLEC (FONT_RTI, "K", "Κ"))
    | "\\lambda"           -> LITERAL (HTMLABLEC (FONT_UF,  "\\lambda ", "λ"))
    | "\\Lambda"           -> LITERAL (HTMLABLEC (FONT_RTI, "\\Lambda ", "Λ"))
    | "\\mu"               -> LITERAL (HTMLABLEC (FONT_UF,  "\\mu ", "μ"))
    | "\\Mu"               -> LITERAL (HTMLABLEC (FONT_RTI, "M", "Μ"))
    | "\\nu"               -> LITERAL (HTMLABLEC (FONT_UF,  "\\nu ", "ν"))
    | "\\Nu"               -> LITERAL (HTMLABLEC (FONT_RTI, "N", "Ν"))
    | "\\pi"               -> LITERAL (HTMLABLEC (FONT_UF,  "\\pi ", "π"))
    | "\\Pi"               -> LITERAL (HTMLABLEC (FONT_RTI, "\\Pi ", "Π"))
    | "\\varpi"            -> LITERAL (TEX_ONLY "\\varpi ")
    | "\\rho"              -> LITERAL (HTMLABLEC (FONT_UF,  "\\rho ", "ρ"))
    | "\\Rho"              -> LITERAL (HTMLABLEC (FONT_RTI, "P", "Ρ"))
    | "\\varrho"           -> LITERAL (TEX_ONLY "\\varrho ")
    | "\\sigma"            -> LITERAL (HTMLABLEC (FONT_UF,  "\\sigma ", "σ"))
    | "\\Sigma"            -> LITERAL (HTMLABLEC (FONT_RTI, "\\Sigma ", "Σ"))
    | "\\varsigma"         -> LITERAL (TEX_ONLY "\\varsigma ")
    | "\\tau"              -> LITERAL (HTMLABLEC (FONT_UF,  "\\tau ", "τ"))
    | "\\Tau"              -> LITERAL (HTMLABLEC (FONT_RTI, "T", "Τ"))
    | "\\upsilon"          -> LITERAL (HTMLABLEC (FONT_UF,  "\\upsilon ", "υ"))
    | "\\Upsilon"          -> LITERAL (HTMLABLEC (FONT_RTI, "\\Upsilon ", "Υ"))
    | "\\phi"              -> LITERAL (HTMLABLEC (FONT_UF,  "\\phi ", "φ"))
    | "\\Phi"              -> LITERAL (HTMLABLEC (FONT_RTI, "\\Phi ", "Φ"))
    | "\\varphi"           -> LITERAL (TEX_ONLY "\\varphi ")
    | "\\chi"              -> LITERAL (HTMLABLEC (FONT_UF,  "\\chi ", "χ"))
    | "\\Chi"              -> LITERAL (HTMLABLEC (FONT_RTI, "X", "Χ"))
    | "\\psi"              -> LITERAL (HTMLABLEC (FONT_UF,  "\\psi ", "ψ"))
    | "\\Psi"              -> LITERAL (HTMLABLEC (FONT_RTI, "\\Psi ", "Ψ"))
    | "\\omega"            -> LITERAL (HTMLABLEC (FONT_UF,  "\\omega ", "ω"))
    | "\\Omega"            -> LITERAL (HTMLABLEC (FONT_RTI, "\\Omega ", "Ω"))
    | "\\xi"               -> LITERAL (HTMLABLEC (FONT_UF,  "\\xi ", "ξ"))
    | "\\Xi"               -> LITERAL (HTMLABLEC (FONT_RTI, "\\Xi ", "Ξ"))
    | "\\aleph"            -> LITERAL (HTMLABLE  (FONT_UF,  "\\aleph ", "ℵ"))
    | "\\alef"             -> LITERAL (HTMLABLE  (FONT_UF,  "\\aleph ", "ℵ"))
    | "\\alefsym"          -> LITERAL (HTMLABLE  (FONT_UF,  "\\aleph ", "ℵ"))
    | "\\larr"             -> LITERAL (HTMLABLEM (FONT_UF,  "\\leftarrow ", "←"))
    | "\\leftarrow"        -> LITERAL (HTMLABLEM (FONT_UF,  "\\leftarrow ", "←"))
    | "\\rarr"             -> LITERAL (HTMLABLEM (FONT_UF,  "\\rightarrow ", "→"))
    | "\\to"               -> LITERAL (HTMLABLEM (FONT_UF,  "\\to ", "→"))
    | "\\gets"             -> LITERAL (HTMLABLEM (FONT_UF,  "\\gets ", "←"))
    | "\\rightarrow"       -> LITERAL (HTMLABLEM (FONT_UF,  "\\rightarrow ", "→"))
    | "\\longleftarrow"    -> LITERAL (HTMLABLE  (FONT_UF,  "\\longleftarrow ", "←"))
    | "\\longrightarrow"   -> LITERAL (HTMLABLE  (FONT_UF,  "\\longrightarrow ", "→"))
    | "\\Larr"             -> LITERAL (HTMLABLE  (FONT_UF,  "\\Leftarrow ", "⇐"))
    | "\\lArr"             -> LITERAL (HTMLABLE  (FONT_UF,  "\\Leftarrow ", "⇐"))
    | "\\Leftarrow"        -> LITERAL (HTMLABLE  (FONT_UF,  "\\Leftarrow ", "⇐"))
    | "\\Rarr"             -> LITERAL (HTMLABLE  (FONT_UF,  "\\Rightarrow ", "⇒"))
    | "\\rArr"             -> LITERAL (HTMLABLE  (FONT_UF,  "\\Rightarrow ", "⇒"))
    | "\\Rightarrow"       -> LITERAL (HTMLABLEM (FONT_UF,  "\\Rightarrow ", "⇒"))
    | "\\mapsto"           -> LITERAL (HTMLABLE  (FONT_UF,  "\\mapsto ", "→"))
    | "\\longmapsto"       -> LITERAL (HTMLABLE  (FONT_UF,  "\\longmapsto ", "→"))
    | "\\Longleftarrow"    -> LITERAL (HTMLABLE  (FONT_UF,  "\\Longleftarrow ", "⇐"))
    | "\\Longrightarrow"   -> LITERAL (HTMLABLE  (FONT_UF,  "\\Longrightarrow ", "⇒"))
    | "\\uarr"             -> DELIMITER (HTMLABLEM (FONT_UF,  "\\uparrow ", "↑"))
    | "\\uparrow"          -> DELIMITER (HTMLABLEM (FONT_UF,  "\\uparrow ", "↑"))
    | "\\uArr"             -> DELIMITER (HTMLABLE  (FONT_UF,  "\\Uparrow ", "⇑"))
    | "\\Uarr"             -> DELIMITER (HTMLABLE  (FONT_UF,  "\\Uparrow ", "⇑"))
    | "\\Uparrow"          -> DELIMITER (HTMLABLE  (FONT_UF,  "\\Uparrow ", "⇑"))
    | "\\darr"             -> DELIMITER (HTMLABLEM (FONT_UF,  "\\downarrow ", "↓"))
    | "\\downarrow"        -> DELIMITER (HTMLABLEM (FONT_UF,  "\\downarrow ", "↓"))
    | "\\dArr"             -> DELIMITER (HTMLABLE  (FONT_UF,  "\\Downarrow ", "⇓"))
    | "\\Darr"             -> DELIMITER (HTMLABLE  (FONT_UF,  "\\Downarrow ", "⇓"))
    | "\\Downarrow"        -> DELIMITER (HTMLABLE  (FONT_UF,  "\\Downarrow ", "⇓"))
    | "\\updownarrow"      -> DELIMITER (TEX_ONLY "\\updownarrow ")
    | "\\Updownarrow"      -> DELIMITER (TEX_ONLY "\\Updownarrow ")
    | "\\leftrightarrow"   -> LITERAL (HTMLABLE  (FONT_UF,  "\\leftrightarrow ", "↔"))
    | "\\lrarr"            -> LITERAL (HTMLABLE  (FONT_UF,  "\\leftrightarrow ", "↔"))
    | "\\harr"             -> LITERAL (HTMLABLE  (FONT_UF,  "\\leftrightarrow ", "↔"))
    | "\\Leftrightarrow"   -> LITERAL (HTMLABLE  (FONT_UF,  "\\Leftrightarrow ", "⇔"))
    | "\\Lrarr"            -> LITERAL (HTMLABLE  (FONT_UF,  "\\Leftrightarrow ", "⇔"))
    | "\\Harr"             -> LITERAL (HTMLABLE  (FONT_UF,  "\\Leftrightarrow ", "⇔"))
    | "\\lrArr"            -> LITERAL (HTMLABLE  (FONT_UF,  "\\Leftrightarrow ", "⇔"))
    | "\\hAar"             -> LITERAL (HTMLABLE  (FONT_UF,  "\\Leftrightarrow ", "⇔"))
    | "\\Longleftrightarrow"->LITERAL (HTMLABLE  (FONT_UF,  "\\Longleftrightarrow ", "↔"))
    | "\\iff"              -> LITERAL (HTMLABLE  (FONT_UF,  "\\iff ", "↔"))
    | "\\ll"           -> LITERAL (TEX_ONLY "\\ll ")
    | "\\gg"           -> LITERAL (TEX_ONLY "\\gg ")
    | "\\div"          -> LITERAL (TEX_ONLY "\\div ")
    | "\\searrow"          -> LITERAL (TEX_ONLY "\\searrow ")
    | "\\nearrow"          -> LITERAL (TEX_ONLY "\\nearrow ")
    | "\\swarrow"          -> LITERAL (TEX_ONLY "\\swarrow ")
    | "\\nwarrow"          -> LITERAL (TEX_ONLY "\\nwarrow ")
    | "\\sim"              -> LITERAL (TEX_ONLY "\\sim ")
    | "\\simeq"            -> LITERAL (TEX_ONLY "\\simeq ")
    | "\\star"             -> LITERAL (TEX_ONLY "\\star ")
    | "\\ell"              -> LITERAL (TEX_ONLY "\\ell ")
    | "\\P"                -> LITERAL (TEX_ONLY "\\P ")
    | "\\smile"            -> LITERAL (TEX_ONLY "\\smile ")
    | "\\frown"            -> LITERAL (TEX_ONLY "\\frown ")
    | "\\bigcap"           -> LITERAL (TEX_ONLY "\\bigcap ")
    | "\\bigodot"          -> LITERAL (TEX_ONLY "\\bigodot ")
    | "\\bigcup"           -> LITERAL (TEX_ONLY "\\bigcup ")
    | "\\bigotimes"        -> LITERAL (TEX_ONLY "\\bigotimes ")
    | "\\coprod"           -> LITERAL (TEX_ONLY "\\coprod ")
    | "\\bigsqcup"         -> LITERAL (TEX_ONLY "\\bigsqcup ")
    | "\\bigoplus"         -> LITERAL (TEX_ONLY "\\bigoplus ")
    | "\\bigvee"           -> LITERAL (TEX_ONLY "\\bigvee ")
    | "\\biguplus"         -> LITERAL (TEX_ONLY "\\biguplus ")
    | "\\oint"             -> LITERAL (TEX_ONLY "\\oint ")
    | "\\bigwedge"         -> LITERAL (TEX_ONLY "\\bigwedge ")
    | "\\models"           -> LITERAL (TEX_ONLY "\\models ")
    | "\\vdash"            -> LITERAL (TEX_ONLY "\\vdash ")
    | "\\triangle"         -> LITERAL (TEX_ONLY "\\triangle ")
    | "\\wr"               -> LITERAL (TEX_ONLY "\\wr ")
    | "\\triangleleft"     -> LITERAL (TEX_ONLY "\\triangleleft ")
    | "\\triangleright"    -> LITERAL (TEX_ONLY "\\triangleright ")
    | "\\textvisiblespace" -> LITERAL (TEX_ONLY "\\textvisiblespace ")
    | "\\ker"              -> LITERAL (TEX_ONLY "\\ker ")
    | "\\lim"              -> LITERAL (TEX_ONLY "\\lim ")
    | "\\limsup"           -> LITERAL (TEX_ONLY "\\limsup ")
    | "\\liminf"           -> LITERAL (TEX_ONLY "\\liminf ")
    | "\\sup"              -> LITERAL (TEX_ONLY "\\sup ")
    | "\\Pr"               -> LITERAL (TEX_ONLY "\\Pr ")
    | "\\hom"              -> LITERAL (TEX_ONLY "\\hom ")
    | "\\arg"              -> LITERAL (TEX_ONLY "\\arg ")
    | "\\dim"              -> LITERAL (TEX_ONLY "\\dim ")
    | "\\inf"              -> LITERAL (TEX_ONLY "\\inf ")
    | "\\circ"             -> LITERAL (TEX_ONLY "\\circ ")
    | "\\hbar"             -> LITERAL (TEX_ONLY "\\hbar ")
    | "\\imath"            -> LITERAL (TEX_ONLY "\\imath ")
    | "\\lnot"             -> LITERAL (TEX_ONLY "\\lnot ")
    | "\\hookrightarrow"   -> LITERAL (TEX_ONLY "\\hookrightarrow ")
    | "\\hookleftarrow"    -> LITERAL (TEX_ONLY "\\hookleftarrow ")
    | "\\mp"               -> LITERAL (TEX_ONLY "\\mp ")
    | "\\approx"           -> LITERAL (TEX_ONLY "\\approx ")
    | "\\propto"           -> LITERAL (TEX_ONLY "\\propto ")
    | "\\flat"             -> LITERAL (TEX_ONLY "\\flat ")
    | "\\sharp"            -> LITERAL (TEX_ONLY "\\sharp ")
    | "\\natural"          -> LITERAL (TEX_ONLY "\\natural ")
    | "\\int"              -> LITERAL (HTMLABLE_BIG ("\\int ", "∫"))
    | "\\sum"              -> LITERAL (HTMLABLE_BIG ("\\sum ", "∑"))
    | "\\prod"             -> LITERAL (HTMLABLE_BIG ("\\prod ", "∏"))
    | "\\vdots"            -> LITERAL (TEX_ONLY "\\vdots ")
    | "\\limits"           -> LITERAL (TEX_ONLY "\\limits ")
    | "\\nolimits"         -> LITERAL (TEX_ONLY "\\nolimits ")
    | "\\top"              -> LITERAL (TEX_ONLY "\\top ")
    | "\\sin"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\sin ","sin"))
    | "\\cos"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\cos ","cos"))
    | "\\sinh"             -> LITERAL (HTMLABLEC(FONT_UFH,"\\sinh ","sinh"))
    | "\\cosh"             -> LITERAL (HTMLABLEC(FONT_UFH,"\\cosh ","cosh"))
    | "\\tan"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\tan ","tan"))
    | "\\tanh"             -> LITERAL (HTMLABLEC(FONT_UFH,"\\tanh ","tanh"))
    | "\\sec"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\sec ","sec"))
    | "\\csc"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\csc ","csc"))
    | "\\arcsin"           -> LITERAL (HTMLABLEC(FONT_UFH,"\\arcsin ","arcsin"))
    | "\\arctan"           -> LITERAL (HTMLABLEC(FONT_UFH,"\\arctan ","arctan"))
    | "\\arccos"           -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{arccos}}","arccos")))
    | "\\arccot"           -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{arccot}}","arccot")))
    | "\\arcsec"           -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{arcsec}}","arcsec")))
    | "\\arccsc"           -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{arccsc}}","arccsc")))
    | "\\sgn"              -> (tex_use_ams (); LITERAL (HTMLABLEC(FONT_UFH,"\\mathop{\\mathrm{sgn}}","sgn")))
    | "\\cot"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\cot ","cot"))
    | "\\coth"             -> LITERAL (HTMLABLEC(FONT_UFH,"\\coth ","coth"))
    | "\\log"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\log ", "log"))
    | "\\lg"               -> LITERAL (HTMLABLEC(FONT_UFH,"\\lg ", "lg"))
    | "\\ln"               -> LITERAL (HTMLABLEC(FONT_UFH,"\\ln ", "ln"))
    | "\\exp"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\exp ", "exp"))
    | "\\min"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\min ", "min"))
    | "\\max"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\max ", "max"))
    | "\\gcd"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\gcd ", "gcd"))
    | "\\deg"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\deg ", "deg"))
    | "\\det"              -> LITERAL (HTMLABLEC(FONT_UFH,"\\det ", "det"))
    | "\\bullet"           -> LITERAL (HTMLABLE (FONT_UFH, "\\bullet ", "•"))
    | "\\bull"             -> LITERAL (HTMLABLE (FONT_UFH, "\\bullet ", "•"))
    | "\\angle"            -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\angle ", "∠")))
    | "\\dagger"           -> LITERAL (HTMLABLEM(FONT_UFH, "\\dagger ", "†"))
    | "\\ddagger"          -> LITERAL (HTMLABLEM(FONT_UFH, "\\ddagger ", "‡"))
    | "\\Dagger"           -> LITERAL (HTMLABLEM(FONT_UFH, "\\ddagger ", "‡"))
    | "\\colon"            -> LITERAL (HTMLABLEC(FONT_UFH, "\\colon ", ":"))
    | "\\Vert"             -> DELIMITER (HTMLABLEM(FONT_UFH, "\\Vert ", "||"))
    | "\\vert"             -> DELIMITER (HTMLABLEM(FONT_UFH, "\\vert ", "|"))
    | "\\wp"               -> LITERAL (HTMLABLE (FONT_UF,  "\\wp ", "℘"))
    | "\\weierp"           -> LITERAL (HTMLABLE (FONT_UF,  "\\wp ", "℘"))
    | "\\wedge"            -> LITERAL (HTMLABLE (FONT_UF,  "\\wedge ", "∧"))
    | "\\and"              -> LITERAL (HTMLABLE (FONT_UF,  "\\land ", "∧"))
    | "\\land"             -> LITERAL (HTMLABLE (FONT_UF,  "\\land ", "∧"))
    | "\\vee"              -> LITERAL (HTMLABLE (FONT_UF,  "\\vee ", "∨"))
    | "\\or"               -> LITERAL (HTMLABLE (FONT_UF,  "\\lor ", "∨"))
    | "\\lor"              -> LITERAL (HTMLABLE (FONT_UF,  "\\lor ", "∨"))
    | "\\sub"              -> LITERAL (HTMLABLE (FONT_UF,  "\\subset ", "⊂"))
    | "\\supe"             -> LITERAL (HTMLABLE (FONT_UF,  "\\supseteq ", "⊇"))
    | "\\sube"             -> LITERAL (HTMLABLE (FONT_UF,  "\\subseteq ", "⊆"))
    | "\\supset"           -> LITERAL (HTMLABLE (FONT_UF,  "\\supset ", "⊃"))
    | "\\subset"           -> LITERAL (HTMLABLE (FONT_UF,  "\\subset ", "⊂"))
    | "\\supseteq"         -> LITERAL (HTMLABLE (FONT_UF,  "\\supseteq ", "⊇"))
    | "\\subseteq"         -> LITERAL (HTMLABLE (FONT_UF,  "\\subseteq ", "⊆"))
    | "\\sqsupset"         -> (tex_use_ams (); LITERAL (TEX_ONLY "\\sqsupset "))
    | "\\sqsubset"         -> (tex_use_ams (); LITERAL (TEX_ONLY "\\sqsubset "))
    | "\\sqsupseteq"       -> (tex_use_ams (); LITERAL (TEX_ONLY "\\sqsupseteq "))
    | "\\sqsubseteq"       -> (tex_use_ams (); LITERAL (TEX_ONLY "\\sqsubseteq "))
    | "\\perp"             -> LITERAL (HTMLABLE (FONT_UF,  "\\perp ", "⊥"))
    | "\\bot"              -> LITERAL (HTMLABLE (FONT_UF,  "\\bot ", "⊥"))
    | "\\lfloor"           -> DELIMITER (HTMLABLE (FONT_UF,  "\\lfloor ", "⌊"))
    | "\\rfloor"           -> DELIMITER (HTMLABLE (FONT_UF,  "\\rfloor ", "⌋"))
    | "\\lceil"            -> DELIMITER (HTMLABLE (FONT_UF,  "\\lceil ", "⌈"))
    | "\\rceil"            -> DELIMITER (HTMLABLE (FONT_UF,  "\\rceil ", "⌉"))
    | "\\lbrace"           -> DELIMITER (HTMLABLEC(FONT_UFH, "\\lbrace ", "{"))
    | "\\rbrace"           -> DELIMITER (HTMLABLEC(FONT_UFH, "\\rbrace ", "}"))
    | "\\infty"            -> LITERAL (HTMLABLEM(FONT_UF,  "\\infty ", "∞"))
    | "\\infin"            -> LITERAL (HTMLABLEM(FONT_UF,  "\\infty ", "∞"))
    | "\\isin"             -> LITERAL (HTMLABLE (FONT_UF,  "\\in ", "∈"))
    | "\\in"               -> LITERAL (HTMLABLE (FONT_UF,  "\\in ", "∈"))
    | "\\ni"               -> LITERAL (HTMLABLE (FONT_UF,  "\\ni ", "∋"))
    | "\\notin"            -> LITERAL (HTMLABLE (FONT_UF,  "\\notin ", "∉"))
    | "\\smallsetminus"    -> (tex_use_ams (); LITERAL (TEX_ONLY "\\smallsetminus "))
    | "\\And"              -> (tex_use_ams (); LITERAL (HTMLABLEM(FONT_UFH, "\\And ", " & ")))
    | "\\forall"           -> LITERAL (HTMLABLE (FONT_UFH, "\\forall ", "∀"))
    | "\\exists"           -> LITERAL (HTMLABLE (FONT_UFH, "\\exists ", "∃"))
    | "\\exist"            -> LITERAL (HTMLABLE (FONT_UFH, "\\exists ", "∃"))
    | "\\equiv"            -> LITERAL (HTMLABLEM(FONT_UFH, "\\equiv ", "≡"))
    | "\\ne"               -> LITERAL (HTMLABLEM(FONT_UFH, "\\neq ", "≠"))
    | "\\neq"              -> LITERAL (HTMLABLEM(FONT_UFH, "\\neq ", "≠"))
    | "\\Re"               -> LITERAL (HTMLABLE (FONT_UF,  "\\Re ", "ℜ"))
    | "\\real"             -> LITERAL (HTMLABLE (FONT_UF,  "\\Re ", "ℜ"))
    | "\\Im"               -> LITERAL (HTMLABLE (FONT_UF,  "\\Im ", "ℑ"))
    | "\\image"            -> LITERAL (HTMLABLE (FONT_UF,  "\\Im ", "ℑ"))
    | "\\prime"            -> LITERAL (HTMLABLE (FONT_UFH,"\\prime ", "′"))
    | "\\backslash"        -> DELIMITER (HTMLABLEM(FONT_UFH,"\\backslash ", "\\"))
    | "\\setminus"         -> LITERAL (HTMLABLEM(FONT_UFH,"\\setminus ", "\\"))
    | "\\times"            -> LITERAL (HTMLABLEM(FONT_UFH,"\\times ", "×"))
    | "\\pm"               -> LITERAL (HTMLABLEM(FONT_UFH,"\\pm ", "±"))
    | "\\plusmn"           -> LITERAL (HTMLABLEM(FONT_UFH,"\\pm ", "±"))
    | "\\cdot"             -> LITERAL (HTMLABLE (FONT_UFH,"\\cdot ", "⋅"))
    | "\\AA"               -> LITERAL (HTMLABLE (FONT_UFH,"\\AA ", "Å"))
    | "\\cdots"            -> LITERAL (HTMLABLE (FONT_UFH,"\\cdots ", "⋅⋅⋅"))
    | "\\sdot"             -> LITERAL (HTMLABLE (FONT_UFH,"\\cdot ", "⋅"))
    | "\\oplus"            -> LITERAL (HTMLABLE (FONT_UF, "\\oplus ", "⊕"))
    | "\\otimes"           -> LITERAL (HTMLABLE (FONT_UF, "\\otimes ", "⊗"))
    | "\\cap"              -> LITERAL (HTMLABLEM(FONT_UF, "\\cap ", "∩"))
    | "\\cup"              -> LITERAL (HTMLABLE (FONT_UF, "\\cup ", "∪"))
    | "\\sqcap"            -> (tex_use_ams (); LITERAL (TEX_ONLY "\\sqcap "))
    | "\\sqcup"            -> (tex_use_ams (); LITERAL (TEX_ONLY "\\sqcup "))
    | "\\empty"            -> LITERAL (HTMLABLE (FONT_UF, "\\emptyset ", "∅"))
    | "\\emptyset"         -> LITERAL (HTMLABLE (FONT_UF, "\\emptyset ", "∅"))
    | "\\O"                -> LITERAL (HTMLABLE (FONT_UF, "\\emptyset ", "∅"))
    | "\\S"                -> LITERAL (HTMLABLEM(FONT_UFH,"\\S ", "§"))
    | "\\sect"             -> LITERAL (HTMLABLEM(FONT_UFH,"\\S ", "§"))
    | "\\nabla"            -> LITERAL (HTMLABLE (FONT_UF, "\\nabla ", "∇"))
    | "\\geq"              -> LITERAL (HTMLABLE (FONT_UFH,"\\geq ", "≥"))
    | "\\ge"               -> LITERAL (HTMLABLE (FONT_UFH,"\\geq ", "≥"))
    | "\\leq"              -> LITERAL (HTMLABLE (FONT_UFH,"\\leq ", "≤"))
    | "\\le"               -> LITERAL (HTMLABLE (FONT_UFH,"\\leq ", "≤"))
    | "\\cong"             -> LITERAL (HTMLABLE (FONT_UF, "\\cong ", "≅"))
    | "\\ang"              -> LITERAL (HTMLABLE (FONT_UF, "\\angle ", "∠"))
    | "\\part"             -> LITERAL (HTMLABLEM(FONT_UF, "\\partial ", "∂"))
    | "\\partial"          -> LITERAL (HTMLABLEM(FONT_UF, "\\partial ", "∂"))
    | "\\ldots"            -> LITERAL (HTMLABLEM(FONT_UFH,"\\ldots ", "..."))
    | "\\dots"             -> LITERAL (HTMLABLEM(FONT_UFH,"\\dots ", "..."))
    | "\\quad"             -> LITERAL (HTMLABLE (FONT_UF, "\\quad ","  "))
    | "\\qquad"            -> LITERAL (HTMLABLE (FONT_UF, "\\qquad ","    "))
    | "\\mid"              -> LITERAL (HTMLABLEM(FONT_UFH,"\\mid ", " | "))
    | "\\neg"              -> LITERAL (HTMLABLEM(FONT_UFH,"\\neg ", "¬"))
    | "\\langle"           -> DELIMITER (HTMLABLE (FONT_UFH,"\\langle ","〈"))
    | "\\rangle"           -> DELIMITER (HTMLABLE (FONT_UFH,"\\rangle ","〉"))
    | "\\lang"             -> DELIMITER (HTMLABLE (FONT_UFH,"\\langle ","〈"))
    | "\\rang"             -> DELIMITER (HTMLABLE (FONT_UFH,"\\rangle ","〉"))
    | "\\lbrack"           -> DELIMITER (HTMLABLEC(FONT_UFH,"[","["))
    | "\\rbrack"           -> DELIMITER (HTMLABLEC(FONT_UFH,"]","]"))
    | "\\ddots"            -> LITERAL (TEX_ONLY "\\ddots ")
    | "\\clubs"            -> LITERAL (TEX_ONLY "\\clubsuit ")
    | "\\clubsuit"         -> LITERAL (TEX_ONLY "\\clubsuit ")
    | "\\spades"           -> LITERAL (TEX_ONLY "\\spadesuit ")
    | "\\spadesuit"        -> LITERAL (TEX_ONLY "\\spadesuit ")
    | "\\hearts"           -> LITERAL (TEX_ONLY "\\heartsuit ")
    | "\\heartsuit"        -> LITERAL (TEX_ONLY "\\heartsuit ")
    | "\\diamonds"         -> LITERAL (TEX_ONLY "\\diamondsuit ")
    | "\\diamondsuit"      -> LITERAL (TEX_ONLY "\\diamondsuit ")
    | "\\implies"          -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\implies ", "⇒")))
    | "\\mod"              -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mod ", "mod")))
    | "\\Diamond"          -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\Diamond ", "◊")))
    | "\\dotsb"            -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\dotsb ", "⋅⋅⋅")))
    | "\\reals"            -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "<b>R</b>")))
    | "\\Reals"            -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "<b>R</b>")))
    | "\\R"                -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "<b>R</b>")))
    | "\\cnums"            -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{C}", "<b>C</b>")))
    | "\\Complex"          -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{C}", "<b>C</b>")))
    | "\\Z"                -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{Z}", "<b>Z</b>")))
    | "\\natnums"          -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{N}", "<b>N</b>")))
    | "\\N"                -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{N}", "<b>N</b>")))
    | "\\lVert"            -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\lVert ", "||")))
    | "\\rVert"            -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\rVert ", "||")))
    | "\\nmid"             -> (tex_use_ams (); LITERAL (TEX_ONLY "\\nmid "))
    | "\\lesssim"          -> (tex_use_ams (); LITERAL (TEX_ONLY "\\lesssim "))
    | "\\ngeq"             -> (tex_use_ams (); LITERAL (TEX_ONLY "\\ngeq "))
    | "\\smallsmile"       -> (tex_use_ams (); LITERAL (TEX_ONLY "\\smallsmile "))
    | "\\smallfrown"       -> (tex_use_ams (); LITERAL (TEX_ONLY "\\smallfrown "))
    | "\\nleftarrow"       -> (tex_use_ams (); LITERAL (TEX_ONLY "\\nleftarrow "))
    | "\\nrightarrow"      -> (tex_use_ams (); LITERAL (TEX_ONLY "\\nrightarrow "))
    | "\\trianglelefteq"   -> (tex_use_ams (); LITERAL (TEX_ONLY "\\trianglelefteq "))
    | "\\trianglerighteq"  -> (tex_use_ams (); LITERAL (TEX_ONLY "\\trianglerighteq "))
    | "\\square"           -> (tex_use_ams (); LITERAL (TEX_ONLY "\\square "))
    | "\\checkmark"        -> (tex_use_ams (); LITERAL (TEX_ONLY "\\checkmark "))
    | "\\supsetneq"        -> (tex_use_ams (); LITERAL (TEX_ONLY "\\supsetneq "))
    | "\\subsetneq"        -> (tex_use_ams (); LITERAL (TEX_ONLY "\\subsetneq "))
    | "\\Box"              -> (tex_use_ams (); LITERAL (TEX_ONLY "\\Box "))
    | "\\nleq"             -> (tex_use_ams (); LITERAL (TEX_ONLY "\\nleq "))
    | "\\upharpoonright"   -> (tex_use_ams (); LITERAL (TEX_ONLY "\\upharpoonright "))
    | "\\upharpoonleft"    -> (tex_use_ams (); LITERAL (TEX_ONLY "\\upharpoonleft "))
    | "\\downharpoonright" -> (tex_use_ams (); LITERAL (TEX_ONLY "\\downharpoonright "))
    | "\\downharpoonleft"  -> (tex_use_ams (); LITERAL (TEX_ONLY "\\downharpoonleft "))
    | "\\rightharpoonup"   -> (tex_use_ams (); LITERAL (TEX_ONLY "\\rightharpoonup "))
    | "\\rightharpoondown" -> (tex_use_ams (); LITERAL (TEX_ONLY "\\rightharpoondown "))
    | "\\leftharpoonup"    -> (tex_use_ams (); LITERAL (TEX_ONLY "\\leftharpoonup "))
    | "\\leftharpoondown"  -> (tex_use_ams (); LITERAL (TEX_ONLY "\\leftharpoondown "))
    | "\\nless"            -> (tex_use_ams (); LITERAL (TEX_ONLY "\\nless "))
    | "\\Vdash"            -> (tex_use_ams (); LITERAL (TEX_ONLY "\\Vdash "))
    | "\\vDash"            -> (tex_use_ams (); LITERAL (TEX_ONLY "\\vDash "))
    | "\\varkappa"         -> (tex_use_ams (); LITERAL (TEX_ONLY "\\varkappa "))
    | "\\digamma"          -> (tex_use_ams (); LITERAL (TEX_ONLY "\\digamma "))
    | "\\beth"             -> (tex_use_ams (); LITERAL (TEX_ONLY "\\beth "))
    | "\\daleth"           -> (tex_use_ams (); LITERAL (TEX_ONLY "\\daleth "))
    | "\\gimel"            -> (tex_use_ams (); LITERAL (TEX_ONLY "\\gimel "))
    | "\\complement"       -> (tex_use_ams (); LITERAL (TEX_ONLY "\\complement "))
    | "\\eth"              -> (tex_use_ams (); LITERAL (TEX_ONLY "\\eth "))
    | "\\hslash"           -> (tex_use_ams (); LITERAL (TEX_ONLY "\\hslash "))
    | "\\mho"              -> (tex_use_ams (); LITERAL (TEX_ONLY "\\mho "))
    | "\\Finv"             -> (tex_use_ams (); LITERAL (TEX_ONLY "\\Finv "))
    | "\\Game"             -> (tex_use_ams (); LITERAL (TEX_ONLY "\\Game "))
    | "\\varlimsup"        -> (tex_use_ams (); LITERAL (TEX_ONLY "\\varlimsup "))
    | "\\varliminf"        -> (tex_use_ams (); LITERAL (TEX_ONLY "\\varliminf "))
    | "\\varinjlim"        -> (tex_use_ams (); LITERAL (TEX_ONLY "\\varinjlim "))
    | "\\varprojlim"       -> (tex_use_ams (); LITERAL (TEX_ONLY "\\varprojlim "))
    | "\\injlim"           -> (tex_use_ams (); LITERAL (TEX_ONLY "\\injlim "))
    | "\\projlim"          -> (tex_use_ams (); LITERAL (TEX_ONLY "\\projlim "))
    | "\\iint"             -> (tex_use_ams (); LITERAL (TEX_ONLY "\\iint "))
    | "\\iiint"            -> (tex_use_ams (); LITERAL (TEX_ONLY "\\iiint "))
    | "\\iiiint"           -> (tex_use_ams (); LITERAL (TEX_ONLY "\\iiiint "))
    | "\\varnothing"       -> (tex_use_ams (); LITERAL (TEX_ONLY "\\varnothing "))
    | "\\left"             -> LEFT
    | "\\right"            -> RIGHT
    | "\\hat"              -> FUN_AR1 "\\hat "
    | "\\widehat"          -> FUN_AR1 "\\widehat "
    | "\\overline"         -> FUN_AR1 "\\overline "
    | "\\overbrace"        -> FUN_AR1 "\\overbrace "
    | "\\underline"        -> FUN_AR1 "\\underline "
    | "\\underbrace"       -> FUN_AR1 "\\underbrace "
    | "\\overleftarrow"    -> FUN_AR1 "\\overleftarrow "
    | "\\overrightarrow"   -> FUN_AR1 "\\overrightarrow "
    | "\\overleftrightarrow"->FUN_AR1 "\\overleftrightarrow "
    | "\\check"            -> FUN_AR1 "\\check "
    | "\\acute"            -> FUN_AR1 "\\acute "
    | "\\grave"            -> FUN_AR1 "\\grave "
    | "\\bar"              -> FUN_AR1 "\\bar "
    | "\\vec"              -> FUN_AR1 "\\vec "
    | "\\dot"              -> FUN_AR1 "\\dot "
    | "\\ddot"             -> FUN_AR1 "\\ddot "
    | "\\breve"            -> FUN_AR1 "\\breve "
    | "\\tilde"            -> FUN_AR1 "\\tilde "
    | "\\not"              -> FUN_AR1 "\\not "
    | "\\choose"           -> FUN_INFIX "\\choose "
    | "\\atop"             -> FUN_INFIX "\\atop "
    | "\\binom"            -> FUN_AR2 "\\binom "
    | "\\frac"             -> FUN_AR2h ("\\frac ", fun num den -> Html.html_render [num], "<hr style=\"{background: black}\"/>", Html.html_render [den])
    | "\\cfrac"            -> (tex_use_ams (); FUN_AR2h ("\\cfrac ", fun num den -> Html.html_render [num], "<hr style=\"{background: black}\">", Html.html_render [den]))
    | "\\over"             -> FUN_INFIXh ("\\over ", fun num den -> Html.html_render num, "<hr style=\"{background: black}\"/>", Html.html_render den)
    | "\\sqrt"             -> FUN_AR1 "\\sqrt "
    | "\\pmod"             -> FUN_AR1hl ("\\pmod ", ("(mod ", ")"))
    | "\\bmod"             -> FUN_AR1hl ("\\bmod ", ("mod ", ""))
    | "\\emph"             -> FUN_AR1 "\\emph "
    | "\\texttt"           -> FUN_AR1 "\\texttt "
    | "\\textbf"           -> FUN_AR1 "\\textbf "
    | "\\textit"           -> FUN_AR1hf ("\\textit ", FONTFORCE_IT)
    | "\\textrm"           -> FUN_AR1hf ("\\textrm ", FONTFORCE_RM)
    | "\\rm"               -> DECLh ("\\rm ", FONTFORCE_RM)
    | "\\it"               -> DECLh ("\\it ", FONTFORCE_IT)
    | "\\cal"              -> DECL "\\cal "
    | "\\bf"               -> DECL "\\bf "
    | "\\big"              -> BIG "\\big "
    | "\\Big"              -> BIG "\\Big "
    | "\\bigg"             -> BIG "\\bigg "
    | "\\Bigg"             -> BIG "\\Bigg "
    | "\\mathit"           -> (tex_use_ams (); FUN_AR1hf ("\\mathit ", FONTFORCE_IT))
    | "\\mathrm"           -> (tex_use_ams (); FUN_AR1hf ("\\mathrm ", FONTFORCE_RM))
    | "\\mathop"           -> (tex_use_ams (); FUN_AR1 "\\mathop ")
    | "\\boldsymbol"       -> (tex_use_ams (); FUN_AR1 "\\boldsymbol ")
    | "\\bold"             -> (tex_use_ams (); FUN_AR1 "\\mathbf ")
    | "\\Bbb"              -> (tex_use_ams (); FUN_AR1 "\\mathbb ")
    | "\\mathbf"           -> (tex_use_ams (); FUN_AR1 "\\mathbf ")
    | "\\mathsf"           -> (tex_use_ams (); FUN_AR1 "\\mathsf ")
    | "\\mathcal"          -> (tex_use_ams (); FUN_AR1 "\\mathcal ")
    | "\\mathbb"           -> (tex_use_ams (); FUN_AR1 "\\mathbb ")
    | "\\mathfrak"         -> (tex_use_ams (); FUN_AR1 "\\mathfrak ")
    | "\\operatorname"     -> (tex_use_ams (); FUN_AR1 "\\operatorname ")
    | "\\mbox"             -> raise (Failure "malformatted \\mbox")
    | "\\vbox"             -> raise (Failure "malformatted \\vbox")
    | "\\hbox"             -> raise (Failure "malformatted \\hbox")
(*Scott's modifications begin here.*)
    | "\\bigcirc"          -> (tex_use_ams (); LITERAL (TEX_ONLY "\\bigcirc "))
    | "\\doublepoint"            -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\doublepoint ")) 
    | "\\overcrossing"           -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\overcrossing "))
    | "\\undercrossing"          -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\undercrossing "))
    | "\\fourwheel"              -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\fourwheel "))   
    | "\\pentagon"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\pentagon "))    
    | "\\isolatedchord"          -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\isolatedchord "))
    | "\\righttrefoil"           -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\righttrefoil "))
    | "\\OpenHopfUp"             -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\OpenHopfUp "))  
    | "\\dbnframe"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\dbnframe "))    
    | "\\HopfLink"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\HopfLink "))    
    | "\\botright"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\botright "))    
    | "\\twowheel"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\twowheel "))    
    | "\\tetrahedron"            -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\tetrahedron ")) 
    | "\\stonehenge"             -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\stonehenge "))  
    | "\\lefttrefoil"            -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\lefttrefoil ")) 
    | "\\slashoverback"          -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\slashoverback "))
    | "\\backoverslash"          -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\backoverslash "))
    | "\\hsmoothing"             -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\hsmoothing "))  
    | "\\SGraph"                 -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\SGraph "))      
    | "\\TGraph"                 -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\TGraph "))      
    | "\\UGraph"                 -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\UGraph "))      
    | "\\righttwist"             -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\righttwist "))  
    | "\\lefttwist"              -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\lefttwist "))   
    | "\\MobiusSymbol"           -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\MobiusSymbol "))
    | "\\Associator"             -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\Associator "))  
    | "\\hexagon"                -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\hexagon "))     
    | "\\inup"                   -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\inup "))        
    | "\\isotopic"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\isotopic "))    
    | "\\dumbbell"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\dumbbell "))    
    | "\\OpenHopf"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\OpenHopf "))    
    | "\\wiggle"                 -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\wiggle "))      
    | "\\ThetaGraph"             -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\ThetaGraph "))  
    | "\\IGraph"                 -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\IGraph "))      
    | "\\HGraph"                 -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\HGraph "))      
    | "\\XGraph"                 -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\XGraph "))      
    | "\\crossing"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\crossing "))    
    | "\\smoothing"              -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\smoothing "))   
    | "\\YGraph"                 -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\YGraph "))      
    | "\\TwistedY"               -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\TwistedY "))    
    | "\\HSaddleSymbol"          -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\HSaddleSymbol "))
    | "\\ISaddleSymbol"          -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\ISaddleSymbol "))
    | "\\CanadianFlag"           -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\CanadianFlag "))
    | "\\fourinwheel"            -> (tex_use_dbnsymb (); LITERAL (TEX_ONLY "\\fourinwheel ")) 
(*Scott's modifications end here.*)
    | s                    -> raise (Illegal_tex_function s)
(*
*)