# Man page of Pod::LaTeX

## Pod::LaTeX

Section: User Contributed Perl Documentation (3pm)

Updated: 2013-05-20

### NAME

Pod::LaTeX - Convert Pod data to formatted Latex

### SYNOPSIS

  use Pod::LaTeX;
my $parser = Pod::LaTeX-&gt;new ( );$parser-&gt;parse_from_filehandle;

$parser-&gt;parse_from_file ('file.pod', 'file.tex');  ### DESCRIPTION  &quot;Pod::LaTeX&quot;  is a module to convert documentation in the Pod format into Latex. The pod2latex command uses this module for translation.  &quot;Pod::LaTeX&quot;  is a derived class from Pod::Select. ### OBJECT METHODS The following methods are provided in this module. Methods inherited from  &quot;Pod::Select&quot;  are not described in the public interface. #### Data Accessors 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  &quot;new()&quot;  constructor. AddPreamble Logical to control whether a  &quot;latex&quot;  preamble is to be written. If true, a valid  &quot;latex&quot;  preamble is written before the pod data is written. This is similar to:  \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
 &quot;AddPostamble&quot;

a full latex document will be written that could be immediately processed by
 &quot;latex&quot;

.

For some pod escapes it may be necessary to include the amsmath package. This is not yet added to the preamble automatically.

:

Logical to control whether a standard
 &quot;latex&quot;

ending is written to the output file after the document has been processed. In its simplest form this is simply:
  \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  &quot;AddPreaamble&quot;  a full latex document will be written that could be immediately processed by  &quot;latex&quot;  . : Head1Level The  &quot;latex&quot;  sectioning level that should be used to correspond to a pod  &quot;=head1&quot;  directive. This can be used, for example, to turn a  &quot;=head1&quot;  into a  &quot;latex&quot;   &quot;subsection&quot;  . This should hold a number corresponding to the required position in an array containing the following elements:  [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
 &quot;=head3&quot;

do not have a corresponding
 &quot;latex&quot;

section (
 &quot;=head1&quot;

would correspond to a
 &quot;paragraph&quot;

).

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
 &quot;section&quot;

).

:

Label
This is the label that is prefixed to all
 &quot;latex&quot;

label and index entries to make them unique. In general, pods have similarly titled sections (NAME, DESCRIPTION etc) and a
 &quot;latex&quot;

label will be multiply defined if more than one pod document is to be included in a single
 &quot;latex&quot;

file. To overcome this, this label is prefixed to a label whenever a label is required (joined with an underscore) or to an index entry (joined by an exclamation mark which is the normal index separator). For example,
 &quot;\label{text}&quot;

becomes
 &quot;\label{Label_text}&quot;

.

Can be used to set or retrieve the current value:

  $label =$parser-&gt;Label;
$parser-&gt;Label($label);


This label is only used if
 &quot;UniqueLabels&quot;

is true. Its value is set automatically from the
 &quot;NAME&quot;

field if
 &quot;ReplaceNAMEwithSection&quot;

is true. If this is not the case it must be set manually before starting the parse.
Default value is
 &quot;undef&quot;

.

:

LevelNoNum
Control the point at which
 &quot;latex&quot;

section numbering is turned off. For example, this can be used to make sure that
 &quot;latex&quot;

sections are numbered but subsections are not.

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  &quot;Head1Level&quot;  method description. The number has nothing to do with the pod heading number, only the  &quot;latex&quot;  sectioning. Default is 2. (i.e.  &quot;latex&quot;  subsections are written as  &quot;subsection*&quot;  but sections are numbered). : MakeIndex Controls whether  &quot;latex&quot;  commands for creating an index are to be inserted into the preamble and postamble $makeindex = $parser-&gt;MakeIndex;$parser-&gt;MakeIndex(0);


Irrelevant if both
 &quot;AddPreamble&quot;

and
 &quot;AddPostamble&quot;

are false (or equivalently,
 &quot;UserPreamble&quot;

and
 &quot;UserPostamble&quot;

are set).

Default is for an index to be created.

:

ReplaceNAMEwithSection
This controls whether the
 &quot;NAME&quot;

section in the pod is to be translated literally or converted to a slightly modified output where the section name is the pod name rather than NAME''.

If true, the pod segment

  =head1 NAME

pod::name - purpose


is converted to the
 &quot;latex&quot;

  \section{pod::name\label{pod_name}\index{pod::name}}

Purpose

\subsection*{SYNOPSIS\label{pod_name_SYNOPSIS}%
\index{pod::name!SYNOPSIS}}


(dependent on the value of
 &quot;Head1Level&quot;

and
 &quot;LevelNoNum&quot;

). Note that subsequent
 &quot;head1&quot;

directives translate to subsections rather than sections and that the labels and index now include the pod name (dependent on the value of
 &quot;UniqueLabels&quot;

).
The
 &quot;Label&quot;

is set from the pod name regardless of any current value of
 &quot;Label&quot;

.
  $mod =$parser-&gt;ReplaceNAMEwithSection;
$parser-&gt;ReplaceNAMEwithSection(0);  Default is to translate the pod literally. : StartWithNewPage If true, each pod translation will begin with a  &quot;latex&quot;   &quot;\clearpage&quot;  .$parser->StartWithNewPage?(1); $newpage =$parser->StartWithNewPage;

@]

Default is false.

:

TableOfContents
 &quot;AddPreamble&quot;

is false or
 &quot;UserPreamble&quot;

is set.

$toc =$parser->TableOfContents; $parser->TableOfContents?(1); @] Default is false. : UniqueLabels If true, the translator will attempt to make sure that each  &quot;latex&quot;  label or index entry will be uniquely identified by prefixing the contents of  &quot;Label&quot;  . This allows multiple documents to be combined without clashing common labels such as  &quot;DESCRIPTION&quot;  and  &quot;SYNOPSIS&quot; $parser->UniqueLabels?(1); $unq =$parser->UniqueLabels;

@]

Default is true.

:

UserPreamble
User supplied
 &quot;latex&quot;

preamble. Added before the pod translation data.
If set, the contents will be prepended to the output file before the translated data regardless of the value of
 &quot;AddPreamble&quot;

.
 &quot;MakeIndex&quot;

and
 &quot;TableOfContents&quot;

will also be ignored.

:

UserPostamble
User supplied
 &quot;latex&quot;

postamble. Added after the pod translation data.
If set, the contents will be prepended to the output file after the translated data regardless of the value of
 &quot;AddPostamble&quot;

.
 &quot;MakeIndex&quot;

will also be ignored.

:

### NOTES

Compatible with
 &quot;latex2e&quot;

only. Can not be used with
 &quot;latex&quot;

v2.09 or earlier.
A subclass of
 &quot;Pod::Select&quot;

so that specific pod sections can be converted to
 &quot;latex&quot;

by using the
 &quot;select&quot;

method.

Some HTML escapes are missing and many have not been tested.

Pod::Parser, Pod::Select, pod2latex, Pod::Simple.

### AUTHORS

Tim Jenness <[email protected]>

Bug fixes and improvements have been received from: Simon Cozens <[email protected]>, Mark A. Hershberger <[email protected]>, Marcel Grunauer <[email protected]>, Hugh S Myers <[email protected]>, Peter J Acklam <[email protected]>, Sudhi Herle <[email protected]>, Ariel Scolnicov <[email protected]>, Adriano Rodrigues Ferreira <[email protected]>, R. de Vries <[email protected]> and Dave Mitchell <[email protected]>.