{-# LANGUAGE OverloadedStrings #-}
module Text.LaTeX.Base.Types (
ClassName
, PackageName
, PageStyle
, Label
, createLabel , labelName
, Pos (..) , HPos (..)
, TableSpec (..)
, Measure (..)
) where
import Text.LaTeX.Base.Syntax
import Text.LaTeX.Base.Render
type ClassName = String
type PackageName = String
type PageStyle = String
newtype Label = Label String deriving (Label -> Label -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Label -> Label -> Bool
$c/= :: Label -> Label -> Bool
== :: Label -> Label -> Bool
$c== :: Label -> Label -> Bool
Eq, Int -> Label -> ShowS
[Label] -> ShowS
Label -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Label] -> ShowS
$cshowList :: [Label] -> ShowS
show :: Label -> String
$cshow :: Label -> String
showsPrec :: Int -> Label -> ShowS
$cshowsPrec :: Int -> Label -> ShowS
Show)
createLabel :: String -> Label
createLabel :: String -> Label
createLabel = String -> Label
Label
labelName :: Label -> String
labelName :: Label -> String
labelName (Label String
str) = String
str
instance Render Label where
render :: Label -> Text
render (Label String
str) = forall a. IsString a => String -> a
fromString String
str
instance IsString Label where
fromString :: String -> Label
fromString = String -> Label
createLabel
data Pos = Bottom | Center | Top | Here | ForcePos deriving Int -> Pos -> ShowS
[Pos] -> ShowS
Pos -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Pos] -> ShowS
$cshowList :: [Pos] -> ShowS
show :: Pos -> String
$cshow :: Pos -> String
showsPrec :: Int -> Pos -> ShowS
$cshowsPrec :: Int -> Pos -> ShowS
Show
instance Render Pos where
render :: Pos -> Text
render Pos
Bottom = Text
"b"
render Pos
Center = Text
"c"
render Pos
Top = Text
"t"
render Pos
Here = Text
"h"
render Pos
ForcePos = Text
"!"
data HPos = HLeft | HCenter | HRight deriving Int -> HPos -> ShowS
[HPos] -> ShowS
HPos -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HPos] -> ShowS
$cshowList :: [HPos] -> ShowS
show :: HPos -> String
$cshow :: HPos -> String
showsPrec :: Int -> HPos -> ShowS
$cshowsPrec :: Int -> HPos -> ShowS
Show
instance Render HPos where
render :: HPos -> Text
render HPos
HLeft = Text
"l"
render HPos
HCenter = Text
"c"
render HPos
HRight = Text
"r"
data TableSpec =
LeftColumn
| CenterColumn
| RightColumn
| ParColumnTop LaTeX
| ParColumnMid LaTeX
| ParColumnBot LaTeX
| NameColumn String
| BeforeColumn LaTeX
| AfterColumn LaTeX
| VerticalLine
| DVerticalLine
| Separator LaTeX
deriving Int -> TableSpec -> ShowS
[TableSpec] -> ShowS
TableSpec -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableSpec] -> ShowS
$cshowList :: [TableSpec] -> ShowS
show :: TableSpec -> String
$cshow :: TableSpec -> String
showsPrec :: Int -> TableSpec -> ShowS
$cshowsPrec :: Int -> TableSpec -> ShowS
Show
instance Render TableSpec where
render :: TableSpec -> Text
render TableSpec
LeftColumn = Text
"l"
render TableSpec
CenterColumn = Text
"c"
render TableSpec
RightColumn = Text
"r"
render (ParColumnTop LaTeX
l) = Text
"p" forall a. Semigroup a => a -> a -> a
<> forall a. Render a => a -> Text
render (LaTeX -> TeXArg
FixArg LaTeX
l)
render (ParColumnMid LaTeX
l) = Text
"m" forall a. Semigroup a => a -> a -> a
<> forall a. Render a => a -> Text
render (LaTeX -> TeXArg
FixArg LaTeX
l)
render (ParColumnBot LaTeX
l) = Text
"b" forall a. Semigroup a => a -> a -> a
<> forall a. Render a => a -> Text
render (LaTeX -> TeXArg
FixArg LaTeX
l)
render (NameColumn String
n) = forall a. IsString a => String -> a
fromString String
n
render (BeforeColumn LaTeX
l) = Text
">{" forall a. Semigroup a => a -> a -> a
<> forall a. Render a => a -> Text
render LaTeX
l forall a. Semigroup a => a -> a -> a
<> Text
"}"
render (AfterColumn LaTeX
l) = Text
"<{" forall a. Semigroup a => a -> a -> a
<> forall a. Render a => a -> Text
render LaTeX
l forall a. Semigroup a => a -> a -> a
<> Text
"}"
render TableSpec
VerticalLine = Text
"|"
render TableSpec
DVerticalLine = Text
"||"
render (Separator LaTeX
l) = Text
"@" forall a. Semigroup a => a -> a -> a
<> forall a. Render a => a -> Text
render (LaTeX -> TeXArg
FixArg LaTeX
l)