Text.LaTeX.Packages.TikZ.Syntax

Description

This module defines the syntax of a TikZ script.

To generate a TikZ script, first create a TPath using data constructors, or alternatively, use a PathBuilder from the Text.LaTeX.Packages.TikZ.PathBuilder module.

Once a TPath is created, use path to render a picture from it. Use scope to apply some parameters to your picture, such line width or color.

Synopsis

# Points

data TPoint Source #

A point in TikZ.

Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax MethodsshowsPrec :: Int -> TPoint -> ShowS #showList :: [TPoint] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax Methods

Point using Measures for coordinantes.

Point using numbers as coordinates.

Three-dimensional point.

Makes a point relative to the previous.

# Paths

## Types

data TPath Source #

Type for TikZ paths. Every TPath has two fundamental points: the starting point and the last point. The starting point is set using the Start constructor. The last point then is modified by the other constructors. Below a explanation of each one of them. Note that both starting point and last point may coincide. You can use the functions startingPoint and lastPoint to calculate them. After creating a TPath, use path to do something useful with it.

Constructors

 Start TPoint Let y = Start p.Operation: Set the starting point of a path.Last point: The last point of y is p. Cycle TPath Let y = Cycle x.Operation: Close a path with a line from the last point of x to the starting point of x.Last point: The last point of y is the starting point of x. Line TPath TPoint Let y = Line x p.Operation: Extend the current path from the last point of x in a straight line to p.Last point: The last point of y is p. Rectangle TPath TPoint Let y = Rectangle x p.Operation: Define a rectangle using the last point of x as one corner and p as the another corner.Last point: The last point of y is p. Circle TPath Double Let y = Circle x r.Operation: Define a circle with center at the last point of x and radius r.Last point: The last point of y is the same as the last point of x. Ellipse TPath Double Double Let y = Ellipse x r1 r2.Operation: Define a ellipse with center at the last point of x, width the double of r1 and height the double of r2.Last point: The last point of y is the same as the last point of x. Grid TPath [GridOption] TPoint Node TPath LaTeX Let y = Node x l.Operation: Set a text centered at the last point of x.Last point: The last point of y is the same as the last point of x.
Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax MethodsshowsPrec :: Int -> TPath -> ShowS #show :: TPath -> String #showList :: [TPath] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax Methods

newtype GridOption Source #

Constructors

 GridStep Step
Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax MethodsshowList :: [GridOption] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax Methods

data Step Source #

Constructors

 DimStep Measure XYStep Double PointStep TPoint
Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax MethodsshowsPrec :: Int -> Step -> ShowS #show :: Step -> String #showList :: [Step] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax Methods

## Critical points

Calculate the starting point of a TPath.

Calculate the last point of a TPath.

## Functions

Alias of Line.

# Parameters

data Parameter Source #

Parameters to use in a scope to change how things are rendered within that scope.

Constructors

 TWidth Measure TColor TikZColor TScale Double TRotate Double Angle is in degrees.
Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax MethodsshowList :: [Parameter] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax Methods

data TikZColor Source #

Color models accepted by TikZ.

Constructors

 BasicColor Color RGBColor Word8 Word8 Word8
Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax MethodsshowList :: [TikZColor] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax Methods

data Color Source #

Basic colors.

Constructors

 Red Green Blue Yellow Cyan Magenta Black White
Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.Color MethodsshowsPrec :: Int -> Color -> ShowS #show :: Color -> String #showList :: [Color] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.Color Methods

data Word8 #

8-bit unsigned integer type

