HaTeX-3.22.3.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 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Text -> Int #

hash :: Text -> Int #

Pretty Text

Automatically converts all newlines to line.

>>> pretty ("hello\nworld" :: Text)
hello
world

Note that line can be undone by group:

>>> group (pretty ("hello\nworld" :: Text))
hello world

Manually use hardline if you definitely want newlines.

Instance details

Defined in Prettyprinter.Internal

Methods

pretty :: Text -> Doc ann #

prettyList :: [Text] -> Doc ann #

Render Text Source #

This instance escapes LaTeX reserved characters.

Instance details

Defined in Text.LaTeX.Base.Render

Texy Text Source # 
Instance details

Defined in Text.LaTeX.Base.Texy

Methods

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

Monad m => Stream Text m Char 
Instance details

Defined in Text.Parsec.Prim

Methods

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

type Item Text 
Instance details

Defined in Data.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

Minimal complete definition

Nothing

Instances
Render Bool Source #

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

Instance details

Defined in Text.LaTeX.Base.Render

Render Double Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Render Float Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Render Int Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Render Integer Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Render Word8 Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Render Text Source #

This instance escapes LaTeX reserved characters.

Instance details

Defined in Text.LaTeX.Base.Render

Render TeXArg Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Render LaTeX Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Render Measure Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Render TableSpec Source # 
Instance details

Defined in Text.LaTeX.Base.Types

Render HPos Source # 
Instance details

Defined in Text.LaTeX.Base.Types

Render Pos Source # 
Instance details

Defined in Text.LaTeX.Base.Types

Render Label Source # 
Instance details

Defined in Text.LaTeX.Base.Types

Render PaperType Source # 
Instance details

Defined in Text.LaTeX.Base.Commands

Render ClassOption Source # 
Instance details

Defined in Text.LaTeX.Base.Commands

Render TheoremStyle Source # 
Instance details

Defined in Text.LaTeX.Packages.AMSThm

Render Language Source # 
Instance details

Defined in Text.LaTeX.Packages.Babel

Render Theme Source # 
Instance details

Defined in Text.LaTeX.Packages.Beamer

Render CoverOption Source # 
Instance details

Defined in Text.LaTeX.Packages.Beamer

Render OverlaySpec Source # 
Instance details

Defined in Text.LaTeX.Packages.Beamer

Render ColorName Source # 
Instance details

Defined in Text.LaTeX.Packages.Color

Render ColorModel Source # 
Instance details

Defined in Text.LaTeX.Packages.Color

Render Color Source # 
Instance details

Defined in Text.LaTeX.Packages.Color

Render ColSpec Source # 
Instance details

Defined in Text.LaTeX.Packages.Color

Render FontEnc Source # 
Instance details

Defined in Text.LaTeX.Packages.Fontenc

Render GeometryOption Source # 
Instance details

Defined in Text.LaTeX.Packages.Geometry

Render IGOption Source # 
Instance details

Defined in Text.LaTeX.Packages.Graphicx

Render URL Source # 
Instance details

Defined in Text.LaTeX.Packages.Hyperref

Render HRefOption Source # 
Instance details

Defined in Text.LaTeX.Packages.Hyperref

Render BigStrutsCount Source # 
Instance details

Defined in Text.LaTeX.Packages.Multirow

Render ActionType Source # 
Instance details

Defined in Text.LaTeX.Packages.TikZ.Syntax

Render TikZ Source # 
Instance details

Defined in Text.LaTeX.Packages.TikZ.Syntax

Render Parameter Source # 
Instance details

Defined in Text.LaTeX.Packages.TikZ.Syntax

Render TikZColor Source # 
Instance details

Defined in Text.LaTeX.Packages.TikZ.Syntax

Render Step Source # 
Instance details

Defined in Text.LaTeX.Packages.TikZ.Syntax

Render GridOption Source # 
Instance details

Defined in Text.LaTeX.Packages.TikZ.Syntax

Render TPath Source # 
Instance details

Defined in Text.LaTeX.Packages.TikZ.Syntax

Render TPoint Source # 
Instance details

Defined in Text.LaTeX.Packages.TikZ.Syntax

Render a => Render [a] Source # 
Instance details

Defined in Text.LaTeX.Base.Render

Methods

render :: [a] -> Text Source #

renderBuilder :: [a] -> Builder 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.