Safe Haskell | Safe-Inferred |
---|
A simple interface to create TikZ graphics. Just build pictures using
the Figure
data constructors, and get the TikZ script using the function
figuretikz
. Use the function tikzpicture
to insert the TikZ script in
the LaTeX document. And do not forget to import the tikz
package in the
preamble.
Please, note that this module is not intended to be imported in the same module than Text.LaTeX.Packages.TikZ. This module is itself a self-contained alternative of that module. If still want to use both modules, please, use qualified imports to avoid name clashes.
In the Examples directory of the source distribution, the file tikzsimple.hs
contains a complete example of usage of this module. Below you can see a picture
along with the code it came from.
myFigure :: Figure myFigure = Scale 2 $ Figures [ RectangleFilled (0,0) 1 1 , Colored Green $ RectangleFilled (-1,1) 1 1 , Colored Red $ RectangleFilled ( 0,2) 1 1 , Colored Blue $ RectangleFilled ( 1,1) 1 1 ]
- tikz :: PackageName
- data Figure
- = Line [Point]
- | Polygon [Point]
- | PolygonFilled [Point]
- | Rectangle Point Double Double
- | RectangleFilled Point Double Double
- | Circle Point Double
- | CircleFilled Point Double
- | Ellipse Point Double Double
- | EllipseFilled Point Double Double
- | Colored Color Figure
- | LineWidth Measure Figure
- | Scale Double Figure
- | Figures [Figure]
- type Point = (Double, Double)
- data Color
- figuretikz :: Figure -> TikZ
- tikzpicture :: LaTeXC l => TikZ -> l
Documentation
Import the tikz
package to use the functions exported
by this module. For example, adding this line to your
document preamble:
usepackage [] tikz
Figures
A figure in the plane.
Line [Point] | Line along a list of points. |
Polygon [Point] | Line along a list of points, but the last point will be joined with the first one. |
PolygonFilled [Point] | Same as |
Rectangle Point Double Double | Rectangle with top-right corner at the given point and width and height given by the other parameters. |
RectangleFilled Point Double Double | Same as |
Circle Point Double | Circle centered at the given point with the given radius. |
CircleFilled Point Double | As in |
Ellipse Point Double Double | Ellipse centered at the given point with width and height given by the other parameters. |
EllipseFilled Point Double Double | Same as |
Colored Color Figure | Color for the given |
LineWidth Measure Figure | Line width for the given |
Scale Double Figure | Scaling of the given |
Figures [Figure] | A figure composed by a list of figures. |
Basic colors.
Figure scripting
tikzpicture :: LaTeXC l => TikZ -> lSource
Transform a TikZ script to a LaTeX
block.