{-# LANGUAGE CPP, OverloadedStrings, TypeFamilies #-}
#if __GLASGOW_HASKELL__ >= 801
{-# OPTIONS_GHC -Wno-orphans #-}
#else
{-# OPTIONS_GHC -fno-warn-orphans #-}
#endif
module Text.LaTeX.Packages.AMSMath
(
amsmath
, math, mathDisplay
, equation , equation_
, align , align_
, cases
, eqref , nonumber
, autoParens
, autoSquareBrackets, autoBraces, autoAngleBrackets
, autoBrackets
, langle , rangle
, lfloor , rfloor
, lceil , rceil
, dblPipe
, (^:) , (!:), (!^)
, tsin , arcsin
, tcos , arccos
, ttan , arctan
, cot , arccot
, tsinh , tcosh , ttanh , coth
, sec , csc
, texp
, tlog , ln
, tsqrt
, operatorname
, tsum , sumFromTo
, prod , prodFromTo
, coprod, coprodFromTo
, integral , integralFromTo
, partial, totald, partialOf, totaldOf
, bigcup, bigcupFromTo
, bigcap, bigcapFromTo
, (+-), (-+)
, cdot , times , div_
, frac, tfrac
, (*:) , star
, circ , bullet
, (=:) , (/=:)
, (<:) , (<=:)
, (>:) , (>=:)
, ll , gg
, equiv
, propto
, parallel
, perp
, approx
, sim
, simeq
, cong
, in_ , ni , notin
, subset , supset
, subseteq , supseteq
, cap , cup
, setminus
, vee , wedge
, oplus , ominus , otimes
, oslash , odot
, hat, tilde, bar, vec, widehat, widetilde
, dot, ddot, dddot
, overline
, alpha , beta , gamma
, gammau , delta , deltau
, epsilon , varepsilon , zeta
, eta , theta , vartheta , thetau
, iota , kappa , lambda
, lambdau , mu , nu
, xi , xiu , pi_
, varpi , piu , rho
, varrho , sigma , varsigma
, sigmau , tau , upsilon
, upsilonu , phi , varphi
, phiu , chi , psi
, psiu , omega , omegau
, pm , mp
, to , mapsto, implies
, forall , exists
, dagger, ddagger
, infty
, imath, jmath
, bot
, mathdefault
, mathbf
, mathrm
, text
, mathcal
, mathsf
, mathtt
, mathit
, pmatrix , bmatrix
, b2matrix , vmatrix
, v2matrix
, quad, qquad
, thinspace, medspace, thickspace, negspace, space
) where
import Text.LaTeX.Base
import Text.LaTeX.Base.Syntax
import Text.LaTeX.Base.Class
import Data.List
import Data.Ratio
import Data.Matrix
amsmath :: PackageName
amsmath :: PackageName
amsmath = PackageName
"amsmath"
eqref :: LaTeXC l => l -> l
eqref :: forall l. LaTeXC l => l -> l
eqref = (LaTeX -> LaTeX) -> l -> l
forall l. LaTeXC l => (LaTeX -> LaTeX) -> l -> l
liftL ((LaTeX -> LaTeX) -> l -> l) -> (LaTeX -> LaTeX) -> l -> l
forall a b. (a -> b) -> a -> b
$ \LaTeX
l -> PackageName -> [TeXArg] -> LaTeX
TeXComm PackageName
"eqref" [LaTeX -> TeXArg
FixArg (LaTeX -> TeXArg) -> (Text -> LaTeX) -> Text -> TeXArg
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> LaTeX
TeXRaw (Text -> TeXArg) -> Text -> TeXArg
forall a b. (a -> b) -> a -> b
$ LaTeX -> Text
forall a. Render a => a -> Text
render LaTeX
l]
align :: LaTeXC l => [l] -> l
align :: forall l. LaTeXC l => [l] -> l
align = (LaTeX -> LaTeX) -> l -> l
forall l. LaTeXC l => (LaTeX -> LaTeX) -> l -> l
liftL(PackageName -> [TeXArg] -> LaTeX -> LaTeX
TeXEnv PackageName
"align" []) (l -> l) -> ([l] -> l) -> [l] -> l
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [l] -> l
forall a. Monoid a => [a] -> a
mconcat ([l] -> l) -> ([l] -> [l]) -> [l] -> l
forall b c a. (b -> c) -> (a -> b) -> a -> c
. l -> [l] -> [l]
forall a. a -> [a] -> [a]
intersperse l
forall l. LaTeXC l => l
lnbk
align_ :: LaTeXC l => [l] -> l
align_ :: forall l. LaTeXC l => [l] -> l
align_ = (LaTeX -> LaTeX) -> l -> l
forall l. LaTeXC l => (LaTeX -> LaTeX) -> l -> l
liftL(PackageName -> [TeXArg] -> LaTeX -> LaTeX
TeXEnv PackageName
"align*" []) (l -> l) -> ([l] -> l) -> [l] -> l
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [l] -> l
forall a. Monoid a => [a] -> a
mconcat ([l] -> l) -> ([l] -> [l]) -> [l] -> l
forall b c a. (b -> c) -> (a -> b) -> a -> c
. l -> [l] -> [l]
forall a. a -> [a] -> [a]
intersperse l
forall l. LaTeXC l => l
lnbk
cases :: LaTeXC l => l -> l
cases :: forall l. LaTeXC l => l -> l
cases = (LaTeX -> LaTeX) -> l -> l
forall l. LaTeXC l => (LaTeX -> LaTeX) -> l -> l
liftL ((LaTeX -> LaTeX) -> l -> l) -> (LaTeX -> LaTeX) -> l -> l
forall a b. (a -> b) -> a -> b
$ PackageName -> [TeXArg] -> LaTeX -> LaTeX
TeXEnv PackageName
"cases" []
tfrac :: LaTeXC l => l -> l -> l
tfrac :: forall l. LaTeXC l => l -> l -> l
tfrac = (LaTeX -> LaTeX -> LaTeX) -> l -> l -> l
forall l. LaTeXC l => (LaTeX -> LaTeX -> LaTeX) -> l -> l -> l
liftL2 ((LaTeX -> LaTeX -> LaTeX) -> l -> l -> l)
-> (LaTeX -> LaTeX -> LaTeX) -> l -> l -> l
forall a b. (a -> b) -> a -> b
$ \LaTeX
p LaTeX
q -> PackageName -> [TeXArg] -> LaTeX
TeXComm PackageName
"tfrac" [LaTeX -> TeXArg
FixArg LaTeX
p, LaTeX -> TeXArg
FixArg LaTeX
q]
ddot :: LaTeXC l => l -> l
ddot :: forall l. LaTeXC l => l -> l
ddot = PackageName -> l -> l
forall l. LaTeXC l => PackageName -> l -> l
comm1 PackageName
"ddot"
dddot :: LaTeXC l => l -> l
dddot :: forall l. LaTeXC l => l -> l
dddot = PackageName -> l -> l
forall l. LaTeXC l => PackageName -> l -> l
comm1 PackageName
"dddot"
text :: LaTeXC l => l -> l
text :: forall l. LaTeXC l => l -> l
text = PackageName -> l -> l
forall l. LaTeXC l => PackageName -> l -> l
comm1 PackageName
"text"
matrix2tex :: (Texy a, LaTeXC l) => Matrix a -> l
matrix2tex :: forall a l. (Texy a, LaTeXC l) => Matrix a -> l
matrix2tex Matrix a
m = [l] -> l
forall a. Monoid a => [a] -> a
mconcat
[ (l -> l -> l) -> [l] -> l
forall a. (a -> a -> a) -> [a] -> a
forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
foldr1 l -> l -> l
forall l. LaTeXC l => l -> l -> l
(&) [ a -> l
forall l. LaTeXC l => a -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy (a -> l) -> a -> l
forall a b. (a -> b) -> a -> b
$ Matrix a
m Matrix a -> (Int, Int) -> a
forall a. Matrix a -> (Int, Int) -> a
! (Int
i,Int
j)
| Int
j <- [Int
1 .. Matrix a -> Int
forall a. Matrix a -> Int
ncols Matrix a
m]
] l -> l -> l
forall a. Semigroup a => a -> a -> a
<> l
forall l. LaTeXC l => l
lnbk
| Int
i <- [Int
1 .. Matrix a -> Int
forall a. Matrix a -> Int
nrows Matrix a
m]
]
toMatrix :: (Texy a, LaTeXC l) => String -> Maybe HPos -> Matrix a -> l
toMatrix :: forall a l.
(Texy a, LaTeXC l) =>
PackageName -> Maybe HPos -> Matrix a -> l
toMatrix PackageName
str Maybe HPos
Nothing = (LaTeX -> LaTeX) -> l -> l
forall l. LaTeXC l => (LaTeX -> LaTeX) -> l -> l
liftL (PackageName -> [TeXArg] -> LaTeX -> LaTeX
TeXEnv PackageName
str []) (l -> l) -> (Matrix a -> l) -> Matrix a -> l
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Matrix a -> l
forall a l. (Texy a, LaTeXC l) => Matrix a -> l
matrix2tex
toMatrix PackageName
str (Just HPos
p) = (LaTeX -> LaTeX) -> l -> l
forall l. LaTeXC l => (LaTeX -> LaTeX) -> l -> l
liftL (PackageName -> [TeXArg] -> LaTeX -> LaTeX
TeXEnv (PackageName
str PackageName -> PackageName -> PackageName
forall a. [a] -> [a] -> [a]
++ PackageName
"*") [LaTeX -> TeXArg
OptArg (LaTeX -> TeXArg) -> LaTeX -> TeXArg
forall a b. (a -> b) -> a -> b
$ HPos -> LaTeX
forall a l. (Render a, LaTeXC l) => a -> l
rendertex HPos
p]) (l -> l) -> (Matrix a -> l) -> Matrix a -> l
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Matrix a -> l
forall a l. (Texy a, LaTeXC l) => Matrix a -> l
matrix2tex
pmatrix :: (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
pmatrix :: forall a l. (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
pmatrix = PackageName -> Maybe HPos -> Matrix a -> l
forall a l.
(Texy a, LaTeXC l) =>
PackageName -> Maybe HPos -> Matrix a -> l
toMatrix PackageName
"pmatrix"
bmatrix :: (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
bmatrix :: forall a l. (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
bmatrix = PackageName -> Maybe HPos -> Matrix a -> l
forall a l.
(Texy a, LaTeXC l) =>
PackageName -> Maybe HPos -> Matrix a -> l
toMatrix PackageName
"bmatrix"
b2matrix :: (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
b2matrix :: forall a l. (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
b2matrix = PackageName -> Maybe HPos -> Matrix a -> l
forall a l.
(Texy a, LaTeXC l) =>
PackageName -> Maybe HPos -> Matrix a -> l
toMatrix PackageName
"Bmatrix"
vmatrix :: (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
vmatrix :: forall a l. (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
vmatrix = PackageName -> Maybe HPos -> Matrix a -> l
forall a l.
(Texy a, LaTeXC l) =>
PackageName -> Maybe HPos -> Matrix a -> l
toMatrix PackageName
"vmatrix"
v2matrix :: (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
v2matrix :: forall a l. (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
v2matrix = PackageName -> Maybe HPos -> Matrix a -> l
forall a l.
(Texy a, LaTeXC l) =>
PackageName -> Maybe HPos -> Matrix a -> l
toMatrix PackageName
"Vmatrix"
#if MIN_VERSION_base(4,9,0)
instance Texy a => Texy (Ratio a) where
#else
instance (Integral a, Texy a) => Texy (Ratio a) where
#endif
texy :: forall l. LaTeXC l => Ratio a -> l
texy Ratio a
x = l -> l -> l
forall l. LaTeXC l => l -> l -> l
frac (a -> l
forall l. LaTeXC l => a -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy (a -> l) -> a -> l
forall a b. (a -> b) -> a -> b
$ Ratio a -> a
forall a. Ratio a -> a
numerator Ratio a
x) (a -> l
forall l. LaTeXC l => a -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy (a -> l) -> a -> l
forall a b. (a -> b) -> a -> b
$ Ratio a -> a
forall a. Ratio a -> a
denominator Ratio a
x)
instance (Texy a, Texy b) => Texy (a,b) where
texy :: forall l. LaTeXC l => (a, b) -> l
texy (a
x,b
y) = l -> l
forall l. LaTeXC l => l -> l
autoParens (l -> l) -> l -> l
forall a b. (a -> b) -> a -> b
$ a -> l
forall l. LaTeXC l => a -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy a
x l -> l -> l
forall a. Semigroup a => a -> a -> a
<> l
"," l -> l -> l
forall a. Semigroup a => a -> a -> a
<> b -> l
forall l. LaTeXC l => b -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy b
y
instance (Texy a, Texy b, Texy c) => Texy (a,b,c) where
texy :: forall l. LaTeXC l => (a, b, c) -> l
texy (a
x,b
y,c
z) = l -> l
forall l. LaTeXC l => l -> l
autoParens (l -> l) -> l -> l
forall a b. (a -> b) -> a -> b
$ a -> l
forall l. LaTeXC l => a -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy a
x l -> l -> l
forall a. Semigroup a => a -> a -> a
<> l
"," l -> l -> l
forall a. Semigroup a => a -> a -> a
<> b -> l
forall l. LaTeXC l => b -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy b
y l -> l -> l
forall a. Semigroup a => a -> a -> a
<> l
"," l -> l -> l
forall a. Semigroup a => a -> a -> a
<> c -> l
forall l. LaTeXC l => c -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy c
z
instance (Texy a, Texy b, Texy c, Texy d) => Texy (a,b,c,d) where
texy :: forall l. LaTeXC l => (a, b, c, d) -> l
texy (a
a,b
b,c
c,d
d) = l -> l
forall l. LaTeXC l => l -> l
autoParens (l -> l) -> l -> l
forall a b. (a -> b) -> a -> b
$ a -> l
forall l. LaTeXC l => a -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy a
a l -> l -> l
forall a. Semigroup a => a -> a -> a
<> l
"," l -> l -> l
forall a. Semigroup a => a -> a -> a
<> b -> l
forall l. LaTeXC l => b -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy b
b l -> l -> l
forall a. Semigroup a => a -> a -> a
<> l
"," l -> l -> l
forall a. Semigroup a => a -> a -> a
<> c -> l
forall l. LaTeXC l => c -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy c
c l -> l -> l
forall a. Semigroup a => a -> a -> a
<> l
"," l -> l -> l
forall a. Semigroup a => a -> a -> a
<> d -> l
forall l. LaTeXC l => d -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy d
d
instance Texy a => Texy (Matrix a) where
texy :: forall l. LaTeXC l => Matrix a -> l
texy = Maybe HPos -> Matrix a -> l
forall a l. (Texy a, LaTeXC l) => Maybe HPos -> Matrix a -> l
pmatrix Maybe HPos
forall a. Maybe a
Nothing
instance Texy a => Texy [a] where
texy :: forall l. LaTeXC l => [a] -> l
texy = l -> l
forall l. LaTeXC l => l -> l
autoSquareBrackets (l -> l) -> ([a] -> l) -> [a] -> l
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [l] -> l
forall a. Monoid a => [a] -> a
mconcat ([l] -> l) -> ([a] -> [l]) -> [a] -> l
forall b c a. (b -> c) -> (a -> b) -> a -> c
. l -> [l] -> [l]
forall a. a -> [a] -> [a]
intersperse l
"," ([l] -> [l]) -> ([a] -> [l]) -> [a] -> [l]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> l) -> [a] -> [l]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> l
forall l. LaTeXC l => a -> l
forall t l. (Texy t, LaTeXC l) => t -> l
texy
thinspace :: LaTeXC l => l
thinspace :: forall l. LaTeXC l => l
thinspace = PackageName -> l
forall l. LaTeXC l => PackageName -> l
comm0 PackageName
","
medspace :: LaTeXC l => l
medspace :: forall l. LaTeXC l => l
medspace = PackageName -> l
forall l. LaTeXC l => PackageName -> l
comm0 PackageName
":"
thickspace :: LaTeXC l => l
thickspace :: forall l. LaTeXC l => l
thickspace = PackageName -> l
forall l. LaTeXC l => PackageName -> l
comm0 PackageName
";"
negspace :: LaTeXC l => l
negspace :: forall l. LaTeXC l => l
negspace = PackageName -> l
forall l. LaTeXC l => PackageName -> l
comm0 PackageName
"!"
space :: LaTeXC l => l
space :: forall l. LaTeXC l => l
space = PackageName -> l
forall l. LaTeXC l => PackageName -> l
comm0 PackageName
" "