
pod2latex Command in Linux
The pod2latex command in Linux converts a POD document to LaTeX. POD (Plain Old Documentation) is a lightweight markup language for documenting Perl code, while LaTeX is a high-quality typesetting system; pod2latex converts POD into LaTeX for professional typeset documentation.
Table of Contents
Here is a comprehensive guide to the options available with the pod2latex command −
- Installation of pod2latex Command
- Syntax of pod2latex Command
- pod2latex Command Options
- Examples of pod2latex Command in Linux
Installation of pod2latex Command
The pod2latex command is a part of the libpod-latex-perl package on Debian-based distributions. It is a Perl module that converts documentation in Pod format into LaTeX.
To install the pod2latex command on Ubuntu, Kali Linux, Raspberry Pi OS, Debian, and Debian-based distributions, use the command given below −
sudo apt install libpod-latex-perl
On Fedora, use the command given below −
sudo dnf install perl-Pod-LaTeX
To verify the installation of the pod2latex command in Linux, check the path of its binary −
which pod2latex

Syntax of pod2latex Command
The syntax of the Linux pod2latex command is as follows −
pod2latex [options] [POD-file]
In the above syntax, the [options] field is used to specify various options to modify the command's behavior. The [POD-file] field is used to specify the POD file that needs to be converted to LaTeX.
pod2latex Command Options
The options of the pod2latex command are listed below −
Options | Description |
---|---|
-out | Specifies the output file name; .tex is appended if not present |
-full | Generates a complete LaTeX file with table of contents and index |
-sections | Includes or excludes specific POD sections; supports multiple entries |
-modify | Creates sections for =head1 NAME and prefixes labels with the module name |
-h1level | Sets the LaTeX section level for H1 POD directives (0 to 5, default 1) |
-help | Displays a help message and exits |
-man | Displays the manual page and exits |
-verbose | Shows processing messages |
-preamble | Adds custom LaTeX preamble; supports multiple entries separated by \n |
-postamble | Adds custom LaTeX postamble; supports multiple entries separated by \n |
-prefile | Reads LaTeX preamble from a specified file |
-postfile | Reads LaTeX postamble from a specified file |
Examples of pod2latex Command in Linux
This section demonstrates the usage of the pod2latex command in Linux with examples −
Converting a POD File to LaTeX
To convert a POD file to LaTeX, use the pod2latex command in the following way −
pod2latex file.pod

As shown in the output image, the above command will save the converted file with the source file name and .tex extension.
Converting a POD File to LaTeX and Saving it with a Different Name
To convert a POD file to LaTeX and save it with a different name, use the -out option. For example, to save the converted file with output.tex name, use the following command −
pod2latex -out output.tex file.pod

Converting a POD File to a Complete LaTeX File
To generate a complete LaTeX file, including a table of contents and index, use the -full option −
pod2latex -full file.pod
The above command produces a fully processed .tex file ready for direct compilation with LaTeX.
Specifying POD Sections to Include in the LaTeX File
To specify specific sections of the POD file to include in the LaTeX file, use the -sections option with the section names separated by a pipe (|). For example, to include the NAME and DESCRIPTION sections and exclude other sections, use the following command −
pod2latex -sections "NAME|DESCRIPTION" file.pod
Adding a Prefile and Postfile
To add a prefile and postfile to the output LaTeX file, use the following command −
pod2latex -prefile fileh.tex -postfile filet.tex file.pod
The -prefile and -postfile options include specified LaTeX content from files before and after the generated document.
Setting Custom LaTeX Section Levels
By default, in LaTeX, the \section command is used for =head1 directives in POD. To modify it use the -h1level option −
pod2latex -h1level 0 file.pod
The -h1level 0 option tells pod2latex command to treat =head1 directives as \chapter in LaTeX, instead of the default \section. A list of all levels is given below −
0 | The =head1 directive will be treated as a LaTeX \chapter (used for large documents, typically in books) |
1 | The =head1 directive will be treated as a LaTeX \section (default) |
2 | The =head1 directive will be treated as a LaTeX \subsection |
3 | The =head1 directive will be treated as a LaTeX \subsubsection |
4 | The =head1 directive will be treated as a LaTeX \paragraph |
5 | The =head1 directive will be treated as a LaTeX \subparagraph |
Getting Verbose Output
To get the verbose output while conversion, use the -verbose option with the pod2latex command −
pod2latex -verbose file.pod

Displaying Help
To display help related to the pod2latex command, use the -help option −
pod2latex -help
Conclusion
The pod2latex command in Linux is a useful tool for converting POD (Plain Old Documentation) files into LaTeX format. This command is installed through the libpod-latex-perl package on Debian-based distributions or the perl-Pod-LaTeX package on Fedora.
The pod2latex command has various options, such as specifying output file names, including specific POD sections, generating full LaTeX files with a table of contents, and customizing the preamble or postamble.