8 LaTeX::TikZ - Perl object model for generating PGF/TikZ code.
16 our $VERSION = '0.01';
23 my $hline = Tikz->line(-1 => 1);
24 my $vline = Tikz->line([ 0, -1 ] => [ 0, -1 ]);
27 $_->mod(Tikz->color('red')) for $hline, $vline;
31 my $octo = Tikz->closed_polyline(
32 map Math::Complex->emake(1, ($_ * pi)/4), 0 .. 7
35 # Only keep a portion of it
36 $octo->clip(Tikz->rectangle(-0.5*(1+i), 2*(1+i)));
39 $octo->mod(Tikz->pattern(class => 'Dots'));
41 # Create a formatter object
42 my $tikz = Tikz->formatter;
44 # Put those objects all together and print them
45 my $seq = Tikz->seq($octo, $hline, $vline);
46 my ($head, $decl, $body) = $tikz->render($seq);
47 print "$_\n" for map @$_, $head, $decl, $body;
51 This module provides an object model for TikZ, a graphical tookit for LaTeX.
52 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.
56 use LaTeX::TikZ::Interface;
63 $name = 'Tikz' unless defined $name;
64 unless ($name =~ /^[a-z_][a-z0-9_]*$/i) {
66 Carp::confess('Invalid name');
70 my $const = sub () { 'LaTeX::TikZ::Interface' };
73 *{$pkg . '::' . $name} = $const;
76 LaTeX::TikZ::Interface->load;
83 PGF/TikZ - L<http://pgf.sourceforge.net>.
87 Vincent Pit, C<< <perl at profvince.com> >>, L<http://www.profvince.com>.
89 You can contact me by mail or on C<irc.perl.org> (vincent).
93 Please report any bugs or feature requests to C<bug-latex-tikz at rt.cpan.org>, or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LaTeX-TikZ>.
94 I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
98 You can find documentation for this module with the perldoc command.
102 =head1 COPYRIGHT & LICENSE
104 Copyright 2010 Vincent Pit, all rights reserved.
106 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
110 1; # End of LaTeX::TikZ