HaTeX-3.5: The Haskell LaTeX library.

Safe HaskellNone

Text.LaTeX.Base.Syntax

Contents

Description

LaTeX syntax description in the definition of the LaTeX datatype. If you want to add new commands or environments not defined in the library, import this module and use LaTeX data constructors.

Synopsis

LaTeX datatype

data Measure Source

Measure units defined in LaTeX. Use CustomMeasure to use commands like textwidth. For instance:

 rule Nothing (CustomMeasure linewidth) (Pt 2)

This will create a black box (see rule) as wide as the text and two points tall.

Constructors

Pt Int

A point is 1/72.27 inch, that means about 0.0138 inch or 0.3515 mm.

Mm Double

Millimeter.

Cm Double

Centimeter.

In Double

Inch.

Ex Double

The height of an "x" in the current font.

Em Double

The width of an "M" in the current font.

CustomMeasure LaTeX

You can introduce a LaTeX expression as a measure.

data MathType Source

Different types of syntax for mathematical expressions.

Constructors

Parentheses 
Square 
Dollar 

data LaTeX Source

Type of LaTeX blocks.

Constructors

TeXRaw Text

Raw text.

TeXComm String [TeXArg]

Constructor for commands. First argument is the name of the command. Second, its arguments.

TeXCommS String

Constructor for commands with no arguments.

TeXEnv String [TeXArg] LaTeX

Constructor for environments. First argument is the name of the environment. Second, its arguments. Third, its content.

TeXMath MathType LaTeX

Mathematical expressions.

TeXLineBreak (Maybe Measure) Bool

Line break command.

TeXOp String LaTeX LaTeX

Operators.

TeXBraces LaTeX

A expression between braces.

TeXComment Text

Comments.

TeXSeq LaTeX LaTeX

Sequencing of LaTeX expressions. Use <> preferably.

TeXEmpty

An empty block. Neutral element of <>.

Instances

Eq LaTeX 
Floating LaTeX

Undefined methods: asinh, atanh and acosh.

Fractional LaTeX

Division uses the LaTeX frac command.

Num LaTeX

Careful! Method signum is undefined. Don't use it!

Show LaTeX 
IsString LaTeX

Method fromString escapes LaTeX reserved characters using protectString.

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 

data TeXArg Source

An argument for a LaTeX command or environment.

Constructors

OptArg LaTeX

Optional argument.

FixArg LaTeX

Fixed argument.

MOptArg [LaTeX]

Multiple optional argument.

SymArg LaTeX

An argument enclosed between < and >.

MSymArg [LaTeX]

Version of SymArg with multiple options.

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

An infix synonym for mappend.

Escaping reserved characters

protectString :: String -> StringSource

Escape LaTeX reserved characters in a String.

protectText :: Text -> TextSource

Escape LaTeX reserved characters in a Text.