X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLaTeX-TikZ.git;a=blobdiff_plain;f=lib%2FLaTeX%2FTikZ.pm;h=a7546719e7a89c37dc205b022a78c6ac71f6785d;hp=fc0c0940f33cc1aa7bb72552b9d35c9278a06b01;hb=e6c6fbca8df4f8df7bbce2eb98dd260ed51d9141;hpb=fcf49f47b7655e0bc3ed8c3da7f1004cbb70c7a5 diff --git a/lib/LaTeX/TikZ.pm b/lib/LaTeX/TikZ.pm index fc0c094..a754671 100644 --- a/lib/LaTeX/TikZ.pm +++ b/lib/LaTeX/TikZ.pm @@ -15,6 +15,44 @@ Version 0.01 our $VERSION = '0.01'; +=head1 SYNOPSIS + + use LaTeX::TikZ; + + # A couple of lines + my $hline = Tikz->line(-1 => 1); + my $vline = Tikz->line([ 0, -1 ] => [ 0, -1 ]); + + # Paint them in red + $_->mod(Tikz->color('red')) for $hline, $vline; + + # An octogon + use Math::Complex; + my $octo = Tikz->closed_polyline( + map Math::Complex->emake(1, ($_ * pi)/4), 0 .. 7 + ); + + # Only keep a portion of it + $octo->clip(Tikz->rectangle(-0.5*(1+i), 2*(1+i))); + + # Fill it with dots + $octo->mod(Tikz->pattern(class => 'Dots')); + + # Create a formatter object + my $tikz = Tikz->formatter; + + # Put those objects all together and print them + my $seq = Tikz->seq($octo, $hline, $vline); + my ($head, $decl, $body) = $tikz->render($seq); + print "$_\n" for map @$_, $head, $decl, $body; + +=head1 DESCRIPTION + +This module provides an object model for TikZ, a graphical tookit for LaTeX. +It allows you to build structures representing geometrical figures, apply a wide set of modifiers on them, transform them globally with functors, and print them in the context of an existing TeX document. + +=cut + use LaTeX::TikZ::Interface; sub import { @@ -40,6 +78,10 @@ sub import { return; } +=head1 SEE ALSO + +PGF/TikZ - L. + =head1 AUTHOR Vincent Pit, C<< >>, L.