Math::Geometry::Construction::Draw::TikZ - TikZ output
Math::Geometry::Construction::Draw::TikZ
Version 0.021
use Math::Geometry::Construction; my $construction = Math::Geometry::Construction->new; my $p1 = $construction->add_point('x' => 100, 'y' => 150); my $p2 = $construction->add_point('x' => 130, 'y' => 110); my $l1 = $construction->add_line(extend => 10, support => [$p1, $p2]); my $tikz = $construction->as_tikz(width => 8, height => 3, view_box => [0, 0, 800, 300], svg_mode => 1); my (undef, undef, $body) = Tikz->formatter->render($tikz); my $string = sprintf("%s\n", join("\n", @$body)); print <<END_OF_TEX; \\documentclass{article} \\usepackage{tikz} \\begin{document} $string\\end{document} END_OF_TEX
This class implements the Math::Geometry::Construction::Draw interface in order to generate TikZ code to be used in LaTeX. It is instantiated by the draw method in Math::Geometry::Construction.
TikZ
LaTeX
Math::Geometry::Construction
The output created by this class will be a LaTeX::TikZ::Set::Sequence object. See SYNOPSIS.
LaTeX::TikZ::Set::Sequence
SYNOPSIS
Key/value pairs in the style settings of lines, circles etc. are translated into raw_mod calls
raw_mod
while(my ($key, $value) = each(%style)) { $raw->mod(TikZ->raw_mod("$key=$value")); }
See LaTeX::TikZ if you want to know what this code exactly does. Anyway, the important part is that you should be able to use any modifier that TikZ understands. See also svg_mode|/svg_mode.
svg_mode|/svg_mode
Defaults to 0. If set to a true value, SVG style attributes are mapped to TikZ attributes internally. The idea behind this is that you might want to use the same construction including style settings for both SVG and TikZ export. This feature is experimental and will probably never cover the full SVG and/or TikZ functionality.
0
SVG
Currently, only stroke is mapped to color, and this is done literally. It will therefore only work for named colors which exist in both output formats.
stroke
color
Defaults to 0. If set to a true value, all text is printed in LaTeX's math mode. Again, this is to enable the same code to be used for TikZ along side other output formats while still typesetting labels in math mode.
See Math::Geometry::Construction::Draw.
LaTeX::TikZ
http://en.wikipedia.org/wiki/PGF/TikZ
http://www.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf
Lutz Gehlen, <perl at lutzgehlen.de>
<perl at lutzgehlen.de>
Copyright 2011,2013 Lutz Gehlen.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Math::Geometry::Construction, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Geometry::Construction
CPAN shell
perl -MCPAN -e shell install Math::Geometry::Construction
For more information on module installation, please visit the detailed CPAN module installation guide.