++ed by:
Vincent Pit

# NAME

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

Version 0.03

# 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.

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  my ($header_lines, $mod_lines,$content_lines) = $formatter->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 first one contains the header lines to include between the \documentclass and the \begin{document}. • The second one contains the mod declaration lines to put inside the document, between \begin{document} and \end{document}. • Finally, there's one array reference for each given TikZ set, which contain the lines for the actual TikZ pictures. 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}",
);

    my $physical_len =$formatter->len($logical_len); Format the given length according to the formatter options. ## angle  my$physical_angle = $formatter->angle($logical_angle);

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

## label

    my $label =$formatter->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.

# 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