Vincent Pit > LaTeX-TikZ-0.02 > LaTeX::TikZ::Formatter

Download:
LaTeX-TikZ-0.02.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.02   Source  

NAME ^

LaTeX::TikZ::Formatter - LaTeX::TikZ formatter object.

VERSION ^

Version 0.02

DESCRIPTION ^

A formatter object turns a LaTeX::TikZ::Set tree into the actual TikZ code, depending on some parameters such as the scale, the unit or the origin.

ATTRIBUTES ^

unit

The unit in which lengths are printed. Valid units are cm for centimeters and pt for points.

Defaults to cm.

format

The format used to print the numbers.

Defaults to %s.

scale

The scale of the drawing.

Defaults to 1.

width

The width of the drawing area.

Defaults to undef for none.

height

The height of the drawing area.

Defaults to undef for none.

origin

A point coerced into a LaTeX::TikZ::Point object that represents the logical origin of the printed area. If "width" and "height" are set, the canvas will be equivalent to a rectangle whose lower left corner at -$origin and of given width and length.

Defaults to (0, 0), meaning that the drawing area goes from (0, 0) to ($width, $height).

METHODS ^

id

An unique identifier of the formatter object.

render @sets

Processes all the LaTeX::TikZ::Set objects given in @sets to produce the actual TikZ code to insert in the LaTeX file. First, all the mods applied to the sets and their subsets are collected, and a declaration is emitted if needed for each of them by calling "declare" in LaTeX::TikZ::Mod. Then, the image code is generated for each set.

This method returns a list of array references :

The lines returned by "render" don't end with a line feed.

    my ($header, $declarations, $set1_body, $set2_body) = $formatter->render($set1, $set2);

    open my $tex, '>', 'test.tex' or die "open('>test.tex'): $!";

    print $tex "$_\n" for (
     "\\documentclass[12pt]{article}",
     @$header,
     "\\begin{document}",
      "\\pagestyle{empty}",
      @$declarations,
      "First set :"
      "\\begin{center}",
       @$set1_body,
      "\\end{center}",
      "Second set :"
      "\\begin{center}",
       @$set2_body,
      "\\end{center}",
     "\\end{document}",
    );

len $len

Format the given length according to the formatter options.

angle $theta

Format the given angle (in radians) according to the formatter options.

label $name, $pos

Returns the TikZ code for a point labeled $name at position $pos according to the formatter options.

thickness

Format the given line thickness according to the formatter options.

SEE ALSO ^

LaTeX::TikZ.

AUTHOR ^

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.

You can contact me by mail or on irc.perl.org (vincent).

BUGS ^

Please report any bugs or feature requests to bug-latex-tikz at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LaTeX-TikZ. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc LaTeX::TikZ

COPYRIGHT & LICENSE ^

Copyright 2010 Vincent Pit, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: