Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Printing Monad. Starts with a specific data type (reader monad) and extends from there.
Synopsis
- data MathContext
- newtype PrintLaTeX a = PL {
- runPrint :: MathContext -> a
- type D = PrintLaTeX Doc
- switch :: (MathContext -> MathContext) -> D -> D
- toMath :: D -> D
- toText :: D -> D
- getCtx :: PrintLaTeX MathContext
- (%%) :: D -> D -> D
- ($+$) :: D -> D -> D
- tpRunPrint :: ([Doc] -> Doc) -> [D] -> D
- vcat :: [D] -> D
- vpunctuate :: Doc -> [D] -> D
- hpunctuate :: Doc -> [D] -> D
- lub :: MathContext -> MathContext -> MathContext
- newtype Latex = L {}
Printing Monad
data MathContext Source #
There are two proper contexts, Text and Math; Curr is the current context. There are multiple ways of getting there: for Text, either being at the top-level or inside text. For Math, either surrounded by $ or in begin{equation} .. end{equation}. Curr is when the current context is fine.
Instances
Eq MathContext Source # | |
Defined in Language.Drasil.TeX.Monad (==) :: MathContext -> MathContext -> Bool # (/=) :: MathContext -> MathContext -> Bool # |
newtype PrintLaTeX a Source #
A monad for printing in LaTeX.
PL | |
|
Instances
type D = PrintLaTeX Doc Source #
Convenient abbreviation.
switch :: (MathContext -> MathContext) -> D -> D Source #
MonadReader calls this local
.
Can switch contexts (including no-switch cases). Adjust printing as necessary.
getCtx :: PrintLaTeX MathContext Source #
MonadReader calls this ask
.
($+$) :: D -> D -> D infixr 6 Source #
Lifts Text.PrettyPrint's $+$. Above, with no overlapping. Associative.
List version of $$
. Above, except that if the last line of the first
argument stops at least one position before the first line of the second begins,
these two lines are overlapped.
lub :: MathContext -> MathContext -> MathContext Source #
MathContext operations.