diagrams-pgf-1.4: PGF backend for diagrams drawing EDSL.

Copyright(c) 2015 Diagrams team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Backend.PGF.CmdLine

Contents

Description

Convenient creation of command-line-driven executables for rendering diagrams using the PGF backend.

Synopsis

General form of main

The mainWith method unifies all of the other forms of main and is now the recommended way to build a command-line diagrams program. It works as a direct replacement for defaultMain or multiMain as well as allowing more general arguments. For example, given a function that produces a diagram when given an Int and a Colour Double, mainWith will produce a program that looks for additional number and color arguments.

... definitions ...
f :: Int -> Colour Double -> Diagram PGF
f i c = ...

main = mainWith f

We can run this program as follows:

$ ghc --make mydiagram

# output image.tex built by `f 20 red`
$ ./MyDiagram -o image.tex -w 200 20 red

mainWith :: (Mainable d, Parseable (MainOpts d)) => d -> IO () #

Main entry point for command-line diagram creation. This is the method that users will call from their program main. For instance an expected user program would take the following form.

import Diagrams.Prelude
import Diagrams.Backend.TheBestBackend.CmdLine

d :: Diagram B R2
d = ...

main = mainWith d

Most backends should be able to use the default implementation. A different implementation should be used to handle more complex interactions with the user.

Supported forms of main

mainWithSurf :: Surface -> Diagram PGF -> IO () Source #

Allows you to pick a surface the diagram will be rendered with. (This

onlineMain :: OnlineTex (Diagram PGF) -> IO () Source #

Same as defaultMain but takes an online pgf diagram.

onlineMainWithSurf :: Surface -> OnlineTex (Diagram PGF) -> IO () Source #

Same as mainWithSurf but takes an online pgf diagram.

Orphan instances

Parseable TexFormat Source # 
ToResult d => ToResult (OnlineTex d) Source # 

Associated Types

type Args (OnlineTex d) :: * #

type ResultOf (OnlineTex d) :: * #

Methods

toResult :: OnlineTex d -> Args (OnlineTex d) -> ResultOf (OnlineTex d) #

TypeableFloat n => Mainable [(String, QDiagram PGF V2 n Any)] Source # 

Associated Types

type MainOpts [(String, QDiagram PGF V2 n Any)] :: * #

TypeableFloat n => Mainable (OnlineTex (QDiagram PGF V2 n Any)) Source # 
TypeableFloat n => Mainable (Surface, QDiagram PGF V2 n Any) Source # 
TypeableFloat n => Mainable (Surface, OnlineTex (QDiagram PGF V2 n Any)) Source # 
TypeableFloat n => Mainable (QDiagram PGF V2 n Any) Source # 

Associated Types

type MainOpts (QDiagram PGF V2 n Any) :: * #