Pod::LaTeX - Convert Pod data to formatted Latex
Pod::LaTeX
is a module to convert documentation in the Pod format
into Latex. The pod2latex command uses
this module for translation.
Pod::LaTeX
is a derived class from Pod::Select.
The following methods are provided in this module. Methods inherited
from Pod::Select
are not described in the public interface.
initialize
Initialise the object. This method is subclassed from C
Internal settings are defaulted as well as the public instance data. Internal hash values are accessed directly (rather than through a method) and start with an underscore.
This method should not be invoked by the user directly.
The following methods are provided for accessing instance data. These methods should be used for accessing configuration parameters rather than assuming the object is a hash.
Default values can be supplied by using these names as keys to a hash
of arguments when using the C
Logical to control whether a C
- \documentclass{article}
- \usepackage[T1]{fontenc}
- \usepackage{textcomp}
- \begin{document}
but will be more complicated if table of contents and indexing are required. Can be used to set or retrieve the current value.
- $add = $parser->AddPreamble();
- $parser->AddPreamble(1);
If used in conjunction with C
For some pod escapes it may be necessary to include the amsmath package. This is not yet added to the preamble automaatically.
Logical to control whether a standard C
- \end{document}
but can be more complicated if a index is required. Can be used to set or retrieve the current value.
- $add = $parser->AddPostamble();
- $parser->AddPostamble(1);
If used in conjunction with C
The C
- [0] chapter
- [1] section
- [2] subsection
- [3] subsubsection
- [4] paragraph
- [5] subparagraph
Can be used to set or retrieve the current value:
- $parser->Head1Level(2);
- $sect = $parser->Head1Level;
Setting this number too high can result in sections that may not be reproducible
in the expected way. For example, setting this to 4 would imply that C<=head3>
do not have a corresponding C
A check is made to ensure that the supplied value is an integer in the range 0 to 5.
Default is for a value of 1 (i.e. a C
This is the label that is prefixed to all C
Can be used to set or retrieve the current value:
- $label = $parser->Label;
- $parser->Label($label);
This label is only used if C
Default value is C
Control the point at which C
Can be used to set or retrieve the current value:
- $lev = $parser->LevelNoNum;
- $parser->LevelNoNum(2);
The argument must be an integer between 0 and 5 and is the same as the
number described in C
Default is 2. (i.e. C
Controls whether C
- $makeindex = $parser->MakeIndex;
- $parser->MakeIndex(0);
Irrelevant if both C
Default is for an index to be created.
This controls whether the C
If true, the pod segment
- =head1 NAME
- pod::name - purpose
- =head1 SYNOPSIS
is converted to the C
(dependent on the value of C
The C
- $mod = $parser->ReplaceNAMEwithSection;
- $parser->ReplaceNAMEwithSection(0);
Default is to translate the pod literally.
If true, each pod translation will begin with a C
- $parser->StartWithNewPage(1);
- $newpage = $parser->StartWithNewPage;
Default is false.
If true, a table of contents will be created.
Irrelevant if C
- $toc = $parser->TableOfContents;
- $parser->TableOfContents(1);
Default is false.
If true, the translator will attempt to make sure that
each C
- $parser->UniqueLabels(1);
- $unq = $parser->UniqueLabels;
Default is true.
User supplied C
If set, the contents will be prepended to the output file before the translated
data regardless of the value of C
User supplied C
If set, the contents will be prepended to the output file after the translated
data regardless of the value of C
Contains details of the currently active lists.
The array contains C
Returns array of list information in list context Returns array ref in scalar context
The following methods override methods provided in the C
Writes the C
Write the closing C
Process basic pod commands.
Verbatim text
Plain text paragraph.
Interior sequence expansion
Methods used to handle lists.
Called when a new list is found (via the C
- $parser->begin_list($indent, $line_num);
Called when the end of a list is found (the C
- $parser->end_list($line_num);
Add items to the list. The first time an item is encountered
(determined from the state of the current C
- $parser->add_item($paragraph, $line_num);
Print a heading of the required level.
- $parser->head($level, $paragraph, $parobj);
The first argument is the pod heading level. The second argument is the contents of the heading. The 3rd argument is a Pod::Paragraph object so that the line number can be extracted.
Internal routines are described in this section. They do not form part of the public interface. All private methods start with an underscore.
Output text to the output filehandle. This method must be always be called to output parsed text.
- $parser->_output($text);
Does not write anything if a =begin is active that should be ignored.
Subroutine to replace characters that are special in C
- $escaped = $parser->_replace_special_chars($paragraph);
Need to call this routine before interior_sequences are munged but not if verbatim. It must be called before interpolation of interior sequences so that curly brackets and special latex characters inserted during interpolation are not themselves escaped. This means that < and > can not be modified here since the text still contains interior sequences.
Special characters and the C
- } \}
- { \{
- _ \_
- $ \$
- % \%
- & \&
- \ $\backslash$
- ^ \^{}
- ~ \~{}
- # \#
Replace special characters that can not be replaced before interior sequence interpolation. See C<_replace_special_chars> for a routine to replace special characters prior to interpolation of interior sequences.
Does the following transformation:
- < $<$
- > $>$
- | $|$
Return a string that can be used as an internal reference
in a C
- $label = $parser->_create_label($string)
If UniqueLabels is true returns a label prefixed by Label() This can be suppressed with an optional second argument.
- $label = $parser->_create_label($string, $suppress);
If a second argument is supplied (of any value including undef) the Label() is never prefixed. This means that this routine can be called to create a Label() without prefixing a previous setting.
Similar to C<_create_label> except an index entry is created.
If C
- $ind = $parser->_create_index($paragraph);
An exclamation mark is used by C
Removes latex commands from text. The latex command is assumed to be of the
form C<\command{ text }>. "C
- $clean = $parser->_clean_latex_commands($text);
Split the supplied string into two parts at approximately the specified word boundary. Special care is made to make sure that it does not split in the middle of some curly brackets.
e.g. "this text is \textbf{very bold}" would not be split into "this text is \textbf{very" and " bold".
- ($hunk1, $hunk2) = $self->_split_delimited( $para, $length);
The length indicates the maximum length of hunk1.
Compatible with C
A subclass of C
Some HTML escapes are missing and many have not been tested.
L
Tim Jenness E
Bug fixes and improvements have been received from: Simon Cozens
E
Copyright (C) 2000-2004 Tim Jenness. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
$Id: LaTeX.pm,v 1.19 2004/12/30 01:40:44 timj Exp $