Copyright | (c) 2015 Christopher Chalmers |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | None |
Language | Haskell2010 |
A Surface
defines how a pgfpicture should be placed and compiled. Surfaces
are used for rendering a .tex
or .pdf
using functions from
PGF
.
Surfaces are also used in Hbox
for querying
envelopes of text.
Surfaces for Latex, Context and plain Tex are provided and reexported by Diagrams.Backend.PGF. Lenses here allow these to be adjusted as required.
- data Surface = Surface {}
- data TexFormat
- surfOnlineTex :: Surface -> OnlineTex a -> a
- surfOnlineTexIO :: Surface -> OnlineTex a -> IO a
- latexSurface :: Surface
- contextSurface :: Surface
- plaintexSurface :: Surface
- sampleSurfaceOutput :: Surface -> String
- texFormat :: Lens' Surface TexFormat
- command :: Lens' Surface String
- arguments :: Lens' Surface [String]
- pageSize :: Lens' Surface (Maybe (V2 Int -> String))
- preamble :: Lens' Surface String
- beginDoc :: Lens' Surface String
- endDoc :: Lens' Surface String
Surface definition
Surface | |
|
The TexFormat
is used to choose the different PGF commands nessesary for
that format.
Online rendering with surfaces
surfOnlineTex :: Surface -> OnlineTex a -> a Source
Get the result of an OnlineTex using the given surface.
surfOnlineTexIO :: Surface -> OnlineTex a -> IO a Source
Get the result of an OnlineTex using the given surface.
Predefined surfaces
latexSurface :: Surface Source
Default surface for latex files by calling pdflatex
.
Sample output
contextSurface :: Surface Source
Default surface for latex files by calling pdflatex
.
Sample output
command
: context --pipe --once %preamble
usemodule[pgf] setuppagenumbering[location=] %pageSize
definepapersize[diagram][width=100bp,height=80bp] setuppapersize[diagram][diagram] setuplayout [ topspace=0bp , backspace=0bp , header=0bp , footer=0bp , width=100bp , height=80bp ] %beginDoc
starttext <Context pgf code> %endDoc
stoptext
plaintexSurface :: Surface Source
Default surface for latex files by calling pdflatex
.
Sample output
Lenses
preamble :: Lens' Surface String Source
Preamble for the tex document. This should at least import
pgfcore
.