HaTeX-3.11.0.1: The Haskell LaTeX library.

Safe HaskellSafe-Inferred

Text.LaTeX.Base

Contents

Description

This module exports those minimal things you need to work with HaTeX. Those things are:

Synopsis

LaTeX datatype

data LaTeX Source

Type of LaTeX blocks.

Instances

Eq LaTeX 
Floating LaTeX

Undefined methods: asinh, atanh and acosh. This instance is defined in the Text.LaTeX.Packages.AMSMath module.

Fractional LaTeX

Division uses the LaTeX frac command. This instance is defined in the Text.LaTeX.Packages.AMSMath module.

Num LaTeX

Careful! Method signum is undefined. Don't use it! This instance is defined in the Text.LaTeX.Packages.AMSMath module.

Show LaTeX 
Typeable LaTeX 
IsString LaTeX

Method fromString escapes LaTeX reserved characters using protectString.

Arbitrary LaTeX 
Monoid LaTeX

Method mappend is strict in both arguments (except in the case when the first argument is TeXEmpty).

LaTeXC LaTeX

This instance just sets liftListL = id.

Render LaTeX 
Texy LaTeX 

Escaping reserved characters

protectString :: String -> StringSource

Escape LaTeX reserved characters in a String.

protectText :: Text -> TextSource

Escape LaTeX reserved characters in a Text.

Internal re-exports

Monoids

Since the Monoid instance is the only way to append LaTeX values, a re-export of the Monoid class is given here for convenience.

class Monoid a where

The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:

  • mappend mempty x = x
  • mappend x mempty = x
  • mappend x (mappend y z) = mappend (mappend x y) z
  • mconcat = foldr mappend mempty

The method names refer to the monoid of lists under concatenation, but there are many other instances.

Minimal complete definition: mempty and mappend.

Some types can be viewed as a monoid in more than one way, e.g. both addition and multiplication on numbers. In such cases we often define newtypes and make those instances of Monoid, e.g. Sum and Product.

Methods

mempty :: a

Identity of mappend

mappend :: a -> a -> a

An associative operation

mconcat :: [a] -> a

Fold a list using the monoid. For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types.

Instances

Monoid Ordering 
Monoid () 
Monoid ByteString 
Monoid Text 
Monoid More 
Monoid All 
Monoid Any 
Monoid Text 
Monoid LaTeX

Method mappend is strict in both arguments (except in the case when the first argument is TeXEmpty).

Monoid TeXCheck 
Monoid [a] 
Monoid a => Monoid (Maybe a)

Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid: "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S." Since there is no "Semigroup" typeclass providing just mappend, we use Monoid instead.

Monoid t => Monoid (Input t) 
Monoid t => Monoid (Added t) 
Monoid a => Monoid (Dual a) 
Monoid (Endo a) 
Num a => Monoid (Sum a) 
Num a => Monoid (Product a) 
Monoid (First a) 
Monoid (Last a) 
Monoid (Seq a) 
Monoid (Vector a) 
(Ord a, Bounded a) => Monoid (Min a) 
(Ord a, Bounded a) => Monoid (Max a) 
Monoid m => Monoid (WrappedMonoid m) 
Semigroup a => Monoid (Option a) 
Monoid (Doc e) 
Monoid b => Monoid (a -> b) 
(Monoid a, Monoid b) => Monoid (a, b) 
Monoid t => Monoid (Parser t a) 
Monad m => Monoid (LaTeXT m a)

mappend = >>.

(Monoid a, Monoid b, Monoid c) => Monoid (a, b, c) 
(Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d) 
(Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e) 

(<>) :: Monoid m => m -> m -> m

An infix synonym for mappend.