module Text.LaTeX.Packages.AMSThm
(
amsthm
, newtheorem
, theorem
, proof
, qedhere
, TheoremStyle (..)
, theoremstyle
) where
import Text.LaTeX.Base.Syntax
import Text.LaTeX.Base.Class
import Text.LaTeX.Base.Render
import Text.LaTeX.Base.Types
amsthm :: PackageName
amsthm = "amsthm"
newtheorem :: LaTeXC l => String -> l -> l
newtheorem str = liftL $ \l -> TeXComm "newtheorem" [ FixArg $ fromString str , FixArg l ]
theorem :: LaTeXC l => String -> l -> l
theorem str = liftL $ TeXEnv str []
proof :: LaTeXC l => Maybe l -> l -> l
proof Nothing = liftL $ TeXEnv "proof" []
proof (Just n) = liftL2 (\m -> TeXEnv "proof" [OptArg m]) n
qedhere :: LaTeXC l => l
qedhere = comm0 "qedhere"
data TheoremStyle =
Plain
| Definition
| Remark
| CustomThmStyle String
deriving Show
instance Render TheoremStyle where
render Plain = "plain"
render Definition = "definition"
render Remark = "remark"
render (CustomThmStyle str) = fromString str
theoremstyle :: LaTeXC l => TheoremStyle -> l
theoremstyle thmsty = fromLaTeX $ TeXComm "theoremstyle" [ FixArg $ TeXRaw $ render thmsty ]