HaTeX-3.17.1.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

Pretty Text 

Methods

pretty :: Text -> Doc e #

prettyList :: [Text] -> Doc e #

Render Text Source #

This instance escapes LaTeX reserved characters.

Methods

render :: Text -> Text Source #

Texy Text Source # 

Methods

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

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 Source #

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 Source #

Instances

Render Bool Source #

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

Methods

render :: Bool -> Text Source #

Render Double Source # 

Methods

render :: Double -> Text Source #

Render Float Source # 

Methods

render :: Float -> Text Source #

Render Int Source # 

Methods

render :: Int -> Text Source #

Render Integer Source # 

Methods

render :: Integer -> Text Source #

Render Word8 Source # 

Methods

render :: Word8 -> Text Source #

Render Text Source #

This instance escapes LaTeX reserved characters.

Methods

render :: Text -> Text Source #

Render TeXArg Source # 

Methods

render :: TeXArg -> Text Source #

Render LaTeX Source # 

Methods

render :: LaTeX -> Text Source #

Render Measure Source # 

Methods

render :: Measure -> Text Source #

Render TableSpec Source # 
Render HPos Source # 

Methods

render :: HPos -> Text Source #

Render Pos Source # 

Methods

render :: Pos -> Text Source #

Render Label Source # 

Methods

render :: Label -> Text Source #

Render TheoremStyle Source # 
Render Theme Source # 

Methods

render :: Theme -> Text Source #

Render CoverOption Source # 
Render OverlaySpec Source # 
Render ColorName Source # 
Render ColorModel Source # 
Render Color Source # 

Methods

render :: Color -> Text Source #

Render ColSpec Source # 

Methods

render :: ColSpec -> Text Source #

Render ActionType Source # 
Render TikZ Source # 

Methods

render :: TikZ -> Text Source #

Render Parameter Source # 
Render TikZColor Source # 
Render Step Source # 

Methods

render :: Step -> Text Source #

Render GridOption Source # 
Render TPath Source # 

Methods

render :: TPath -> Text Source #

Render TPoint Source # 

Methods

render :: TPoint -> Text Source #

Render IGOption Source # 

Methods

render :: IGOption -> Text Source #

Render PaperType Source # 
Render ClassOption Source # 
Render GeometryOption Source # 
Render Language Source # 

Methods

render :: Language -> Text Source #

Render FontEnc Source # 

Methods

render :: FontEnc -> Text Source #

Render URL Source # 

Methods

render :: URL -> Text Source #

Render HRefOption Source # 
Render a => Render [a] Source # 

Methods

render :: [a] -> Text Source #

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

Render every element of a list and append results.

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

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

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

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

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

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 Source #

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 Source #

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 Source #

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