Instances
 Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methodssucc :: Word8 -> Word8 #pred :: Word8 -> Word8 #toEnum :: Int -> Word8 #enumFrom :: Word8 -> [Word8] #enumFromThen :: Word8 -> Word8 -> [Word8] #enumFromTo :: Word8 -> Word8 -> [Word8] #enumFromThenTo :: Word8 -> Word8 -> Word8 -> [Word8] # Since: base-2.1 Instance detailsDefined in GHC.Word Methods(==) :: Word8 -> Word8 -> Bool #(/=) :: Word8 -> Word8 -> Bool # Since: base-2.1 Instance detailsDefined in GHC.Word Methodsquot :: Word8 -> Word8 -> Word8 #rem :: Word8 -> Word8 -> Word8 #div :: Word8 -> Word8 -> Word8 #mod :: Word8 -> Word8 -> Word8 #quotRem :: Word8 -> Word8 -> (Word8, Word8) #divMod :: Word8 -> Word8 -> (Word8, Word8) # Since: base-4.0.0.0 Instance detailsDefined in Data.Data Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word8 -> c Word8 #gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word8 #dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word8) #dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word8) #gmapT :: (forall b. Data b => b -> b) -> Word8 -> Word8 #gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r #gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r #gmapQ :: (forall d. Data d => d -> u) -> Word8 -> [u] #gmapQi :: Int -> (forall d. Data d => d -> u) -> Word8 -> u #gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 #gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 #gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 # Since: base-2.1 Instance detailsDefined in GHC.Word Methods(+) :: Word8 -> Word8 -> Word8 #(-) :: Word8 -> Word8 -> Word8 #(*) :: Word8 -> Word8 -> Word8 #abs :: Word8 -> Word8 # Since: base-2.1 Instance detailsDefined in GHC.Word Methods(<) :: Word8 -> Word8 -> Bool #(<=) :: Word8 -> Word8 -> Bool #(>) :: Word8 -> Word8 -> Bool #(>=) :: Word8 -> Word8 -> Bool #max :: Word8 -> Word8 -> Word8 #min :: Word8 -> Word8 -> Word8 # Since: base-2.1 Instance detailsDefined in GHC.Read Methods Since: base-2.1 Instance detailsDefined in GHC.Word Methods Since: base-2.1 Instance detailsDefined in GHC.Word MethodsshowsPrec :: Int -> Word8 -> ShowS #show :: Word8 -> String #showList :: [Word8] -> ShowS # Since: base-2.1 Instance detailsDefined in GHC.Word Methodsrange :: (Word8, Word8) -> [Word8] #index :: (Word8, Word8) -> Word8 -> Int #unsafeIndex :: (Word8, Word8) -> Word8 -> IntinRange :: (Word8, Word8) -> Word8 -> Bool #rangeSize :: (Word8, Word8) -> Int #unsafeRangeSize :: (Word8, Word8) -> Int Instance detailsDefined in Language.Haskell.TH.Syntax Methodslift :: Word8 -> Q Exp # Instance detailsDefined in Test.QuickCheck.Function Methodsfunction :: (Word8 -> b) -> Word8 :-> b # Instance detailsDefined in Test.QuickCheck.Arbitrary Methodsshrink :: Word8 -> [Word8] # Instance detailsDefined in Test.QuickCheck.Arbitrary Methodscoarbitrary :: Word8 -> Gen b -> Gen b # Since: base-2.1 Instance detailsDefined in GHC.Word Methods(.&.) :: Word8 -> Word8 -> Word8 #(.|.) :: Word8 -> Word8 -> Word8 #xor :: Word8 -> Word8 -> Word8 #shift :: Word8 -> Int -> Word8 #rotate :: Word8 -> Int -> Word8 #bit :: Int -> Word8 #setBit :: Word8 -> Int -> Word8 #clearBit :: Word8 -> Int -> Word8 #testBit :: Word8 -> Int -> Bool #bitSize :: Word8 -> Int #shiftL :: Word8 -> Int -> Word8 #shiftR :: Word8 -> Int -> Word8 #rotateL :: Word8 -> Int -> Word8 #rotateR :: Word8 -> Int -> Word8 # Since: base-4.6.0.0 Instance detailsDefined in GHC.Word Methods Instance detailsDefined in Data.Hashable.Class MethodshashWithSalt :: Int -> Word8 -> Int #hash :: Word8 -> Int # Instance detailsDefined in Data.Text.Prettyprint.Doc.Internal Methodspretty :: Word8 -> Doc ann #prettyList :: [Word8] -> Doc ann # Instance detailsDefined in System.Random MethodsrandomR :: RandomGen g => (Word8, Word8) -> g -> (Word8, g) #random :: RandomGen g => g -> (Word8, g) #randomRs :: RandomGen g => (Word8, Word8) -> g -> [Word8] #randoms :: RandomGen g => g -> [Word8] #randomRIO :: (Word8, Word8) -> IO Word8 # Source # Instance detailsDefined in Text.LaTeX.Base.Render Methods

# TikZ

data TikZ Source #

A TikZ script.

Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax MethodsshowsPrec :: Int -> TikZ -> ShowS #show :: TikZ -> String #showList :: [TikZ] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax Methods

Just an empty script.

path :: [ActionType] -> TPath -> TikZ Source #

A path can be used in different ways.

• Draw: Just draw the path.
• Fill: Fill the area inside the path.
• Clip: Clean everything outside the path.
• Shade: Shade the area inside the path.

It is possible to stack different effects in the list.

Example of usage:

path [Draw] \$ Start (pointAtXY 0 0) ->- pointAtXY 1 1

Most common usages are exported as functions. See draw, fill, clip, shade, filldraw and shadedraw.

scope :: [Parameter] -> TikZ -> TikZ Source #

Applies a scope to a TikZ script.

Different types of actions that can be performed with a TPath. See path for more information.

Constructors

Instances
 Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax MethodsshowList :: [ActionType] -> ShowS # Source # Instance detailsDefined in Text.LaTeX.Packages.TikZ.Syntax Methods

(->>) :: TikZ -> TikZ -> TikZ Source #

Sequence two TikZ scripts.

# Sugar

Equivalent to path [Draw].

Equivalent to path [Fill].

Equivalent to path [Clip].

Equivalent to path [Shade].

Equivalent to path [Fill,Draw].

Equivalent to path [Shade,Draw].