HaTeX-3.18.0.0: The Haskell LaTeX library.

Safe HaskellSafe
LanguageHaskell2010

Text.LaTeX.Base.Render

Contents

Description

The final purpose of this module is to render a Text value from a LaTeX value. The interface is abstracted via a typeclass so you can cast to Text other types as well. Also, some other handy Text-related functions are defined.

Synopsis

Re-exports

data Text :: * #

A space efficient, packed, unboxed Unicode text type.

Instances

Hashable Text 

Methods

hashWithSalt :: Int -> Text -> Int #

hash :: Text -> Int #

Pretty Text 

Methods

pretty :: Text -> Doc e #

prettyList :: [Text] -> Doc e #

Render Text #

This instance escapes LaTeX reserved characters.

Methods

render :: Text -> Text #

Texy Text # 

Methods

texy :: LaTeXC l => Text -> l #

Monad m => Stream Text m Char 

Methods

uncons :: Text -> m (Maybe (Char, Text)) #

type Item Text 
type Item Text = Char

Render class

class Show a => Render a where #

Class of values that can be transformed to Text. You mainly will use this to obtain the Text output of a LaTeX value. If you are going to write the result in a file, consider to use renderFile.

Consider also to use rendertex to get Renderable values into LaTeX blocks.

If you want to make a type instance of Render and you already have a Show instance, you can use the default instance.

render = fromString . show

Methods

render :: a -> Text #

Instances

Render Bool #

Render instance for Bool. It satisfies render True = "true" and render False = "false".

Methods

render :: Bool -> Text #

Render Double # 

Methods

render :: Double -> Text #

Render Float # 

Methods

render :: Float -> Text #

Render Int # 

Methods

render :: Int -> Text #

Render Integer # 

Methods

render :: Integer -> Text #

Render Word8 # 

Methods

render :: Word8 -> Text #

Render Text #

This instance escapes LaTeX reserved characters.

Methods

render :: Text -> Text #

Render TeXArg # 

Methods

render :: TeXArg -> Text #

Render LaTeX # 

Methods

render :: LaTeX -> Text #

Render Measure # 

Methods

render :: Measure -> Text #

Render TableSpec # 

Methods

render :: TableSpec -> Text #

Render HPos # 

Methods

render :: HPos -> Text #

Render Pos # 

Methods

render :: Pos -> Text #

Render Label # 

Methods

render :: Label -> Text #

Render PaperType # 

Methods

render :: PaperType -> Text #

Render ClassOption # 

Methods

render :: ClassOption -> Text #

Render TheoremStyle # 

Methods

render :: TheoremStyle -> Text #

Render Language # 

Methods

render :: Language -> Text #

Render Theme # 

Methods

render :: Theme -> Text #

Render CoverOption # 

Methods

render :: CoverOption -> Text #

Render OverlaySpec # 

Methods

render :: OverlaySpec -> Text #

Render ColorName # 

Methods

render :: ColorName -> Text #

Render ColorModel # 

Methods

render :: ColorModel -> Text #

Render Color # 

Methods

render :: Color -> Text #

Render ColSpec # 

Methods

render :: ColSpec -> Text #

Render FontEnc # 

Methods

render :: FontEnc -> Text #

Render GeometryOption # 
Render IGOption # 

Methods

render :: IGOption -> Text #

Render URL # 

Methods

render :: URL -> Text #

Render HRefOption # 

Methods

render :: HRefOption -> Text #

Render ActionType # 

Methods

render :: ActionType -> Text #

Render TikZ # 

Methods

render :: TikZ -> Text #

Render Parameter # 

Methods

render :: Parameter -> Text #

Render TikZColor # 

Methods

render :: TikZColor -> Text #

Render Step # 

Methods

render :: Step -> Text #

Render GridOption # 

Methods

render :: GridOption -> Text #

Render TPath # 

Methods

render :: TPath -> Text #

Render TPoint # 

Methods

render :: TPoint -> Text #

Render a => Render [a] # 

Methods

render :: [a] -> Text #

renderAppend :: Render a => [a] -> Text #

Render every element of a list and append results.

renderChars :: Render a => Char -> [a] -> Text #

Render every element of a list and append results, separated by the given Char.

renderCommas :: Render a => [a] -> Text #

Render every element of a list and append results, separated by commas.

renderFile :: Render a => FilePath -> a -> IO () #

Use this function to render a LaTeX (or another one in the Render class) value directly in a file.

rendertex :: (Render a, LaTeXC l) => a -> l #

If you can transform a value to Text, you can insert that Text in your LaTeX code. That is what this function does.

Warning: rendertex does not escape LaTeX reserved characters. Use protectText to escape them.

Reading files

readFileTex :: FilePath -> IO Text #

If you are going to insert the content of a file in your LaTeX data, use this function to ensure your encoding is correct.

Util

showFloat :: RealFloat a => a -> String #

Show a signed floating number using standard decimal notation using 5 decimals.