LATEX2MAN(1)

πŸ“¦ version 2026.0, in alpine 3.24

🌸 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 -H you 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 the man(1) command (this is the default, so it's doing the most without even trying).
  • -H β€” instead of producing output suitable for the man(1) command, HTML code is produced (despite the name of the command, lol, iconic).
  • -T β€” instead of producing output suitable for the man(1) command, TexInfo code is produced (despite the name of the command). The generated .texi-file may be processed with makeinfo(1) (to produce an .info-file) which in turn may be installed using install-info(1). The Info tags @dircategory and @direntry are provided. πŸ“š
  • -L β€” the LaTeX source is written to the outfile. This is useful in conjunction with the -Cname option.
  • -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:
    • -H defines HTML
    • -T defines TEXI
    • -M defines MAN
    • -L defines LATEX
  • -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 -a supresses the indentation of a line. Note: only for the first \SP of 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 package fancyheadings.
  • fancyhdr β€” use the LaTeX package fancyhdr.
  • nofancy β€” neither the LaTeX package fancyheadings nor fancyhdr are 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} β€” the Name environment takes five arguments:
    1. the Man-page chapter,
    2. the name of the Man-page,
    3. the author,
    4. some short information about the tool printed in the footline of the Man-page, and
    5. 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} β€” the Table environment 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 with troff(1) and tables are used, the tbl(1) preprocessor should be called, usually by giving a -t to the call of troff(1). When viewing the generated manula page using man(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:

  • description
  • enumerate
  • itemize
  • verbatim
  • center

They may be nested:

  • Itemize and nested center:
                             A centered line.
                          Another centered line.
  • Another item an nested enumerate
    1. a
    2. 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 as filename.
  • \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 as filename. πŸ“
  • \Prog{prog} β€” used to typeset program names, e.g. \Prog{latex2man} will be typeset as latex2man.
  • \Cmd{command}{chapter} β€” used to typeset references to other commands, e.g. \Cmd{latex2man}{1} will be typeset as latex2man(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 word Version: 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 as http://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 of latex2man this 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 \SP have a leading . (dot) in the TexInfo output β€” peep -achar.

πŸ—‚οΈ ACCEPTED MACROS FROM THE RCSINFO PACKAGE

  • \rcsInfo $Id ...$ β€” if the LaTeX package rcsinfo is used, this command extracts the date of the Man-page. iykyk ✨
  • \rcsInfoLongDate β€” if the LaTeX package rcsinfo is 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 as example.
  • \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 the Table environment.
  • \ (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 \SP command, the actual main character πŸ’…).
  • ~ β€” is typeset as a blank.
  • \copyright β€” is typeset as (C).
  • \noindent
  • \hline β€” inside a Table environment.
  • \item β€” inside an itemize, enumerate, or description environment.
  • \today β€” 16 January 2026 (see also the rcsinfo LaTeX 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 &Auml; 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 \foo with no arguments, the following code must be specified:
    • Translation to Man-Pages β€” $manMacro{'foo'} = '...';
    • Translation to HTML β€” $htmlMacro{'foo'} = '...';
    • Translation to TexInfo β€” $texiMacro{'foo'} = '...';

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'} = '...';

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'} = '...';

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.trans contains 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

  1. Empty lines are typeset as paragraph separators.
  2. The arguments of the LaTeX commands must not be split over several lines.
  3. Do not nest calls to macros.
  4. 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 πŸ’€
  5. latex2man requires Perl version >= 5.0004_03.
  6. 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 the Makefile manually.

πŸŽ€ 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 the Name environment
  • h4 β†’ authorhead β€” the author at the top of the HTML page, specified as an argument to the Name environment
  • h4 β†’ datehead β€” the date at the top of the HTML page
  • h4 β†’ versionhead β€” the man page version at the top of the HTML page, specified as an argument to the setVersion macro
  • h2 β†’ sectionname β€” a section title specified as an argument to the section macro
  • h4 β†’ subsectionname β€” a subsection title specified as an argument to the subsection macro
  • h5 β†’ subsubsectionname β€” a subsubsection title specified as an argument to the subsubsection macro
  • font β†’ progname β€” a program name specified as an argument to the Prog macro
  • font β†’ filename β€” a file name specified as an argument to the File macro
  • font β†’ commandname β€” a command name specified as an argument to the Cmd macro
  • font β†’ textstyle β€” all text that is not an argument to some LaTeX or latex2man macro
  • font β†’ optstyle β€” a name of an option specified as an argument to the Opt, oOpt, OptArg, oOptArg or oOptoArg macros
  • font β†’ argstyle β€” a name of an argument specified as an argument to the Arg, oArg, OptArg, oOptArg or oOptoArg macros
  • a, font β†’ urlstyle β€” a URL specified as an argument to the URL macro
  • a, font β†’ urlstyle.link β€” subclass of urlstyle class
  • a, font β†’ urlstyle.visited β€” subclass of urlstyle class
  • a, font β†’ urlstyle.hover β€” subclass of urlstyle class
  • a, font β†’ emailstyle β€” an email specified as an argument to the Email macro
  • a, font β†’ emailstyle.link β€” subclass of emailstyle class
  • a, font β†’ emailstyle.visited β€” subclass of emailstyle class
  • a, font β†’ emailstyle.hover β€” subclass of emailstyle class
  • table β†’ tablestyle β€” a table specified as a Table environment
  • tr β†’ rowstyle β€” a row of a table specified as a Table environment
  • td β†’ cellstyle β€” a cell of a table specified as a Table environment

πŸ› 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 the Makefile manually. πŸ’…
  • 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.


(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