{-# LANGUAGE OverloadedStrings #-}
{-
Copyright (C) 2009-2022 John MacFarlane <jgm@berkeley.edu>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-}

{- | Lookup tables for TeX commands.
-}

module Text.TeXMath.Readers.TeX.Commands
  ( styleOps
  , textOps
  , enclosures
  , operators
  , symbols
  , siUnitMap
  )
where

import qualified Data.Map as M
import Text.TeXMath.Types
import Text.TeXMath.Unicode.ToTeX (symbolMap)
import Data.Text (Text)
import Data.Ratio ((%))

-- Note: cal and scr are treated the same way, as unicode is lacking such two different sets for those.
styleOps :: M.Map Text ([Exp] -> Exp)
styleOps :: Map Text ([Exp] -> Exp)
styleOps = [(Text, [Exp] -> Exp)] -> Map Text ([Exp] -> Exp)
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
          [ ("\\mathrm",     TextType -> [Exp] -> Exp
EStyled TextType
TextNormal)
          , ("\\mathup",     TextType -> [Exp] -> Exp
EStyled TextType
TextNormal)
          , ("\\mathbf",     TextType -> [Exp] -> Exp
EStyled TextType
TextBold)
          , ("\\boldsymbol", TextType -> [Exp] -> Exp
EStyled TextType
TextBold)
          , ("\\bm",         TextType -> [Exp] -> Exp
EStyled TextType
TextBold)
          , ("\\symbf",      TextType -> [Exp] -> Exp
EStyled TextType
TextBold)
          , ("\\mathbold",   TextType -> [Exp] -> Exp
EStyled TextType
TextBold)
          , ("\\pmb",        TextType -> [Exp] -> Exp
EStyled TextType
TextBold)
          , ("\\mathbfup",   TextType -> [Exp] -> Exp
EStyled TextType
TextBold)
          , ("\\mathit",     TextType -> [Exp] -> Exp
EStyled TextType
TextItalic)
          , ("\\mathtt",     TextType -> [Exp] -> Exp
EStyled TextType
TextMonospace)
          , ("\\texttt",     TextType -> [Exp] -> Exp
EStyled TextType
TextMonospace)
          , ("\\mathsf",     TextType -> [Exp] -> Exp
EStyled TextType
TextSansSerif)
          , ("\\mathsfup",   TextType -> [Exp] -> Exp
EStyled TextType
TextSansSerif)
          , ("\\mathbb",     TextType -> [Exp] -> Exp
EStyled TextType
TextDoubleStruck)
          , ("\\mathds",     TextType -> [Exp] -> Exp
EStyled TextType
TextDoubleStruck) -- mathds package
          , ("\\mathcal",    TextType -> [Exp] -> Exp
EStyled TextType
TextScript)
          , ("\\mathscr",    TextType -> [Exp] -> Exp
EStyled TextType
TextScript)
          , ("\\mathfrak",   TextType -> [Exp] -> Exp
EStyled TextType
TextFraktur)
          , ("\\mathbfit",   TextType -> [Exp] -> Exp
EStyled TextType
TextBoldItalic)
          , ("\\mathbfsfup", TextType -> [Exp] -> Exp
EStyled TextType
TextSansSerifBold)
          , ("\\mathbfsfit", TextType -> [Exp] -> Exp
EStyled TextType
TextSansSerifBoldItalic)
          , ("\\mathbfscr",  TextType -> [Exp] -> Exp
EStyled TextType
TextBoldScript)
          , ("\\mathbffrak", TextType -> [Exp] -> Exp
EStyled TextType
TextBoldFraktur)
          , ("\\mathbfcal",  TextType -> [Exp] -> Exp
EStyled TextType
TextBoldScript)
          , ("\\mathsfit",   TextType -> [Exp] -> Exp
EStyled TextType
TextSansSerifItalic)
          ]

textOps :: M.Map Text (Text -> Exp)
textOps :: Map Text (Text -> Exp)
textOps = [(Text, Text -> Exp)] -> Map Text (Text -> Exp)
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
          [ ("\\textrm", (TextType -> Text -> Exp
EText TextType
TextNormal))
          , ("\\text",   (TextType -> Text -> Exp
EText TextType
TextNormal))
          , ("\\textbf", (TextType -> Text -> Exp
EText TextType
TextBold))
          , ("\\textit", (TextType -> Text -> Exp
EText TextType
TextItalic))
          , ("\\texttt", (TextType -> Text -> Exp
EText TextType
TextMonospace))
          , ("\\textsf", (TextType -> Text -> Exp
EText TextType
TextSansSerif))
          , ("\\mbox",   (TextType -> Text -> Exp
EText TextType
TextNormal))
          ]

enclosures :: M.Map Text Exp
enclosures :: Map Text Exp
enclosures = [(Text, Exp)] -> Map Text Exp
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
  [ ("(", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "(")
  , (")", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close ")")
  , ("[", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "[")
  , ("]", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "]")
  , ("\\{", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "{")
  , ("\\}", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "}")
  , ("\\lbrack", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "[")
  , ("\\lbrace", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "{")
  , ("\\rbrack", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "]")
  , ("\\rbrace", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "}")
  , ("\\llbracket", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\x27E6")
  , ("\\rrbracket", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x27E7")
  , ("\\langle", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\x27E8")
  , ("\\rangle", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x27E9")
  , ("\\lfloor", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\x230A")
  , ("\\rfloor", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x230B")
  , ("\\lceil", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\x2308")
  , ("\\rceil", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x2309")
  , ("|", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "|")
  , ("|", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "|")
  , ("\\|", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\x2225")
  , ("\\|", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x2225")
  , ("\\lvert", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\x7C")
  , ("\\rvert", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x7C")
  , ("\\vert", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x7C")
  , ("\\lVert", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\x2225")
  , ("\\rVert", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x2225")
  , ("\\Vert", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x2016")
  , ("\\ulcorner", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\x231C")
  , ("\\urcorner", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\x231D")
  ]

operators :: M.Map Text Exp
operators :: Map Text Exp
operators = [(Text, Exp)] -> Map Text Exp
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList [
             ("+", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "+")
           , ("-", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\x2212")
           , ("*", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "*")
           , ("@", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "@")
           , (",", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Pun ",")
           , (".", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord ".")
           , (";", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Pun ";")
           , (":", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel ":")
           , ("?", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "?")
           , (">", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel ">")
           , ("<", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "<")
           , ("!", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "!")
           , ("'", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\x2032")
           , ("''", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\x2033")
           , ("'''", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\x2034")
           , ("''''", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\x2057")
           , ("=", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "=")
           , (":=", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel ":=")
           , ("/", TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "/")
           , ("~", Rational -> Exp
ESpace (4Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/18)) ]

symbols :: M.Map Text Exp
symbols :: Map Text Exp
symbols = Map Text Exp
symbolMapOverrides Map Text Exp -> Map Text Exp -> Map Text Exp
forall a. Semigroup a => a -> a -> a
<> Map Text Exp
symbolMap

-- These are the cases where texmath historically diverged
-- from symbolMap.  We may want to remove some of these overrides,
-- but for now we keep them so behavior doesn't change.
symbolMapOverrides ::  M.Map Text Exp
symbolMapOverrides :: Map Text Exp
symbolMapOverrides = [(Text, Exp)] -> Map Text Exp
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
  [ ("\\\n",Rational -> Exp
ESpace (2 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 9))
  , ("\\ ",Rational -> Exp
ESpace (2 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 9))
  , ("\\!",Rational -> Exp
ESpace ((-1) Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 6))
  , ("\\,",Rational -> Exp
ESpace (1 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 6))
  , ("\\:",Rational -> Exp
ESpace (2 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 9))
  , ("\\;",Rational -> Exp
ESpace (5 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 18))
  , ("\\>",Rational -> Exp
ESpace (2 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 9))
  , ("\\AC",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\9190")
  , ("\\Box",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Op "\9633")
  , ("\\Delta",Text -> Exp
EIdentifier "\916")
  , ("\\Diamond",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Op "\9671")
  , ("\\Gamma",Text -> Exp
EIdentifier "\915")
  , ("\\Im",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8465")
  , ("\\Join",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8904")
  , ("\\Lambda",Text -> Exp
EIdentifier "\923")
  , ("\\Lbrbrak",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\12312")
  , ("\\Longleftarrow",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8656")
  , ("\\Longleftrightarrow",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8660")
  , ("\\Longrightarrow",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8658")
  , ("\\Omega",Text -> Exp
EIdentifier "\937")
  , ("\\Phi",Text -> Exp
EIdentifier "\934")
  , ("\\Pi",Text -> Exp
EIdentifier "\928")
  , ("\\Pr",Text -> Exp
EMathOperator "Pr")
  , ("\\Psi",Text -> Exp
EIdentifier "\936")
  , ("\\Rbrbrak",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\12313")
  , ("\\Re",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8476")
  , ("\\Sigma",Text -> Exp
EIdentifier "\931")
  , ("\\Theta",Text -> Exp
EIdentifier "\920")
  , ("\\Upsilon",Text -> Exp
EIdentifier "\933")
  , ("\\Xi",Text -> Exp
EIdentifier "\926")
  , ("\\^",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "^")
  , ("\\alpha",Text -> Exp
EIdentifier "\945")
  , ("\\amalg",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8720")
  , ("\\arccos",Text -> Exp
EMathOperator "arccos")
  , ("\\arcsin",Text -> Exp
EMathOperator "arcsin")
  , ("\\arctan",Text -> Exp
EMathOperator "arctan")
  , ("\\arg",Text -> Exp
EMathOperator "arg")
  , ("\\ast",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "*")
  , ("\\backslash",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8726")
  , ("\\bar",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Accent "\8254")
  , ("\\barwedge",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8965")
  , ("\\beta",Text -> Exp
EIdentifier "\946")
  , ("\\bigcirc",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\9675")
  , ("\\blacklozenge",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\11047")
  , ("\\blacksquare",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\9724")
  , ("\\blacktriangleleft",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\9666")
  , ("\\blacktriangleright",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\9656")
  , ("\\cdot",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8901")
  , ("\\chi",Text -> Exp
EIdentifier "\967")
  , ("\\cos",Text -> Exp
EMathOperator "cos")
  , ("\\cosh",Text -> Exp
EMathOperator "cosh")
  , ("\\cot",Text -> Exp
EMathOperator "cot")
  , ("\\coth",Text -> Exp
EMathOperator "coth")
  , ("\\csc",Text -> Exp
EMathOperator "csc")
  , ("\\dag",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8224")
  , ("\\ddag",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8225")
  , ("\\deg",Text -> Exp
EMathOperator "deg")
  , ("\\delta",Text -> Exp
EIdentifier "\948")
  , ("\\det",Text -> Exp
EMathOperator "det")
  , ("\\diamond",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Op "\8900")
  , ("\\digamma",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Alpha "\989")
  , ("\\dim",Text -> Exp
EMathOperator "dim")
  , ("\\dots",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8230")
  , ("\\dotsb",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8943")
  , ("\\dotsc",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8230")
  , ("\\dotsi",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8943")
  , ("\\dotsm",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8943")
  , ("\\dotso",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8230")
  , ("\\emptyset",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8709")
  , ("\\epsilon",Text -> Exp
EIdentifier "\1013")
  , ("\\eqcolon",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8789")
  , ("\\eta",Text -> Exp
EIdentifier "\951")
  , ("\\exists",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Op "\8707")
  , ("\\exp",Text -> Exp
EMathOperator "exp")
  , ("\\forall",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Op "\8704")
  , ("\\gamma",Text -> Exp
EIdentifier "\947")
  , ("\\gcd",Text -> Exp
EMathOperator "gcd")
  , ("\\geqslant",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8805")
  , ("\\gt",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel ">")
  , ("\\hbar",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8463")
  , ("\\hdots",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8230")
  , ("\\hom",Text -> Exp
EMathOperator "hom")
  , ("\\iff",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8660")
  , ("\\inf",Text -> Exp
EMathOperator "inf")
  , ("\\iota",Text -> Exp
EIdentifier "\953")
  , ("\\kappa",Text -> Exp
EIdentifier "\954")
  , ("\\ker",Text -> Exp
EMathOperator "ker")
  , ("\\lambda",Text -> Exp
EIdentifier "\955")
  , ("\\lbrbrak",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\12308")
  , ("\\leqslant",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8804")
  , ("\\lg",Text -> Exp
EMathOperator "lg")
  , ("\\lhd",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8882")
  , ("\\lim",Text -> Exp
EMathOperator "lim")
  , ("\\liminf",Text -> Exp
EMathOperator "liminf")
  , ("\\limsup",Text -> Exp
EMathOperator "limsup")
  , ("\\llbracket",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Open "\12314")
  , ("\\ln",Text -> Exp
EMathOperator "ln")
  , ("\\log",Text -> Exp
EMathOperator "log")
  , ("\\longleftarrow",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8592")
  , ("\\longleftrightarrow",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8596")
  , ("\\longmapsto",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8614")
  , ("\\longrightarrow",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8594")
  , ("\\lozenge",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Op "\9674")
  , ("\\lt",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "<")
  , ("\\max",Text -> Exp
EMathOperator "max")
  , ("\\mid",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8739")
  , ("\\min",Text -> Exp
EMathOperator "min")
  , ("\\models",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8872")
  , ("\\mu",Text -> Exp
EIdentifier "\956")
  , ("\\neg",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Op "\172")
  , ("\\nu",Text -> Exp
EIdentifier "\957")
  , ("\\omega",Text -> Exp
EIdentifier "\969")
  , ("\\overbar",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Accent "\175")
  , ("\\overline",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
TOver "\175")
  , ("\\overrightarrow",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Accent "\8407")
  , ("\\perp",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8869")
  , ("\\phi",Text -> Exp
EIdentifier "\981")
  , ("\\pi",Text -> Exp
EIdentifier "\960")
  , ("\\preceq",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8828")
  , ("\\psi",Text -> Exp
EIdentifier "\968")
  , ("\\qquad",Rational -> Exp
ESpace (2 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 1))
  , ("\\quad",Rational -> Exp
ESpace (1 Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% 1))
  , ("\\rbrbrak",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\12309")
  , ("\\rhd",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8883")
  , ("\\rho",Text -> Exp
EIdentifier "\961")
  , ("\\rrbracket",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Close "\12315")
  , ("\\sec",Text -> Exp
EMathOperator "sec")
  , ("\\setminus",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\\")
  , ("\\sigma",Text -> Exp
EIdentifier "\963")
  , ("\\sim",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8764")
  , ("\\sin",Text -> Exp
EMathOperator "sin")
  , ("\\sinh",Text -> Exp
EMathOperator "sinh")
  , ("\\square",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\9643")
  , ("\\succeq",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Rel "\8829")
  , ("\\sup",Text -> Exp
EMathOperator "sup")
  , ("\\tan",Text -> Exp
EMathOperator "tan")
  , ("\\tanh",Text -> Exp
EMathOperator "tanh")
  , ("\\tau",Text -> Exp
EIdentifier "\964")
  , ("\\therefore",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Pun "\8756")
  , ("\\theta",Text -> Exp
EIdentifier "\952")
  , ("\\triangle",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\9651")
  , ("\\triangleleft",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8882")
  , ("\\triangleright",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8883")
  , ("\\underbar",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
TUnder "\817")
  , ("\\underline",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
TUnder "_")
  , ("\\unlhd",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8884")
  , ("\\unrhd",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Bin "\8885")
  , ("\\upUpsilon",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Alpha "\978")
  , ("\\upsilon",Text -> Exp
EIdentifier "\965")
  , ("\\varepsilon",Text -> Exp
EIdentifier "\949")
  , ("\\varnothing",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8960")
  , ("\\varphi",Text -> Exp
EIdentifier "\966")
  , ("\\varrho",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Alpha "\120602")
  , ("\\vartheta",Text -> Exp
EIdentifier "\977")
  , ("\\vdots",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8942")
  , ("\\vec",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Accent "\8407")
  , ("\\wp",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8472")
  , ("\\wr",TeXSymbolType -> Text -> Exp
ESymbol TeXSymbolType
Ord "\8768")
  , ("\\xi",Text -> Exp
EIdentifier "\958")
  , ("\\zeta",Text -> Exp
EIdentifier "\950")
  ]

siUnitMap :: M.Map Text Exp
siUnitMap :: Map Text Exp
siUnitMap = [(Text, Exp)] -> Map Text Exp
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
  [ ("fg", Text -> Exp
str "fg")
  , ("pg", Text -> Exp
str "pg")
  , ("ng", Text -> Exp
str "ng")
  , ("ug", Text -> Exp
str "μg")
  , ("mg", Text -> Exp
str "mg")
  , ("g", Text -> Exp
str "g")
  , ("kg", Text -> Exp
str "kg")
  , ("amu", Text -> Exp
str "u")
  , ("pm", Text -> Exp
str "pm")
  , ("nm", Text -> Exp
str "nm")
  , ("um", Text -> Exp
str "μm")
  , ("mm", Text -> Exp
str "mm")
  , ("cm", Text -> Exp
str "cm")
  , ("dm", Text -> Exp
str "dm")
  , ("m", Text -> Exp
str "m")
  , ("km", Text -> Exp
str "km")
  , ("as", Text -> Exp
str "as")
  , ("fs", Text -> Exp
str "fs")
  , ("ps", Text -> Exp
str "ps")
  , ("ns", Text -> Exp
str "ns")
  , ("us", Text -> Exp
str "μs")
  , ("ms", Text -> Exp
str "ms")
  , ("s", Text -> Exp
str "s")
  , ("fmol", Text -> Exp
str "fmol")
  , ("pmol", Text -> Exp
str "pmol")
  , ("nmol", Text -> Exp
str "nmol")
  , ("umol", Text -> Exp
str "μmol")
  , ("mmol", Text -> Exp
str "mmol")
  , ("mol", Text -> Exp
str "mol")
  , ("kmol", Text -> Exp
str "kmol")
  , ("pA", Text -> Exp
str "pA")
  , ("nA", Text -> Exp
str "nA")
  , ("uA", Text -> Exp
str "μA")
  , ("mA", Text -> Exp
str "mA")
  , ("A", Text -> Exp
str "A")
  , ("kA", Text -> Exp
str "kA")
  , ("ul", Text -> Exp
str "μl")
  , ("ml", Text -> Exp
str "ml")
  , ("l", Text -> Exp
str "l")
  , ("hl", Text -> Exp
str "hl")
  , ("uL", Text -> Exp
str "μL")
  , ("mL", Text -> Exp
str "mL")
  , ("L", Text -> Exp
str "L")
  , ("hL", Text -> Exp
str "hL")
  , ("mHz", Text -> Exp
str "mHz")
  , ("Hz", Text -> Exp
str "Hz")
  , ("kHz", Text -> Exp
str "kHz")
  , ("MHz", Text -> Exp
str "MHz")
  , ("GHz", Text -> Exp
str "GHz")
  , ("THz", Text -> Exp
str "THz")
  , ("mN", Text -> Exp
str "mN")
  , ("N", Text -> Exp
str "N")
  , ("kN", Text -> Exp
str "kN")
  , ("MN", Text -> Exp
str "MN")
  , ("Pa", Text -> Exp
str "Pa")
  , ("kPa", Text -> Exp
str "kPa")
  , ("MPa", Text -> Exp
str "MPa")
  , ("GPa", Text -> Exp
str "GPa")
  , ("mohm", Text -> Exp
str "mΩ")
  , ("kohm", Text -> Exp
str "kΩ")
  , ("Mohm", Text -> Exp
str "MΩ")
  , ("pV", Text -> Exp
str "pV")
  , ("nV", Text -> Exp
str "nV")
  , ("uV", Text -> Exp
str "μV")
  , ("mV", Text -> Exp
str "mV")
  , ("V", Text -> Exp
str "V")
  , ("kV", Text -> Exp
str "kV")
  , ("W", Text -> Exp
str "W")
  , ("uW", Text -> Exp
str "μW")
  , ("mW", Text -> Exp
str "mW")
  , ("kW", Text -> Exp
str "kW")
  , ("MW", Text -> Exp
str "MW")
  , ("GW", Text -> Exp
str "GW")
  , ("J", Text -> Exp
str "J")
  , ("uJ", Text -> Exp
str "μJ")
  , ("mJ", Text -> Exp
str "mJ")
  , ("kJ", Text -> Exp
str "kJ")
  , ("eV", Text -> Exp
str "eV")
  , ("meV", Text -> Exp
str "meV")
  , ("keV", Text -> Exp
str "keV")
  , ("MeV", Text -> Exp
str "MeV")
  , ("GeV", Text -> Exp
str "GeV")
  , ("TeV", Text -> Exp
str "TeV")
  , ("kWh", Text -> Exp
str "kWh")
  , ("F", Text -> Exp
str "F")
  , ("fF", Text -> Exp
str "fF")
  , ("pF", Text -> Exp
str "pF")
  , ("K", Text -> Exp
str "K")
  , ("dB", Text -> Exp
str "dB")
  , ("ampere", Text -> Exp
str "A")
  , ("angstrom", Text -> Exp
str "Å")
  , ("arcmin", Text -> Exp
str "′")
  , ("arcminute", Text -> Exp
str "′")
  , ("arcsecond", Text -> Exp
str "″")
  , ("astronomicalunit", Text -> Exp
str "ua")
  , ("atomicmassunit", Text -> Exp
str "u")
  , ("atto", Text -> Exp
str "a")
  , ("bar", Text -> Exp
str "bar")
  , ("barn", Text -> Exp
str "b")
  , ("becquerel", Text -> Exp
str "Bq")
  , ("bel", Text -> Exp
str "B")
  , ("bohr", Exp -> Exp -> Exp
ESuper (TextType -> Text -> Exp
EText TextType
TextItalic "a") (Text -> Exp
ENumber "0"))
  , ("candela", Text -> Exp
str "cd")
  , ("celsius", Text -> Exp
str "°C")
  , ("centi", Text -> Exp
str "c")
  , ("clight", Exp -> Exp -> Exp
ESuper (TextType -> Text -> Exp
EText TextType
TextItalic "c") (Text -> Exp
ENumber "0"))
  , ("coulomb", Text -> Exp
str "C")
  , ("dalton", Text -> Exp
str "Da")
  , ("day", Text -> Exp
str "d")
  , ("deca", Text -> Exp
str "d")
  , ("deci", Text -> Exp
str "d")
  , ("decibel", Text -> Exp
str "db")
  , ("degreeCelsius",Text -> Exp
str "°C")
  , ("degree", Text -> Exp
str "°")
  , ("deka", Text -> Exp
str "d")
  , ("electronmass", Exp -> Exp -> Exp
ESuper (TextType -> Text -> Exp
EText TextType
TextItalic "m") (TextType -> Text -> Exp
EText TextType
TextItalic "e"))
  , ("electronvolt", Text -> Exp
str "eV")
  , ("elementarycharge", TextType -> Text -> Exp
EText TextType
TextItalic "e")
  , ("exa", Text -> Exp
str "E")
  , ("farad", Text -> Exp
str "F")
  , ("femto", Text -> Exp
str "f")
  , ("giga", Text -> Exp
str "G")
  , ("gram", Text -> Exp
str "g")
  , ("gray", Text -> Exp
str "Gy")
  , ("hartree", Exp -> Exp -> Exp
ESuper (TextType -> Text -> Exp
EText TextType
TextItalic "E") (TextType -> Text -> Exp
EText TextType
TextItalic "h"))
  , ("hectare", Text -> Exp
str "ha")
  , ("hecto", Text -> Exp
str "h")
  , ("henry", Text -> Exp
str "H")
  , ("hertz", Text -> Exp
str "Hz")
  , ("hour", Text -> Exp
str "h")
  , ("joule", Text -> Exp
str "J")
  , ("katal", Text -> Exp
str "kat")
  , ("kelvin", Text -> Exp
str "K")
  , ("kilo", Text -> Exp
str "k")
  , ("kilogram", Text -> Exp
str "kg")
  , ("knot", Text -> Exp
str "kn")
  , ("liter", Text -> Exp
str "L")
  , ("litre", Text -> Exp
str "l")
  , ("lumen", Text -> Exp
str "lm")
  , ("lux", Text -> Exp
str "lx")
  , ("mega", Text -> Exp
str "M")
  , ("meter", Text -> Exp
str "m")
  , ("metre", Text -> Exp
str "m")
  , ("micro", Text -> Exp
str "μ")
  , ("milli", Text -> Exp
str "m")
  , ("minute", Text -> Exp
str "min")
  , ("mmHg", Text -> Exp
str "mmHg")
  , ("mole", Text -> Exp
str "mol")
  , ("nano", Text -> Exp
str "n")
  , ("nauticalmile", Text -> Exp
str "M")
  , ("neper", Text -> Exp
str "Np")
  , ("newton", Text -> Exp
str "N")
  , ("ohm", Text -> Exp
str "Ω")
  , ("Pa", Text -> Exp
str "Pa")
  , ("pascal", Text -> Exp
str "Pa")
  , ("percent", Text -> Exp
str "%")
  , ("per", Text -> Exp
str "/")
  , ("peta", Text -> Exp
str "P")
  , ("pico", Text -> Exp
str "p")
  , ("planckbar", TextType -> Text -> Exp
EText TextType
TextItalic "\x210f")
  , ("radian", Text -> Exp
str "rad")
  , ("second", Text -> Exp
str "s")
  , ("siemens", Text -> Exp
str "S")
  , ("sievert", Text -> Exp
str "Sv")
  , ("steradian", Text -> Exp
str "sr")
  , ("tera", Text -> Exp
str "T")
  , ("tesla", Text -> Exp
str "T")
  , ("tonne", Text -> Exp
str "t")
  , ("volt", Text -> Exp
str "V")
  , ("watt", Text -> Exp
str "W")
  , ("weber", Text -> Exp
str "Wb")
  , ("yocto", Text -> Exp
str "y")
  , ("yotta", Text -> Exp
str "Y")
  , ("zepto", Text -> Exp
str "z")
  , ("zetta", Text -> Exp
str "Z")
  ]
 where
  str :: Text -> Exp
str = TextType -> Text -> Exp
EText TextType
TextNormal