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.
Synopsis
- 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 | |
|
Instances
Eq Surface Source # | |
Default Surface Source # | Latex is the default surface. |
Defined in Diagrams.Backend.PGF.Surface | |
Hashable Surface Source # | |
Defined in Diagrams.Backend.PGF.Surface | |
TypeableFloat n => Mainable (Surface, QDiagram PGF V2 n Any) Source # | |
Defined in Diagrams.Backend.PGF.CmdLine | |
TypeableFloat n => Mainable (Surface, OnlineTex (QDiagram PGF V2 n Any)) Source # | |
Defined in Diagrams.Backend.PGF.CmdLine mainArgs :: Parseable (MainOpts (Surface, OnlineTex (QDiagram PGF V2 n Any))) => proxy (Surface, OnlineTex (QDiagram PGF V2 n Any)) -> IO (MainOpts (Surface, OnlineTex (QDiagram PGF V2 n Any))) # mainRender :: MainOpts (Surface, OnlineTex (QDiagram PGF V2 n Any)) -> (Surface, OnlineTex (QDiagram PGF V2 n Any)) -> IO () # mainWith :: (Surface, OnlineTex (QDiagram PGF V2 n Any)) -> IO () # | |
type MainOpts (Surface, QDiagram PGF V2 n Any) Source # | |
type MainOpts (Surface, OnlineTex (QDiagram PGF V2 n Any)) Source # | |
The TexFormat
is used to choose the different PGF commands necessary 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
sampleSurfaceOutput :: Surface -> String Source #
Lenses
pageSize :: Lens' Surface (Maybe (V2 Int -> String)) Source #
Specify the page size for the tex file.
preamble :: Lens' Surface String Source #
Preamble for the tex document. This should at least import
pgfcore
.