LATEX2MAN(1)
πΈ LATEX2MAN(1) β the page where I explain latex2man to you, bestie πΈ
Documentation Tools energy, ok? This is the manual page for latex2man, and I'm gonna walk you through every single bit of it, no cap π«Ά
β¨ NAME β¨
Latex2man is literally a tool that translates UNIX manual pages written with LaTeX into a format that the UNIX man(1) command understands. Like, it takes your fancy LaTeX man page and makes it readable by plain old man. π
Also? You can produce HTML, TexInfo, or LaTeX code too, if that's more your vibe. And you can suppress the output of parts of the text using the conditional text feature β for that one you'd use LaTeX generation. iykyk.
β¨ SYNOPSIS β¨
latex2man [-ttransfile] [-cCSSfile] [-HMTL] [-h] [-V] [-Cname] [-achar]
infile outfile
yes the [-HMTL] is written exactly like that in the original, I don't make the rules, I just slay π
β¨ DESCRIPTION β¨
Latex2man reads the file infile and writes outfile. Simple as that, bestie. The input has to be a LaTeX document using the latex2man LaTeX package, and Latex2man translates that document into the troff(1) format using the -man macro package. π₯
Using the -H option, HTML code can be produced instead of troff(1). With this option you can, optionally, specify a CSSfile as an argument. CSS (Cascading Style Sheets) lets you control the appearance of the resulting HTML page β main character energy for your webpage. π See below for the names of CSS classes that are included in the HTML tags as attributes.
Using the -T option, TexInfo code can be produced, instead of troff(1).
Using the -M option, troff(1) input is produced.
Using the -L option, LaTeX ouput can be produced, instead of troff(1). (yes, "ouput", it's giving typo but we keep it π)
β¨ OPTIONS β¨
-ttransfileβ translation for user defined LaTeX macros.-cCSSfileβ if you use the-Hyou can also specify a file that contains CSS style sheets. The link to the CSS file is inserted into the generated HTML output using the specified CSSfile filename. π¨-Mβ produce output suitable for theman(1)command (this is the default, so it's doing the most without even trying).-Hβ instead of producing output suitable for theman(1)command, HTML code is produced (despite the name of the command, lol, iconic).-Tβ instead of producing output suitable for theman(1)command, TexInfo code is produced (despite the name of the command). The generated.texi-file may be processed withmakeinfo(1)(to produce an.info-file) which in turn may be installed usinginstall-info(1). The Info tags@dircategoryand@direntryare provided. π-Lβ the LaTeX source is written to the outfile. This is useful in conjunction with the-Cnameoption.-Cnameβ output the conditional text for name. If more than one name should be given use quotes:-C'name1 name2 ...'The following names are defined automatically:-HdefinesHTML-TdefinesTEXI-MdefinesMAN-LdefinesLATEX
-acharβ is used only in conjunction with-T. Background: TexInfo ignores all blanks before the first word on a new line. In order to produce some additional space before that word (using\SP) some character has to be printed before the additional space. By default this is a.(dot). The char specifies an alternative for that first character. Giving a blank to-asupresses the indentation of a line. Note: only for the first\SPof a series that char is printed. π«Ά-hβ show a help text.-Vβ show version information.
β¨ FILES β¨
latex2man.texβ the LaTeX file containing this Man-page. πlatex2man.incβ a file read with\input{..}.latex2man.styβ the LaTeX package defining the environments and commands.latex2man.cfgβ the configuration file for Latex2man LaTeX-package.latex2man.cssβ file containing example CSS definitions. πlatex2man.transβ file containing example translations of user defined LaTeX macros.fancyheadings.styβ a LaTeX package used to typeset head- and foot lines.fancyhdr.styβ a LaTeX package used to typeset head- and foot lines.rcsinfo.styβ a LaTeX package used to extract and use RCS version control information in LaTeX documents. ποΈlatex2man.pdfβ the PDF version of this document.
β¨ SEE ALSO β¨
LaTeX, TexInfo, troff(1), groff(1), makeinfo(1).
π LaTeX COMMANDS π
The LaTeX package latex2man is used to write the Man-pages with LaTeX. Since we translate into other text formats, not all LaTeX stuff can be translated. Yeah. Not everything makes the cut, and honestly? relatable. π
πΈ PACKAGE OPTIONS πΈ
The latex2man package accepts the following options:
fancyβ use the LaTeX packagefancyheadings.fancyhdrβ use the LaTeX packagefancyhdr.nofancyβ neither the LaTeX packagefancyheadingsnorfancyhdrare used.
The default option may be specified in the file latex2man.cfg. π
πΈ PACKAGE SPECIFIC ENVIRONMENTS πΈ
The following environments are provided by the package:
\begin{Name}{chapter}{name}{author}{info}{title}β theNameenvironment takes five arguments:- the Man-page chapter,
- the name of the Man-page,
- the author,
- some short information about the tool printed in the footline of the Man-page, and
- a text which is used as title, for HTML and LaTeX (it's ignored for output of the Man-page or TeXinfo).
The Name environment must be the first environment in the document. Processing starts with this environment. Any text before this is ignored (exception: the setVersion and setDate commands). (Note: all arguments of \begin{Name} must be written on one line). π
\begin{Table}[width]{columns}β theTableenvironment takes two arguments: the first optional one specifies a width of the last column, the second one gives the number of columns. For example:
\begin{Table}[2cm]{3}
Here & am & I \\\hline
A 1 & A 2 & A 3 1 2 3 4 5 A 3 1 2 3 4 5 \\
B 1 & B 2 & B 3 \\
\end{Table}
will be typeset as:
Here am I
ββββββββββββββββββββββ
A 1 A 2 A 3 1 2
3 4 5 A
3 1 2 3
4 5
B 1 B 2 B 3
If no optional width argument is given, all entries are typeset left justified. The width is a length measured absolutly in cm. Processing with LaTeX a p{width} column is typeset as last column. The translation to troff(1) commands results in a lw(width) column specification. Translating to HTML and TexInfo ignores the width parameter.
\hline may be used.
β οΈ If the Man-page is formatted withtroff(1)and tables are used, thetbl(1)preprocessor should be called, usually by giving a-tto the call oftroff(1). When viewing the generated manula page usingman(1),tbl(1)is called automatically.
\begin{Description}β is the same as\begin{description}.\begin{Description}[label]β is similar to\begin{description}, but the item labels have at minimum the size of the (optional) word label. The difference is visible only in the DVI and PDF-output, not in the troff, TexInfo or HTML output. π¦
a |a \begin{description}
ab |ab
abc |abc
a |a \begin{Description}
ab |ab
abc |abc
a |a \begin{Description}[aa]
ab |ab
abc |abc
πΈ ACCEPTED LaTeX ENVIRONMENTS πΈ
The following environments are accepted:
descriptionenumerateitemizeverbatimcenter
They may be nested:
- Itemize and nested
center:
A centered line.
Another centered line.
- Another item an nested
enumerate- a
- b
πΈ PACKAGE SPECIFIC MACROS πΈ
The following commands are provided:
\Opt{option}β Option:\Opt{-o}will be typeset as-o. β¨\Arg{argument}β Argument:\Arg{filename}will be typeset asfilename.\OptArg{option}{argument}β Option with Argument:\OptArg{-o}{filename}will be typeset as-ofilename.\OptoArg{option}{argument}β Option with optional Argument:\OptoArg{-o}{filename}will be typeset as-o[filename].\oOpt{option}β Optional option, e.g.\oOpt{-o}will be typeset as[-o].\oArg{argument}β Optional argument, e.g.\oArg{filename}will be typeset as[filename].\oOptArg{option}{argument}β Optional option with argument, e.g.\oOptArg{-o}{filename}will be typeset as[-ofilename].\oOptoArg{option}{argument}β Optional option with optional argument, e.g.\oOptoArg{-o}{filename}will be typeset as[-o[filename]].\File{filename}β used to typeset filenames, e.g.\File{filename}will be typeset asfilename. π\Prog{prog}β used to typeset program names, e.g.\Prog{latex2man}will be typeset aslatex2man.\Cmd{command}{chapter}β used to typeset references to other commands, e.g.\Cmd{latex2man}{1}will be typeset aslatex2man(1).\Barβ is typeset as|.\Bsβ (BackSlash) is typeset as\.\Tildeβ is typeset as a~.\Dotsβ is typeset as....\Bulletβ us typeset as*. (yes "us", we keep it, don't come for me π)\setVersion{..}β set..as version information.\setVersionWord{..}β set..for the wordVersion:in the footline. The default is\setVersionWord{Version:}.\Versionβ returns the version information. π\setDate{..}β sets..as date information.\Dateβ returns the date information.\Email{..}β use to mark an Email address:\Email{Juergen.Vollmer@informatik-vollmer.de}is typeset as:Juergen.Vollmer@informatik-vollmer.de.\URL{..}β use to mark an URL:\URL{http://www.foo.de/\Tilde vollmer}is typeset ashttp://www.foo.de/~vollmer. π\LatexManEndβ the input file is read and processed until reading end-of-file or\LatexManEnd(at the beginning of a line). LaTeX ignores this command. π\Lbr,\Rbrβ is typeset as[and](these variants are needed only somtimes like in\item[FooBar\LBr xx \Lbr]. Usually[]will work.)\LBr,\RBrβ is typeset as{and}(these variants are needed when using{or}as arguments to macros.\Circumβ is typeset as^.\Percentβ is typeset as%.\TEXbrβ If processed with LaTeX causes a linebreak (i.e. is equivalent to\\). In the output oflatex2manthis macro is ignored.\TEXIbrβ If TexInfo output is generated, causes a linebreak (i.e. is equivalent to\\), otherwise ignored.\MANbrβ If Man-Page output is generated, causes a linebreak (i.e. is equivalent to\\), otherwise ignored.
π part 1 done, more coming, don't go anywhere bestie π
\HTMLbrβ if HTML output is generated, this drops a linebreak (so it's literally equivalent to\\); otherwise it's just ignored, no thoughts, head empty π\medskipβ an empty line. That's the whole job. Iconic, honestly.\SPβ produces some extra space, and bestie it works at the beginning of lines too, which is the entire point. The code of the second line looks like\SP abc \SP\SP xx\\:
abc xx
abc xx
abc xx
Heads up π due to some "problems" with TexInfo, the lines starting with\SPhave a leading.(dot) in the TexInfo output β peep-achar.
ποΈ ACCEPTED MACROS FROM THE RCSINFO PACKAGE
\rcsInfo $Id ...$β if the LaTeX packagercsinfois used, this command extracts the date of the Man-page. iykyk β¨\rcsInfoLongDateβ if the LaTeX packagercsinfois used, this command typesets the date coded in the$Id ..$string.
π ACCEPTED LaTeX MACROS
The following standard LaTeX commands are accepted β yes, all of them, we're not cutting corners here π«Ά
\section{..}β takes one argument: the name of the Man-page section. Each Man-page consists of several sections. Usually there are these sections in a Man-page: Name (special handling as environment, c.f. above), Synopsis, Description, Options, Files, See Also, Diagnostics, Return Values, Bugs, Author, version, etc.
Synopsis must be the first section after the Name environment. Periodt.
Note: do not use LaTeX macros in section names, bestie, just don't π
\subsection{..}β works as well as\subsubsection{..}those. Slay.\emph{..}β\emph{example}is typeset as example.\textbf{..}β\textbf{example}is typeset as example.\texttt{..}β\texttt{example}is typeset asexample.\underline{..}β\underline{example}is typeset as an underlined example.\date{..}β uses .. as the date.\verb+..+β but only+is allowed as the delimiter. That's the rule, no negotiating π$<$β is typeset as<.$>$β is typeset as>.$<=$β is typeset as<=.$>=$β is typeset as>=.$=$β is typeset as=.$<>$β is typeset as<>.$\ge$β is typeset as>=.$\le$β is typeset as<=.$\leftarrow$β is typeset as<--.$\Leftarrow$β is typeset as<==.$\rightarrow$β is typeset as-->.$\Rightarrow$β is typeset as==>.\{β is typeset as{.\}β is typeset as}.\$β is typeset as$.\$β is typeset as$, and it should be used inside macro arguments.\_β is typeset as_.\&β is typeset as&.\#β is typeset as#.\%β is typeset as%.\,β is typeset as a smaller blank- -(between the two-).\-β is used to mark hyphenation in a word.\\β is typeset as a linebreak, or marks the end of a column in theTableenvironment.\(a\followed by a blank) β is typeset as a blank, although it can't be used at the beginning of a line to make indentation (see the\SPcommand, the actual main character π ).~β is typeset as a blank.\copyrightβ is typeset as(C).\noindent\hlineβ inside aTableenvironment.\itemβ inside anitemize,enumerate, ordescriptionenvironment.\todayβ16 January 2026(see also thercsinfoLaTeX package).\ss,\"a, ...β\ss= Γ,\"a= Γ€,\"o= ΓΆ,\"u= ΓΌ,\"A= Γ,\"O= Γ,\"U= Γ. It's allowed to surround these macros in{and}in all places, even inside other macros, e.g.
\textbf{\"a\"o\"u\"A\"O\"U\ss}
\textbf{\"a}{\"o}{\"u}{\"A}{\"O}{\"U}{\ss}}
\textbf{ÀâüΓΓΓΓ}
If these letters are used in their LATIN-1 8-bit coding, they're translated into the equivalent letter of the desired output format. E.g. Γ€ becomes Ä in HTML and @"A in texinfo. Literally so handy π§
\input{..}β read and process the given filename.
Please note π«Ά the name of the LaTeX macro and its arguments must be contained in one line.
π CONDITIONAL TEXT
latex2man preprocesses the LaTeX input so you can use text conditionally. A special sort of LaTeX comment is used for that purpose:
%@% IF condition %@%%@% ELSE %@%%@% END-IF %@%
A line must contain only such a comment and nothing else. condition is a boolean expression containing "names" and operators. The names given with the -Cname option have the value "true", while all other names occuring in the expression are assumed to be "false". If evaluating the boolean expression results in "true", the text in the "then"-part is used and the text in the optional "else"-part is skipped (and vice versa). The IF/ELSE/END-IF may be nested. As boolean operators the following are allowed:
( and ) for grouping are allowed.
For example:
%@% IF abc %@%
abc set
%@% IF xyz %@%
xyz set
%@% ELSE %@%
xyz NOT set
%@% END-IF %@%
%@% ELSE %@%
abc NOT set
%@% IF xyz || !XYZ %@%
xyz OR !XYZ set
%@% ELSE %@%
xyz OR !XYZ NOT set
%@% END-IF %@%
%@% END-IF %@%
Run this manual page through latex2man with e.g. -C'abc XYZ' and have a look at the generated output. (If you simply run the LaTeX document through LaTeX, all lines are shown in the .dvi file.)
abc NOT set
xyz OR !XYZ set
To check the conditional text feature, when latex2man is called with
-CHTMLβ the lines 1a, 2b, 3b, and 4b;-CTEXIβ the lines 1b, 2a, 3b, and 4b;-CMANβ the lines 1b, 2b, 3a, and 4b;-CLATEXβ the lines 1b, 2b, 3b, and 4a;- calling LaTeX without preprocessing β all lines
should be shown:
1b. The HTML conditional was not set.
2b. The TEXI conditional was not set.
3a. This text occurs only when viewing the MAN output
4b. The LATEX conditional was not set.
π§΅ TRANSLATION OF USER DEFINED MACROS
The user macro translation file (given by the [-ttransfile]) contains Perl commands specifying the translation of LaTeX macros defined by the user. These macros may have none, one or two arguments. The following code is expected:
- Comments start with a
#up to the end of the line. - For a macro
\foowith no arguments, the following code must be specified:- Translation to Man-Pages β
$manMacro{'foo'} = '...'; - Translation to HTML β
$htmlMacro{'foo'} = '...'; - Translation to TexInfo β
$texiMacro{'foo'} = '...';
- Translation to Man-Pages β
where ... is the translation.
- For a macro
\foo{..}with one argument, the following code must be specified:- Translation to Man-Pages β
$manMacro1a{'foo'} = '...';and$manMacro1b{'foo'} = '...'; - Translation to HTML β
$htmlMacro1a{'foo'} = '...';and$htmlMacro1b{'foo'} = '...'; - Translation to TexInfo β
$texiMacro1a{'foo'} = '...';and$texiMacro1b{'foo'} = '...';
- Translation to Man-Pages β
where ... is the translation. The 1a code is used before the argument, while 1b is typeset after the argument is set.
- For a macro
\foo{..}{..}with two arguments, the following code must be specified:- Translation to Man-Pages β
$manMacro2a{'foo'} = '...';and$manMacro2b{'foo'} = '...';and$manMacro2c{'foo'} = '...'; - Translation to HTML β
$htmlMacro2a{'foo'} = '...';and$htmlMacro2b{'foo'} = '...';and$htmlMacro2c{'foo'} = '...'; - Translation to TexInfo β
$texiMacro2a{'foo'} = '...';and$texiMacro2b{'foo'} = '...';and$texiMacro2c{'foo'} = '...';
- Translation to Man-Pages β
where ... is the translation. The 2a code is used before the first argument, 2b between the two arguments, and 2c is typeset after the second argument is set.
- The file
latex2man.transcontains some example code. π
π§ͺ VERBATIM ENVIRONMENT
This
{is}
\texttt{a}
$test$
_of_
verbatim
<this is no HTML tag> and no @* TexInfo command
πΈ SUBSECTION WORKS
This is a \subsection.
π¦ Subsubsection works
This is a \subsubsection.
π Subsubsection still works
This is another \subsubsection.
π GENERAL REMARKS
- Empty lines are typeset as paragraph separators.
- The arguments of the LaTeX commands must not be split over several lines.
- Do not nest calls to macros.
- Except the mentioned environments and macros, the usage of other LaTeX environments or macros are not translated. Their usage will cause garbage in the output. Not a cute look π
latex2manrequires Perl version>= 5.0004_03.- If you want to install the system with the distributed
Makefile, you need GNU-make. If you don't have it, you should execute the steps shown in theMakefilemanually.
π CSS CLASSNAMES π
okay so this is the part where it gets aesthetic π β the HTML output tags everything up with CSS classes as attributes, and you can go absolutely feral styling them in your CSS file. Here's the full rundown, bestie:
bodyβ no class here, this one's just the body of the HTML page, the whole vibe container β¨h1βtitleheadβ the title at the top of the HTML page, specified as an argument to theNameenvironmenth4βauthorheadβ the author at the top of the HTML page, specified as an argument to theNameenvironmenth4βdateheadβ the date at the top of the HTML pageh4βversionheadβ the man page version at the top of the HTML page, specified as an argument to thesetVersionmacroh2βsectionnameβ a section title specified as an argument to thesectionmacroh4βsubsectionnameβ a subsection title specified as an argument to thesubsectionmacroh5βsubsubsectionnameβ a subsubsection title specified as an argument to thesubsubsectionmacrofontβprognameβ a program name specified as an argument to theProgmacrofontβfilenameβ a file name specified as an argument to theFilemacrofontβcommandnameβ a command name specified as an argument to theCmdmacrofontβtextstyleβ all text that is not an argument to some LaTeX or latex2man macrofontβoptstyleβ a name of an option specified as an argument to theOpt,oOpt,OptArg,oOptArgoroOptoArgmacrosfontβargstyleβ a name of an argument specified as an argument to theArg,oArg,OptArg,oOptArgoroOptoArgmacrosa,fontβurlstyleβ a URL specified as an argument to theURLmacroa,fontβurlstyle.linkβ subclass ofurlstyleclassa,fontβurlstyle.visitedβ subclass ofurlstyleclassa,fontβurlstyle.hoverβ subclass ofurlstyleclassa,fontβemailstyleβ an email specified as an argument to theEmailmacroa,fontβemailstyle.linkβ subclass ofemailstyleclassa,fontβemailstyle.visitedβ subclass ofemailstyleclassa,fontβemailstyle.hoverβ subclass ofemailstyleclasstableβtablestyleβ a table specified as aTableenvironmenttrβrowstyleβ a row of a table specified as aTableenvironmenttdβcellstyleβ a cell of a table specified as aTableenvironment
π SOME BUG FIX TESTS π
this section is literally the receipts, no cap. historical bug fixes with their test cases, all preserved π
Leading . and '
Now leading . and ' in generation troff output should work propperly, since a \& is added. Therfore the \Dot macro has been deleted.
Thanks to Frank.Schilder@Mathematik.Tu-Ilmenau.De.
Testcase 1:
'\n' ...
Testcase 2:
.foobar Testcase 3:
...
abc ... abc . efg ' 123
% in verbatim
A % in a \verb and verbatim-environment was not emitted correctly. Thanks to Aleksey Nogin nogin@cs.caltech.edu for the bug report and bug fix.
% abc
% abc %
but ignore comments following this:
ngl this one's giving "trust the process" energy π the tests above are quoted exactly as they appear, quirks and all β do not come for me, I'm just the messenger π«Ά
β¨ REQUIREMENTS β¨
- Perl β latex2man requires Perl version
>= 5.0004_03. - Make β if you want to install the system with the distributed
Makefile, you need GNU-make. If you don't have it, you should execute the steps shown in theMakefilemanually. π - LaTeX β LaTeX2e is required. periodt.
π CHANGES π
Please check the file latex2man-CHANGES for the list of changes and acknowledgment to people contributing bugfixes or enhancements. (yes, the changelog is a whole thing, go read it π)
β VERSION β
Version: 1.30 of 2026/01/16.
π LICENSE AND COPYRIGHT π
Copyright
(C)1998, Dr. JΓΌrgen Vollmer, Am Rennbuckel 21, D-76185 Karlsruhe, Germany, Juergen.Vollmer@informatik-vollmer.de
The most recent version of Latex2man may be found on my homepage http://www.informatik-vollmer.de/software/latex2man.html.
License
This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives in directory macros/latex/base/lppl.txt; either version 1 of the License, or any later version. π¦
Misc
If you find this software useful, please send me a postcard from the place where you are living. (this is genuinely the most wholesome thing in a man page ever, I'm obsessed ππ)
πΈ AUTHOR πΈ
Dr. JΓΌrgen Vollmer Am Rennbuckel 21 D-76185 Karlsruhe Email: Juergen.Vollmer@informatik-vollmer.de WWW: http://www.informatik-vollmer.de.
and that's a wrap on the whole page, bestie π this last bit came to you courtesy of Documentation Tools, dated 2026/01/16, filed under LATEX2MAN(1) β go forth and generate man pages, you absolute icon π β¨
π¦ where this page comes from
- alpine 3.24: texmf-dist-binextra-doc 2026.0-r0 Β· LPPL-1.0 AND LPPL-1.1 AND LPPL-1.2 AND LPPL-1.3a AND LPPL-1.3c AND GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms