LinuxCommandLibrary

pod2latex.

Convert Perl POD format to LaTeX

SYNOPSIS

pod2latex [OPTIONS] [file...]
Reads from STDIN if no files are specified.

PARAMETERS

--infile=<file>
    Specifies an input POD file. This option can be used multiple times to process several input files concurrently.

--outfile=<file>
    Specifies the output LaTeX file. If not provided, the generated LaTeX content is printed to standard output (STDOUT).

--section=<level>
    Sets the LaTeX sectioning level for =head1 POD sections. Common values include chapter, section, or subsection. The default is chapter.

--section-level=<N>
    Provides a numerical LaTeX sectioning level for =head1 (e.g., -1 for \part, 0 for \chapter, 1 for \section). This option overrides --section if both are used.

--full
    Ensures that a complete LaTeX document structure is generated, including a standard preamble and postamble. This is typically the default behavior.

--contents
    Generates a LaTeX table of contents for the document, usually placed at the beginning of the document.

--index
    Generates a LaTeX index for the document. Note that this feature requires the makeidx package and an additional compilation step with `makeindex` after `pdflatex`.

--latex-header=<text>
    Allows adding custom lines directly into the LaTeX document's preamble, useful for including specific packages or commands.

--latex-footer=<text>
    Adds custom lines directly before the \end{document} command in the generated LaTeX file.

--encoding=<encoding>
    Specifies the character encoding of the input POD file, such as UTF-8. This ensures correct interpretation of special characters.

--podpath=<dir:dir...>
    A colon-separated list of directories where pod2latex should search for POD files referenced by L<name> (internal links).

--podroot=<dir>
    Specifies the base directory for constructing relative paths when looking up POD files specified by --podpath.

--verbose
    Enables verbose output, displaying additional processing information and status messages during conversion.

--help
    Displays a brief usage message with available options and then exits.

--version
    Prints the version information of pod2latex and then exits.

DESCRIPTION

The pod2latex command is a utility that transforms documentation written in Perl's Plain Old Documentation (POD) format into LaTeX, a high-quality typesetting system. POD is a simple markup language primarily used for documenting Perl modules, scripts, and their APIs. By converting POD to LaTeX, developers can generate professional-looking documentation suitable for printing, PDF generation, or integration into larger LaTeX projects. This conversion process intelligently handles various POD constructs, including text formatting (bold, italic), code blocks, nested lists, and internal/external links, translating them into appropriate LaTeX commands and environments. The output is a complete LaTeX document, typically including a standard preamble, ready to be processed by a LaTeX compiler like `pdflatex`.

CAVEATS

While pod2latex strives to produce valid and well-formatted LaTeX, highly complex POD structures, or specific non-standard character usage might sometimes require manual adjustment of the generated .tex file. The resulting LaTeX document relies on standard LaTeX packages like graphicx (for image inclusion), url (for URL formatting), and hyperref (for clickable links and TOC), which must be present in your LaTeX distribution. Generating an index or cross-references often necessitates running the LaTeX compiler multiple times, potentially in conjunction with external tools like makeindex.

POST-CONVERSION WORKFLOW

After generating the .tex file with pod2latex, it must be compiled into a viewable document (e.g., PDF) using a LaTeX engine. A typical workflow involves:
pod2latex mydocument.pod > mydocument.tex
pdflatex mydocument.tex
For internal cross-references, tables of contents, or indexes to be correctly generated and updated, it is often necessary to run pdflatex two or three times. If an index is used (with --index), an additional step with `makeindex` between `pdflatex` runs is required: `pdflatex mydocument.tex`, `makeindex mydocument.idx`, `pdflatex mydocument.tex`.

ESSENTIAL LATEX PACKAGE DEPENDENCIES

The LaTeX output from pod2latex typically requires several common LaTeX packages to be installed and available in your TeX distribution. These include: graphicx (for handling graphics and images, especially for code blocks rendered as images), url (for proper formatting of web addresses), and hyperref (crucial for creating clickable links within the PDF and for generating an interactive table of contents).

HISTORY

pod2latex is an integral part of the Perl distribution's comprehensive suite of POD utilities. It was initially developed by Bradford Smith and has since been maintained and improved by the Perl community. Its evolution parallels that of the Perl language and its Plain Old Documentation (POD) standard, reflecting the ongoing need to seamlessly bridge simple text-based documentation with professional, high-quality typesetting systems like LaTeX for diverse publication needs.

SEE ALSO

perlpod(1), pod2html(1), pod2man(1), pod2text(1), latex(1), pdflatex(1)

Copied to clipboard